2016-10-09 08:13:15 +00:00
|
|
|
#ifndef WIDGET_INTERNAL_H
|
|
|
|
#define WIDGET_INTERNAL_H
|
|
|
|
|
2016-10-14 16:56:09 +00:00
|
|
|
/**
|
|
|
|
* Data structure holding the internal state of the Widget
|
|
|
|
*/
|
2016-10-09 08:13:15 +00:00
|
|
|
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;
|
2016-10-14 16:56:09 +00:00
|
|
|
/** Expand the widget when packed */
|
2016-10-09 08:13:15 +00:00
|
|
|
gboolean expand;
|
2016-10-14 16:56:09 +00:00
|
|
|
/** Place widget at end of parent */
|
2016-10-09 08:13:15 +00:00
|
|
|
gboolean end;
|
2016-10-14 16:56:09 +00:00
|
|
|
/** Parent widget */
|
2016-10-09 08:13:15 +00:00
|
|
|
struct _widget *parent;
|
|
|
|
/** Internal */
|
|
|
|
gboolean need_redraw;
|
2016-10-14 16:56:09 +00:00
|
|
|
/** get width of widget implementation function */
|
2016-10-09 08:13:15 +00:00
|
|
|
int ( *get_width )( struct _widget * );
|
2016-10-14 16:56:09 +00:00
|
|
|
/** get height of widget implementation function */
|
2016-10-09 08:13:15 +00:00
|
|
|
int ( *get_height )( struct _widget * );
|
2016-10-14 16:56:09 +00:00
|
|
|
/** draw widget implementation function */
|
2016-10-09 08:13:15 +00:00
|
|
|
void ( *draw )( struct _widget *widget, cairo_t *draw );
|
2016-10-14 16:56:09 +00:00
|
|
|
/** resize widget implementation function */
|
2016-10-09 08:13:15 +00:00
|
|
|
void ( *resize )( struct _widget *, short, short );
|
2016-10-14 16:56:09 +00:00
|
|
|
/** update widget implementation function */
|
2016-10-09 08:13:15 +00:00
|
|
|
void ( *update )( struct _widget * );
|
|
|
|
|
2016-10-25 20:45:11 +00:00
|
|
|
/** Handle mouse motion, used for dragging */
|
2016-10-26 06:24:34 +00:00
|
|
|
gboolean ( *motion_notify )( struct _widget *, xcb_motion_notify_event_t * );
|
2016-10-25 19:19:39 +00:00
|
|
|
|
2016-10-14 16:56:09 +00:00
|
|
|
/** widget clicked callback */
|
2016-10-09 08:13:15 +00:00
|
|
|
widget_clicked_cb clicked;
|
2016-11-15 20:54:31 +00:00
|
|
|
/** user data for clicked callback */
|
2016-10-09 08:13:15 +00:00
|
|
|
void *clicked_cb_data;
|
|
|
|
|
2016-10-14 16:56:09 +00:00
|
|
|
/** Free widget callback */
|
2016-10-09 08:13:15 +00:00
|
|
|
void ( *free )( struct _widget *widget );
|
|
|
|
};
|
|
|
|
#endif // WIDGET_INTERNAL_H
|