mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
Split internal widget into separate file
This commit is contained in:
parent
f10bc5004f
commit
f3298801f3
9 changed files with 50 additions and 36 deletions
|
@ -55,6 +55,7 @@ rofi_SOURCES=\
|
||||||
include/history.h\
|
include/history.h\
|
||||||
include/widgets/box.h\
|
include/widgets/box.h\
|
||||||
include/widgets/widget.h\
|
include/widgets/widget.h\
|
||||||
|
include/widgets/widget-internal.h\
|
||||||
include/widgets/textbox.h\
|
include/widgets/textbox.h\
|
||||||
include/widgets/listview.h\
|
include/widgets/listview.h\
|
||||||
include/widgets/scrollbar.h\
|
include/widgets/scrollbar.h\
|
||||||
|
@ -199,6 +200,7 @@ textbox_test_SOURCES=\
|
||||||
include/mode-private.h\
|
include/mode-private.h\
|
||||||
include/settings.h\
|
include/settings.h\
|
||||||
include/widgets/widget.h\
|
include/widgets/widget.h\
|
||||||
|
include/widgets/widget-internal.h\
|
||||||
include/widgets/textbox.h\
|
include/widgets/textbox.h\
|
||||||
include/xrmoptions.h\
|
include/xrmoptions.h\
|
||||||
include/helper.h\
|
include/helper.h\
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#ifndef ROFI_SCROLLBAR_H
|
#ifndef ROFI_SCROLLBAR_H
|
||||||
#define ROFI_SCROLLBAR_H
|
#define ROFI_SCROLLBAR_H
|
||||||
#include <cairo.h>
|
#include <cairo.h>
|
||||||
#include "widget.h"
|
#include "widgets/widget.h"
|
||||||
|
#include "widgets/widget-internal.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup Scrollbar Scrollbar
|
* @defgroup Scrollbar Scrollbar
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
#include <pango/pango-fontmap.h>
|
#include <pango/pango-fontmap.h>
|
||||||
#include <pango/pangocairo.h>
|
#include <pango/pangocairo.h>
|
||||||
#include <cairo.h>
|
#include <cairo.h>
|
||||||
#include "widget.h"
|
#include "widgets/widget.h"
|
||||||
|
#include "widgets/widget-internal.h"
|
||||||
#include "x11-helper.h"
|
#include "x11-helper.h"
|
||||||
#include "keyb.h"
|
#include "keyb.h"
|
||||||
|
|
||||||
|
|
38
include/widgets/widget-internal.h
Normal file
38
include/widgets/widget-internal.h
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#ifndef WIDGET_INTERNAL_H
|
||||||
|
#define WIDGET_INTERNAL_H
|
||||||
|
|
||||||
|
struct _widget
|
||||||
|
{
|
||||||
|
/** X position relative to parent */
|
||||||
|
short x;
|
||||||
|
/** Y position relative to parent */
|
||||||
|
short y;
|
||||||
|
/** Width of the widget */
|
||||||
|
short w;
|
||||||
|
/** Height of the widget */
|
||||||
|
short h;
|
||||||
|
/** enabled or not */
|
||||||
|
gboolean enabled;
|
||||||
|
/** Information about packing. */
|
||||||
|
gboolean expand;
|
||||||
|
gboolean end;
|
||||||
|
|
||||||
|
struct _widget *parent;
|
||||||
|
/** Internal */
|
||||||
|
gboolean need_redraw;
|
||||||
|
/** Function prototypes */
|
||||||
|
int ( *get_width )( struct _widget * );
|
||||||
|
int ( *get_height )( struct _widget * );
|
||||||
|
|
||||||
|
void ( *draw )( struct _widget *widget, cairo_t *draw );
|
||||||
|
void ( *resize )( struct _widget *, short, short );
|
||||||
|
void ( *update )( struct _widget * );
|
||||||
|
|
||||||
|
// Signals.
|
||||||
|
widget_clicked_cb clicked;
|
||||||
|
void *clicked_cb_data;
|
||||||
|
|
||||||
|
// Free
|
||||||
|
void ( *free )( struct _widget *widget );
|
||||||
|
};
|
||||||
|
#endif // WIDGET_INTERNAL_H
|
|
@ -17,40 +17,6 @@
|
||||||
*/
|
*/
|
||||||
typedef struct _widget widget;
|
typedef struct _widget widget;
|
||||||
typedef gboolean ( *widget_clicked_cb )( widget *, xcb_button_press_event_t *, void * );
|
typedef gboolean ( *widget_clicked_cb )( widget *, xcb_button_press_event_t *, void * );
|
||||||
struct _widget
|
|
||||||
{
|
|
||||||
/** X position relative to parent */
|
|
||||||
short x;
|
|
||||||
/** Y position relative to parent */
|
|
||||||
short y;
|
|
||||||
/** Width of the widget */
|
|
||||||
short w;
|
|
||||||
/** Height of the widget */
|
|
||||||
short h;
|
|
||||||
/** enabled or not */
|
|
||||||
gboolean enabled;
|
|
||||||
/** Information about packing. */
|
|
||||||
gboolean expand;
|
|
||||||
gboolean end;
|
|
||||||
|
|
||||||
struct _widget *parent;
|
|
||||||
/** Internal */
|
|
||||||
gboolean need_redraw;
|
|
||||||
/** Function prototypes */
|
|
||||||
int ( *get_width )( struct _widget * );
|
|
||||||
int ( *get_height )( struct _widget * );
|
|
||||||
|
|
||||||
void ( *draw )( struct _widget *widget, cairo_t *draw );
|
|
||||||
void ( *resize )( struct _widget *, short, short );
|
|
||||||
void ( *update )( struct _widget * );
|
|
||||||
|
|
||||||
// Signals.
|
|
||||||
widget_clicked_cb clicked;
|
|
||||||
void *clicked_cb_data;
|
|
||||||
|
|
||||||
// Free
|
|
||||||
void ( *free )( struct _widget *widget );
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Macro to get widget from an implementation (e.g. textbox/scrollbar) */
|
/** Macro to get widget from an implementation (e.g. textbox/scrollbar) */
|
||||||
#define WIDGET( a ) ( ( a ) != NULL ? (widget *) ( a ) : NULL )
|
#define WIDGET( a ) ( ( a ) != NULL ? (widget *) ( a ) : NULL )
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "widgets/widget.h"
|
||||||
|
#include "widgets/widget-internal.h"
|
||||||
#include "widgets/box.h"
|
#include "widgets/box.h"
|
||||||
|
|
||||||
#define LOG_DOMAIN "Widgets.Box"
|
#define LOG_DOMAIN "Widgets.Box"
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "widgets/widget.h"
|
||||||
|
#include "widgets/widget-internal.h"
|
||||||
#include "widgets/separator.h"
|
#include "widgets/separator.h"
|
||||||
#include "x11-helper.h"
|
#include "x11-helper.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include "widgets/widget.h"
|
#include "widgets/widget.h"
|
||||||
|
#include "widgets/widget-internal.h"
|
||||||
|
|
||||||
int widget_intersect ( const widget *widget, int x, int y )
|
int widget_intersect ( const widget *widget, int x, int y )
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <widgets/widget.h>
|
#include <widgets/widget.h>
|
||||||
|
#include <widgets/widget-internal.h>
|
||||||
unsigned int test =0;
|
unsigned int test =0;
|
||||||
#define TASSERT( a ) { \
|
#define TASSERT( a ) { \
|
||||||
assert ( a ); \
|
assert ( a ); \
|
||||||
|
|
Loading…
Reference in a new issue