-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwidget.c
More file actions
executable file
·43 lines (37 loc) · 859 Bytes
/
widget.c
File metadata and controls
executable file
·43 lines (37 loc) · 859 Bytes
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
36
37
38
39
40
41
42
43
/* widget.c */
#include "baize.h"
#include "command.h"
#include "ui.h"
void WidgetCtor(struct Widget *const self, struct Container* parent, int align, CommandFunction cf, void* param)
{
self->parent = parent;
self->align = align;
self->bcf = cf;
self->param = param;
}
Rectangle WidgetScreenRect(struct Widget *const self)
{
Rectangle r;
r.x = self->parent->rect.x + self->rect.x;
r.y = self->parent->rect.y + self->rect.y;
r.width = self->rect.width;
r.height = self->rect.height;
return r;
}
void WidgetUpdate(struct Widget *const self)
{
(void)self;
}
void WidgetDraw(struct Widget *const self)
{
(void)self; // all drawing done by subclasses
}
void WidgetFree(struct Widget *const self)
{
if (self) {
if (self->param) {
free(self->param);
}
free(self);
}
}