summaryrefslogtreecommitdiff
path: root/src/gui/widget.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widget.h')
-rw-r--r--src/gui/widget.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/gui/widget.h b/src/gui/widget.h
index a1e9a21..1fd23ac 100644
--- a/src/gui/widget.h
+++ b/src/gui/widget.h
@@ -3,14 +3,20 @@
#include "graphics_context.h"
+#include <stdbool.h>
+
+struct widget_t;
+
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 (*get_focus)( void *obj, struct widget_t *widget );
+ void (*model_to_screen)( void *obj, int *x, int *y );
+ bool (*contains_coordinate)( void *obj, const int x, const 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 );
+ void (*on_key_up)( void *obj, char c );
} widget_vtable_t;
typedef struct widget_t {
@@ -18,6 +24,7 @@ typedef struct widget_t {
int y;
int w;
int h;
+ bool focusable;
struct widget_t *parent;
widget_vtable_t *vtable;
} widget_t;
@@ -25,5 +32,13 @@ typedef struct 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 );
+void widget_get_focus( void *obj, widget_t *widget );
+void widget_model_to_screen( void *obj, int *x, int *y );
+bool widget_contains_coordinate( void *obj, const int x, const int y );
+void widget_on_mouse_down( void *obj, const int x, const int y );
+void widget_on_mouse_up( void *obj, const int x, const int y );
+void widget_on_mouse_move( void *obj, const int old_x, const int old_y, const int x, const int y );
+void widget_on_key_down( void *obj, char c );
+void widget_on_key_up( void *obj, char c );
#endif // WIDGET_H