aboutsummaryrefslogtreecommitdiff
path: root/src/gui/inc/gui/button.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/inc/gui/button.h')
-rw-r--r--src/gui/inc/gui/button.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/gui/inc/gui/button.h b/src/gui/inc/gui/button.h
new file mode 100644
index 0000000..acfc6c1
--- /dev/null
+++ b/src/gui/inc/gui/button.h
@@ -0,0 +1,44 @@
+#ifndef GUI_BUTTON_H
+#define GUI_BUTTON_H
+
+#include <gfx.h>
+#include <gui.h>
+#include <gui/label.h>
+#include <util.h>
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct gui_button
+{
+ struct gui_common common;
+ struct gui_label label;
+ short w;
+ void *arg;
+ void (*on_pressed)(void *);
+};
+
+UTIL_STATIC_ASSERT(!offsetof(struct gui_button, common),
+ "unexpected offset for struct gui_button");
+
+void gui_button_init(struct gui_button *b);
+
+enum
+{
+ GUI_BUTTON_LEFT,
+ GUI_BUTTON_MID,
+ GUI_BUTTON_RIGHT,
+
+ MAX_GUI_BUTTON_SPRITES
+};
+
+extern struct sprite gui_button_sprites[MAX_GUI_BUTTON_SPRITES];
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GUI_BUTTON_H */