summaryrefslogtreecommitdiff
path: root/src/gui/composite_widget.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/composite_widget.h')
-rw-r--r--src/gui/composite_widget.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/gui/composite_widget.h b/src/gui/composite_widget.h
new file mode 100644
index 0000000..d3ba90a
--- /dev/null
+++ b/src/gui/composite_widget.h
@@ -0,0 +1,32 @@
+#ifndef COMPOSITE_WIDGET_H
+#define COMPOSITE_WIDGET_H
+
+#include "widget.h"
+
+#define MAX_NOF_WIDGET_CHILDREN 100
+
+typedef struct {
+ widget_vtable_t base;
+ void (*add_child)( void *obj, widget_t *child );
+} composite_widget_vtable_t;
+
+typedef struct {
+ widget_t base;
+ composite_widget_vtable_t *vtable;
+ widget_t *children[MAX_NOF_WIDGET_CHILDREN];
+ int nof_children;
+ widget_t *focused_child;
+} composite_widget_t;
+
+void composite_widget_init( composite_widget_t *widget, widget_t *parent, const int x, const int y, const int w, const int h );
+
+void composite_widget_draw( void *obj, graphics_context_t *context );
+void composite_widget_get_focus( void *obj, widget_t *widget );
+void composite_widget_on_mouse_down( void *obj, const int x, const int y );
+void composite_widget_on_mouse_up( void *obj, const int x, const int y );
+void composite_widget_on_mouse_move( void *obj, const int old_x, const int old_y, const int x, const int y );
+void composite_widget_on_key_down( void *obj, char c );
+void composite_widget_on_key_up( void *obj, char c );
+void composite_widget_add_child( void *obj, widget_t *child );
+
+#endif // COMPOSITE_WIDGET_H