diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2022-07-06 23:46:59 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2022-07-07 02:37:25 +0200 |
| commit | dc4a3a2db894e8e7bb0be620b90780d55c74accd (patch) | |
| tree | e0d2de44fbdbb0883e0db21db7da0c99ae943a6c /src/gui/inc | |
| parent | 3f793166bdbd73a61c3a858d95e700b42ead602d (diff) | |
| download | jancity-dc4a3a2db894e8e7bb0be620b90780d55c74accd.tar.gz | |
Allow multiple button types
Diffstat (limited to 'src/gui/inc')
| -rw-r--r-- | src/gui/inc/gui/button.h | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/gui/inc/gui/button.h b/src/gui/inc/gui/button.h index acfc6c1..b712e29 100644 --- a/src/gui/inc/gui/button.h +++ b/src/gui/inc/gui/button.h @@ -15,8 +15,27 @@ extern "C" struct gui_button { struct gui_common common; - struct gui_label label; - short w; + + enum gui_button_type + { + GUI_BUTTON_TYPE_1, + GUI_BUTTON_TYPE_SPRITE + } type; + + union + { + struct + { + short w; + struct gui_label label; + } type1; + + struct + { + const struct sprite *s; + } sprite; + } u; + void *arg; void (*on_pressed)(void *); }; @@ -24,7 +43,7 @@ struct gui_button UTIL_STATIC_ASSERT(!offsetof(struct gui_button, common), "unexpected offset for struct gui_button"); -void gui_button_init(struct gui_button *b); +void gui_button_init(struct gui_button *b, enum gui_button_type t); enum { |
