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 | 251bd41c4499521baa2c810155f85a7fcb528116 (patch) | |
| tree | b7abb43109eb85369cec0c804de17507eca3f5b4 /src/gui/inc | |
| parent | a0363cef8578c098de48e8863db98a35750fbaac (diff) | |
| download | rts-251bd41c4499521baa2c810155f85a7fcb528116.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 { |
