diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2022-09-20 17:31:17 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2022-09-20 17:34:25 +0200 |
| commit | e3356fde2de41b29989b4e8884f04b2be763256f (patch) | |
| tree | 76cdcea6b5e171334cbd0256b5eccc9391e6f952 /src | |
| parent | 84c834c00023bbb581b9747e17039fd38facdda1 (diff) | |
gui: Implement gui_deinit
Diffstat (limited to 'src')
| -rw-r--r-- | src/gui/inc/gui.h | 2 | ||||
| -rw-r--r-- | src/gui/src/gui.c | 12 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/gui/inc/gui.h b/src/gui/inc/gui.h index 9093572..72b2fb0 100644 --- a/src/gui/inc/gui.h +++ b/src/gui/inc/gui.h @@ -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 } diff --git a/src/gui/src/gui.c b/src/gui/src/gui.c index b99300b..e8bd4d7 100644 --- a/src/gui/src/gui.c +++ b/src/gui/src/gui.c @@ -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); +} |
