summaryrefslogtreecommitdiff
path: root/src/gui/widget.h
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2017-06-18 10:57:35 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2017-06-18 10:57:35 +0200
commitc6cdddeff0cb0437b1d54520d99460a58db39fdc (patch)
tree97ce8da5314293a7465e21e63d69904d82fa43af /src/gui/widget.h
parenteace3b5f238e5e4eaf4c2ffcbf741616a0d6a25f (diff)
downloadabaos-c6cdddeff0cb0437b1d54520d99460a58db39fdc.tar.gz
abaos-c6cdddeff0cb0437b1d54520d99460a58db39fdc.tar.bz2
started the widget framework
Diffstat (limited to 'src/gui/widget.h')
-rw-r--r--src/gui/widget.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/gui/widget.h b/src/gui/widget.h
new file mode 100644
index 0000000..a1e9a21
--- /dev/null
+++ b/src/gui/widget.h
@@ -0,0 +1,29 @@
+#ifndef WIDGET_H
+#define WIDGET_H
+
+#include "graphics_context.h"
+
+typedef struct {
+ void (*draw)( void *obj, graphics_context_t *context );
+ void (*get_focus)( void *obj );
+ void (*widget_model_to_screen)( void *obj, int *x, int *y );
+ void (*on_mouse_down)( void *obj, const int x, const int y );
+ void (*on_mouse_up)( void *obj, const int x, const int y );
+ void (*on_mouse_move)( void *obj, const int old_x, const int old_y, const int x, const int y );
+ void (*on_key_down)( void *obj, char c );
+} widget_vtable_t;
+
+typedef struct widget_t {
+ int x;
+ int y;
+ int w;
+ int h;
+ struct widget_t *parent;
+ widget_vtable_t *vtable;
+} widget_t;
+
+void widget_init( widget_t *widget, widget_t *parent, const int x, const int y, const int w, const int h );
+
+void widget_draw( void *obj, graphics_context_t *context );
+
+#endif // WIDGET_H