1
0
Fork 0
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:
Dave Davenport 2016-10-09 10:13:15 +02:00
parent f10bc5004f
commit f3298801f3
9 changed files with 50 additions and 36 deletions

View file

@ -55,6 +55,7 @@ rofi_SOURCES=\
include/history.h\
include/widgets/box.h\
include/widgets/widget.h\
include/widgets/widget-internal.h\
include/widgets/textbox.h\
include/widgets/listview.h\
include/widgets/scrollbar.h\
@ -199,6 +200,7 @@ textbox_test_SOURCES=\
include/mode-private.h\
include/settings.h\
include/widgets/widget.h\
include/widgets/widget-internal.h\
include/widgets/textbox.h\
include/xrmoptions.h\
include/helper.h\

View file

@ -1,7 +1,8 @@
#ifndef ROFI_SCROLLBAR_H
#define ROFI_SCROLLBAR_H
#include <cairo.h>
#include "widget.h"
#include "widgets/widget.h"
#include "widgets/widget-internal.h"
/**
* @defgroup Scrollbar Scrollbar

View file

@ -6,7 +6,8 @@
#include <pango/pango-fontmap.h>
#include <pango/pangocairo.h>
#include <cairo.h>
#include "widget.h"
#include "widgets/widget.h"
#include "widgets/widget-internal.h"
#include "x11-helper.h"
#include "keyb.h"

View 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

View file

@ -17,40 +17,6 @@
*/
typedef struct _widget widget;
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) */
#define WIDGET( a ) ( ( a ) != NULL ? (widget *) ( a ) : NULL )

View file

@ -26,6 +26,8 @@
#include <config.h>
#include <stdio.h>
#include "widgets/widget.h"
#include "widgets/widget-internal.h"
#include "widgets/box.h"
#define LOG_DOMAIN "Widgets.Box"

View file

@ -26,6 +26,8 @@
#include <xkbcommon/xkbcommon.h>
#include <glib.h>
#include <string.h>
#include "widgets/widget.h"
#include "widgets/widget-internal.h"
#include "widgets/separator.h"
#include "x11-helper.h"
#include "settings.h"

View file

@ -1,5 +1,6 @@
#include <glib.h>
#include "widgets/widget.h"
#include "widgets/widget-internal.h"
int widget_intersect ( const widget *widget, int x, int y )
{

View file

@ -6,6 +6,7 @@
#include <glib.h>
#include <string.h>
#include <widgets/widget.h>
#include <widgets/widget-internal.h>
unsigned int test =0;
#define TASSERT( a ) { \
assert ( a ); \