Mercurial > molko
annotate libmlk-ui/mlk/ui/checkbox.h @ 609:d97674d33764
ui: grid menu be more flexible
author | David Demelier <markand@malikania.fr> |
---|---|
date | Fri, 11 Aug 2023 18:01:28 +0200 |
parents | 35e58271d820 |
children | b8fd5c112538 |
rev | line source |
---|---|
115
3bd0d3a39e30
core: implement checkbox, closes #2486
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
1 /* |
3bd0d3a39e30
core: implement checkbox, closes #2486
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
2 * checkbox.h -- GUI checkbox |
3bd0d3a39e30
core: implement checkbox, closes #2486
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
3 * |
445
773a082f0b91
misc: update copyright years
David Demelier <markand@malikania.fr>
parents:
433
diff
changeset
|
4 * Copyright (c) 2020-2023 David Demelier <markand@malikania.fr> |
115
3bd0d3a39e30
core: implement checkbox, closes #2486
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
5 * |
3bd0d3a39e30
core: implement checkbox, closes #2486
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
6 * Permission to use, copy, modify, and/or distribute this software for any |
3bd0d3a39e30
core: implement checkbox, closes #2486
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
7 * purpose with or without fee is hereby granted, provided that the above |
3bd0d3a39e30
core: implement checkbox, closes #2486
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
8 * copyright notice and this permission notice appear in all copies. |
3bd0d3a39e30
core: implement checkbox, closes #2486
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
9 * |
3bd0d3a39e30
core: implement checkbox, closes #2486
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
3bd0d3a39e30
core: implement checkbox, closes #2486
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
3bd0d3a39e30
core: implement checkbox, closes #2486
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
3bd0d3a39e30
core: implement checkbox, closes #2486
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
3bd0d3a39e30
core: implement checkbox, closes #2486
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
3bd0d3a39e30
core: implement checkbox, closes #2486
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
3bd0d3a39e30
core: implement checkbox, closes #2486
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
3bd0d3a39e30
core: implement checkbox, closes #2486
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
17 */ |
3bd0d3a39e30
core: implement checkbox, closes #2486
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
18 |
366
19782ea1cf4a
misc: start rebranding
David Demelier <markand@malikania.fr>
parents:
320
diff
changeset
|
19 #ifndef MLK_UI_CHECKBOX_H |
19782ea1cf4a
misc: start rebranding
David Demelier <markand@malikania.fr>
parents:
320
diff
changeset
|
20 #define MLK_UI_CHECKBOX_H |
115
3bd0d3a39e30
core: implement checkbox, closes #2486
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
21 |
606
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
22 /** |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
23 * \file mlk/ui/checkbox.h |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
24 * \brief GUI checkbox. |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
25 */ |
115
3bd0d3a39e30
core: implement checkbox, closes #2486
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
26 |
503
a55d0a29f466
ui: rework checkbox style
David Demelier <markand@malikania.fr>
parents:
495
diff
changeset
|
27 struct mlk_checkbox; |
606
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
28 struct mlk_checkbox_delegate; |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
29 struct mlk_style; |
503
a55d0a29f466
ui: rework checkbox style
David Demelier <markand@malikania.fr>
parents:
495
diff
changeset
|
30 |
606
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
31 union mlk_event; |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
32 |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
33 /** |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
34 * \struct mlk_checkbox |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
35 * \brief UI clickable checkbox. |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
36 */ |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
37 struct mlk_checkbox { |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
38 /** |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
39 * (read-write) |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
40 * |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
41 * Position in x. |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
42 */ |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
43 int x; |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
44 |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
45 /** |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
46 * (read-write) |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
47 * |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
48 * Position in y. |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
49 */ |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
50 int y; |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
51 |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
52 /** |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
53 * (read-write) |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
54 * |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
55 * Checkbox width. |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
56 */ |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
57 unsigned int w; |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
58 |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
59 /** |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
60 * (read-write) |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
61 * |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
62 * Checkbox height. |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
63 */ |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
64 unsigned int h; |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
65 |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
66 /** |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
67 * (read-write) |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
68 * |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
69 * Checkbox status, non-zero if activated. |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
70 */ |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
71 int checked; |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
72 |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
73 /** |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
74 * (read-write, borrowed) |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
75 * |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
76 * Checkbox delegate. |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
77 */ |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
78 struct mlk_checkbox_delegate *delegate; |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
79 |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
80 /** |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
81 * (read-write, borrowed) |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
82 * |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
83 * Checkbox style. |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
84 */ |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
85 struct mlk_style *style; |
507
d49a05e7a5b5
ui: separate delegate/style
David Demelier <markand@malikania.fr>
parents:
503
diff
changeset
|
86 }; |
d49a05e7a5b5
ui: separate delegate/style
David Demelier <markand@malikania.fr>
parents:
503
diff
changeset
|
87 |
606
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
88 /** |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
89 * \struct mlk_checkbox_delegate |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
90 * \brief Checkbox delegate. |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
91 */ |
507
d49a05e7a5b5
ui: separate delegate/style
David Demelier <markand@malikania.fr>
parents:
503
diff
changeset
|
92 struct mlk_checkbox_delegate { |
606
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
93 /* |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
94 * (read-write, borrowed, optional) |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
95 * |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
96 * Arbitrary user data. |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
97 */ |
507
d49a05e7a5b5
ui: separate delegate/style
David Demelier <markand@malikania.fr>
parents:
503
diff
changeset
|
98 void *data; |
606
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
99 |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
100 /** |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
101 * (read-write, optional) |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
102 * |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
103 * Handle an event. |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
104 * |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
105 * \param self this delegate |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
106 * \param cb the checkbox |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
107 * \param ev the event |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
108 * \return the current checkbox status (1 or 0) |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
109 */ |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
110 int (*handle)(struct mlk_checkbox_delegate *self, |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
111 struct mlk_checkbox *cb, |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
112 const union mlk_event *ev); |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
113 |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
114 /** |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
115 * (read-write, optional) |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
116 * |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
117 * Update the checkbox. |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
118 * |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
119 * \param self this delegate |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
120 * \param cb the checkbox to update |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
121 * \param ticks number of ticks since last frame |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
122 */ |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
123 void (*update)(struct mlk_checkbox_delegate *self, |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
124 struct mlk_checkbox *cb, |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
125 unsigned int ticks); |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
126 |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
127 /** |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
128 * (read-write, optional) |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
129 * |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
130 * Draw this checkbox. |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
131 * |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
132 * \param self this delegate |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
133 * \param cb the checkbox to update |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
134 */ |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
135 void (*draw)(struct mlk_checkbox_delegate *self, |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
136 const struct mlk_checkbox *cb); |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
137 |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
138 /** |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
139 * (read-write, optional) |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
140 * |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
141 * Cleanup this delegate associated with the checkbox. |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
142 * |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
143 * \param self this delegate |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
144 * \param cb the underlying checkbox |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
145 */ |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
146 void (*finish)(struct mlk_checkbox_delegate *self, |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
147 struct mlk_checkbox *cb); |
503
a55d0a29f466
ui: rework checkbox style
David Demelier <markand@malikania.fr>
parents:
495
diff
changeset
|
148 }; |
152
1008a796a9e7
ui: make UI widgets usable as actions
David Demelier <markand@malikania.fr>
parents:
151
diff
changeset
|
149 |
606
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
150 /** |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
151 * \brief Default stateless delegate for checkbox. |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
152 */ |
507
d49a05e7a5b5
ui: separate delegate/style
David Demelier <markand@malikania.fr>
parents:
503
diff
changeset
|
153 extern struct mlk_checkbox_delegate mlk_checkbox_delegate; |
503
a55d0a29f466
ui: rework checkbox style
David Demelier <markand@malikania.fr>
parents:
495
diff
changeset
|
154 |
517
6e8f6640e05b
misc: use extern C manually
David Demelier <markand@malikania.fr>
parents:
507
diff
changeset
|
155 #if defined(__cplusplus) |
6e8f6640e05b
misc: use extern C manually
David Demelier <markand@malikania.fr>
parents:
507
diff
changeset
|
156 extern "C" { |
6e8f6640e05b
misc: use extern C manually
David Demelier <markand@malikania.fr>
parents:
507
diff
changeset
|
157 #endif |
292
08ab73b32832
misc: add extern "C" {} blocks for C++ friends
David Demelier <markand@malikania.fr>
parents:
243
diff
changeset
|
158 |
606
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
159 /** |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
160 * Initialize the checkbox with default values. |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
161 * |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
162 * This is not required if you use designated initializers. |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
163 * |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
164 * \pre cb != NULL |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
165 * \param cb the checkbox to default initialize |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
166 * \param st style to use (or NULL to use a default) |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
167 * \param dt delegate to use (or NULL to use a default) |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
168 */ |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
169 void |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
170 mlk_checkbox_init(struct mlk_checkbox *cb, |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
171 struct mlk_checkbox_delegate *dt, |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
172 struct mlk_style *st); |
151
b19d076856d2
ui: cleanup theme module, closes #2498
David Demelier <markand@malikania.fr>
parents:
148
diff
changeset
|
173 |
606
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
174 /** |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
175 * Invoke ::mlk_checkbox_delegate::update. |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
176 */ |
405
0e39368e106c
ui: return int in checkbox_handle
David Demelier <markand@malikania.fr>
parents:
378
diff
changeset
|
177 int |
606
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
178 mlk_checkbox_handle(struct mlk_checkbox *cb, const union mlk_event *ev); |
115
3bd0d3a39e30
core: implement checkbox, closes #2486
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
179 |
606
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
180 /** |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
181 * Invoke ::mlk_checkbox_delegate::update. |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
182 */ |
115
3bd0d3a39e30
core: implement checkbox, closes #2486
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
183 void |
507
d49a05e7a5b5
ui: separate delegate/style
David Demelier <markand@malikania.fr>
parents:
503
diff
changeset
|
184 mlk_checkbox_update(struct mlk_checkbox *cb, unsigned int ticks); |
115
3bd0d3a39e30
core: implement checkbox, closes #2486
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
185 |
606
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
186 /** |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
187 * Invoke ::mlk_checkbox_delegate::draw. |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
188 */ |
503
a55d0a29f466
ui: rework checkbox style
David Demelier <markand@malikania.fr>
parents:
495
diff
changeset
|
189 void |
606
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
190 mlk_checkbox_draw(const struct mlk_checkbox *cb); |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
191 |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
192 /** |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
193 * Invoke ::mlk_checkbox_delegate::finish. |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
194 */ |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
195 void |
35e58271d820
ui: do the same with checkbox
David Demelier <markand@malikania.fr>
parents:
517
diff
changeset
|
196 mlk_checkbox_finish(struct mlk_checkbox *cb); |
503
a55d0a29f466
ui: rework checkbox style
David Demelier <markand@malikania.fr>
parents:
495
diff
changeset
|
197 |
517
6e8f6640e05b
misc: use extern C manually
David Demelier <markand@malikania.fr>
parents:
507
diff
changeset
|
198 #if defined(__cplusplus) |
6e8f6640e05b
misc: use extern C manually
David Demelier <markand@malikania.fr>
parents:
507
diff
changeset
|
199 } |
6e8f6640e05b
misc: use extern C manually
David Demelier <markand@malikania.fr>
parents:
507
diff
changeset
|
200 #endif |
292
08ab73b32832
misc: add extern "C" {} blocks for C++ friends
David Demelier <markand@malikania.fr>
parents:
243
diff
changeset
|
201 |
366
19782ea1cf4a
misc: start rebranding
David Demelier <markand@malikania.fr>
parents:
320
diff
changeset
|
202 #endif /* !MLK_UI_CHECKBOX_H */ |