Mercurial > molko
comparison libmlk-ui/mlk/ui/button.h @ 624:bbf30f167274
ui: improve button documentation
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 23 Aug 2023 21:20:16 +0200 |
parents | 509b395171f2 |
children |
comparison
equal
deleted
inserted
replaced
623:20b818193ce0 | 624:bbf30f167274 |
---|---|
17 */ | 17 */ |
18 | 18 |
19 #ifndef MLK_UI_BUTTON_H | 19 #ifndef MLK_UI_BUTTON_H |
20 #define MLK_UI_BUTTON_H | 20 #define MLK_UI_BUTTON_H |
21 | 21 |
22 union mlk_event; | 22 /** |
23 * \file mlk/ui/button.h | |
24 * \brief GUI button | |
25 */ | |
23 | 26 |
24 struct mlk_button; | 27 struct mlk_button; |
25 struct mlk_button_style; | 28 struct mlk_button_style; |
26 struct mlk_font; | 29 struct mlk_font; |
27 | 30 |
31 union mlk_event; | |
32 | |
33 /** | |
34 * \struct mlk_button | |
35 * \brief GUI button structure. | |
36 */ | |
28 struct mlk_button { | 37 struct mlk_button { |
29 /** | 38 /** |
30 * (read-write) | 39 * (read-write) |
31 * | 40 * |
32 * Position in x. | 41 * Position in x. |
81 */ | 90 */ |
82 struct mlk_button_style *style; | 91 struct mlk_button_style *style; |
83 }; | 92 }; |
84 | 93 |
85 /** | 94 /** |
86 * \struct mlk_label_button | 95 * \struct mlk_button_style |
87 * \brief Button style. | 96 * \brief Button style. |
88 */ | 97 */ |
89 struct mlk_button_style { | 98 struct mlk_button_style { |
90 /** | 99 /** |
91 * (read-write) | 100 * (read-write) |
130 void *data; | 139 void *data; |
131 | 140 |
132 /** | 141 /** |
133 * (read-write, optional) | 142 * (read-write, optional) |
134 * | 143 * |
135 * Update this label. | 144 * Update this button. |
136 * | 145 * |
137 * \param self this style | 146 * \param self this style |
138 * \param button the button to update | 147 * \param button the button to update |
139 * \param ticks frame ticks | 148 * \param ticks frame ticks |
140 */ | 149 */ |
174 * \brief Light default style for button. | 183 * \brief Light default style for button. |
175 */ | 184 */ |
176 extern struct mlk_button_style mlk_button_style_light; | 185 extern struct mlk_button_style mlk_button_style_light; |
177 | 186 |
178 /** | 187 /** |
179 * \brief Default style for all labels. | 188 * \brief Default style for all buttons. |
180 */ | 189 */ |
181 extern struct mlk_button_style *mlk_button_style; | 190 extern struct mlk_button_style *mlk_button_style; |
182 | 191 |
183 #if defined(__cplusplus) | 192 #if defined(__cplusplus) |
184 extern "C" { | 193 extern "C" { |
185 #endif | 194 #endif |
186 | 195 |
196 /** | |
197 * Handle event. | |
198 * | |
199 * \pre button != NULL | |
200 * \pre ev != NULL | |
201 * \param button the button | |
202 * \param ev the event | |
203 */ | |
187 int | 204 int |
188 mlk_button_handle(struct mlk_button *, const union mlk_event *); | 205 mlk_button_handle(struct mlk_button *button, const union mlk_event *ev); |
189 | 206 |
207 /** | |
208 * Update the button. | |
209 * | |
210 * \pre button != NULL | |
211 * \param button the button update | |
212 * \param ticks frame ticks | |
213 */ | |
190 void | 214 void |
191 mlk_button_update(struct mlk_button *, unsigned int); | 215 mlk_button_update(struct mlk_button *button, unsigned int ticks); |
192 | 216 |
217 /** | |
218 * Draw the button. | |
219 * | |
220 * \pre button != NULL | |
221 * \param button the button to draw | |
222 */ | |
193 void | 223 void |
194 mlk_button_draw(struct mlk_button *); | 224 mlk_button_draw(struct mlk_button *button); |
195 | 225 |
196 #if defined(__cplusplus) | 226 #if defined(__cplusplus) |
197 } | 227 } |
198 #endif | 228 #endif |
199 | 229 |