2 * Acess2 Window Manager v3
3 * - By John Hodge (thePowersGang)
5 * renderer/widget/common.h
6 * - Widget common definitions
8 #ifndef _RENDERER_WIDGET_COMMON_H
9 #define _RENDERER_WIDGET_COMMON_H
11 #include <renderer_widget.h> // Widget types
13 typedef struct sWidgetDef tWidgetDef;
15 #define WIDGETTYPE_FLAG_NOCHILDREN 0x001
20 void (*Init)(tElement *Ele);
21 void (*Delete)(tElement *Ele);
23 void (*Render)(tWindow *Window, tElement *Ele);
25 void (*UpdateFlags)(tElement *Ele);
26 void (*UpdateSize)(tElement *Ele);
27 void (*UpdateText)(tElement *Ele, const char *Text); // This should update Ele->Text
30 * \name Input handlers
31 * \note Returns boolean unhandled
34 int (*MouseButton)(tElement *Ele, int X, int Y, int Button, int bPressed);
35 int (*MouseMove)(tElement *Ele, int X, int Y);
36 int (*KeyDown)(tElement *Ele, int KeySym, int Character);
37 int (*KeyUp)(tElement *Ele, int KeySym);
38 int (*KeyFire)(tElement *Ele, int KeySym, int Character);
44 extern void Widget_int_SetTypeDef(int Type, tWidgetDef *Def);
45 extern void Widget_UpdateMinDims(tElement *Element);
46 extern void Widget_Fire(tElement *Element);
48 #define DEFWIDGETTYPE(_type, _flags, _attribs...) \
49 tWidgetDef _widget_typedef_##_type = {.Flags=(_flags),_attribs};\
50 void _widget_set_##_type(void) __attribute__((constructor));\
51 void _widget_set_##_type(void) { Widget_int_SetTypeDef(_type, &_widget_typedef_##_type);}