comparison src/libmlk-ui/ui/button.h @ 409:6011ad866e99

ui: delete action functions The handling of actions is done without taking care of the return value which make it impossible to detect UI elements since it's a immediate mode like implementation. Users are encouraged to write code like instead: ``` if (button_handle(&b, &ev)) { // Do something. } ```
author David Demelier <markand@malikania.fr>
date Fri, 09 Sep 2022 09:27:17 +0200
parents 460c78706989
children 8f59201dc76b
comparison
equal deleted inserted replaced
408:0ea90751a62d 409:6011ad866e99
21 21
22 #include <core/core.h> 22 #include <core/core.h>
23 23
24 union event; 24 union event;
25 25
26 struct action;
27 struct theme; 26 struct theme;
28 27
29 enum button_state { 28 enum button_state {
30 BUTTON_STATE_NONE, 29 BUTTON_STATE_NONE,
31 BUTTON_STATE_PRESSED, 30 BUTTON_STATE_PRESSED,
42 const struct theme *theme; 41 const struct theme *theme;
43 }; 42 };
44 43
45 CORE_BEGIN_DECLS 44 CORE_BEGIN_DECLS
46 45
47 void 46 int
48 button_handle(struct button *, const union event *); 47 button_handle(struct button *, const union event *);
49 48
50 void 49 void
51 button_reset(struct button *); 50 button_reset(struct button *);
52 51
54 button_draw_default(const struct theme *, const struct button *); 53 button_draw_default(const struct theme *, const struct button *);
55 54
56 void 55 void
57 button_draw(const struct button *); 56 button_draw(const struct button *);
58 57
59 void
60 button_action(struct button *, struct action *);
61
62 CORE_END_DECLS 58 CORE_END_DECLS
63 59
64 #endif /* !MLK_UI_BUTTON_H */ 60 #endif /* !MLK_UI_BUTTON_H */