1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#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;
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, const vga_color_t background_color );
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
|