gui: Implement gui_deinit
This commit is contained in:
parent
84c834c000
commit
e3356fde2d
|
@ -20,6 +20,7 @@ struct gui_common
|
|||
const struct camera *, struct input *);
|
||||
int (*render)(const struct gui_common *);
|
||||
void (*get_dim)(const struct gui_common *, short *w, short *h);
|
||||
void (*deinit)(struct gui_common *, struct input *);
|
||||
} *cb;
|
||||
|
||||
short x, y, xoff, yoff;
|
||||
|
@ -32,6 +33,7 @@ void gui_add_sibling(struct gui_common *g, struct gui_common *sibling);
|
|||
int gui_update(struct gui_common *g, const union peripheral *p,
|
||||
const struct camera *c, struct input *in);
|
||||
int gui_render(const struct gui_common *g);
|
||||
void gui_deinit(struct gui_common *g, struct input *in);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -182,3 +182,15 @@ int gui_render(const struct gui_common *const g)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void gui_deinit(struct gui_common *const g, struct input *const in)
|
||||
{
|
||||
if (g->cb && g->cb->deinit)
|
||||
g->cb->deinit(g, in);
|
||||
|
||||
if (g->child)
|
||||
gui_deinit(g->child, in);
|
||||
|
||||
for (struct gui_common *s = g->sibling; s; s = s->sibling)
|
||||
gui_deinit(s, in);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue