#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