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;
17 void (*Init)(tElement *Ele);
18 void (*Delete)(tElement *Ele);
20 void (*Render)(tWindow *Window, tElement *Ele);
22 void (*UpdateFlags)(tElement *Ele);
23 void (*UpdateSize)(tElement *Ele);
24 void (*UpdateText)(tElement *Ele, const char *Text); // This should update Ele->Text
27 * \name Input handlers
28 * \note Returns boolean unhandled
31 int (*MouseButton)(tElement *Ele, int X, int Y, int Button, int bPressed);
32 int (*MouseMove)(tElement *Ele, int X, int Y);
33 int (*KeyDown)(tElement *Ele, int KeySym, int Character);
34 int (*KeyUp)(tElement *Ele, int KeySym);
35 int (*KeyFire)(tElement *Ele, int KeySym, int Character);
41 extern void Widget_int_SetTypeDef(int Type, tWidgetDef *Def);
42 extern void Widget_UpdateMinDims(tElement *Element);
43 extern void Widget_Fire(tElement *Element);
45 #define DEFWIDGETTYPE(_type, _attribs...) \
46 tWidgetDef _widget_typedef_##_type = {_attribs};\
47 void _widget_set_##_type(void) __attribute__((constructor));\
48 void _widget_set_##_type(void) { Widget_int_SetTypeDef(_type, &_widget_typedef_##_type);}