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
32
33
34
35
|
#include "widget.h"
#include "string.h"
#include "stddef.h"
static widget_vtable_t widget_vtable = {
widget_draw,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL
};
void widget_init( widget_t *widget, widget_t *parent, const int x, const int y, const int w, const int h )
{
memset( widget, 0, sizeof( widget_t ) );
widget->parent = parent;
widget->x = x;
widget->y = y;
widget->w = w;
widget->h = h;
widget->vtable = &widget_vtable;
}
void widget_draw( void *obj, graphics_context_t *context )
{
widget_t *widget = obj;
vga_draw_rectangle( context, widget->x, widget->y, widget->w, widget->h,
vga_make_RGB( 0xFF, 0xFF, 0xFF ) );
}
|