11
11
12
12
namespace cycfi ::elements
13
13
{
14
+ /* *
15
+ * \class
16
+ * sprite_button_styler
17
+ *
18
+ * \brief
19
+ * A class template that styles a button with a sprite.
20
+ *
21
+ * This class template inherits from a base button class and provides
22
+ * additional functionality to style the button using a sprite. The
23
+ * sprite can be used to represent different states of the button.
24
+ *
25
+ * \tparam Base The base button class to inherit from.
26
+ */
14
27
template <typename Base>
15
28
class sprite_button_styler : public Base
16
29
{
@@ -46,6 +59,20 @@ namespace cycfi::elements
46
59
// Inlines
47
60
// --------------------------------------------------------------------------
48
61
62
+ /* *
63
+ * \brief
64
+ * Draws the sprite button with the given context.
65
+ *
66
+ * This function overrides the draw function in the base class to
67
+ * provide specific drawing functionality for the sprite button. It
68
+ * determines the appropriate frame of the sprite to display based on
69
+ * the button's state (enabled/disabled, value, and highlight).
70
+ *
71
+ * \param ctx
72
+ * The context within which the element should be drawn. The context
73
+ * provides information about the view, canvas, and other properties
74
+ * that might be necessary for drawing the element.
75
+ */
49
76
template <typename Base>
50
77
inline void sprite_button_styler<Base>::draw(context const & ctx)
51
78
{
@@ -61,6 +88,30 @@ namespace cycfi::elements
61
88
}
62
89
}
63
90
91
+ /* *
92
+ * \brief
93
+ * Creates a momentary button with a sprite button styler.
94
+ *
95
+ * This function template creates a proxy object for a momentary button
96
+ * styled with a sprite. A momentary button is a button that only
97
+ * remains active while it is being pressed.
98
+ *
99
+ * \tparam Base
100
+ * The base type of the momentary button. `Base` should be a momentary
101
+ * button that adheres to ` MomentaryButton` concept with
102
+ * `basic_button` as the default type.
103
+ *
104
+ * \tparam Styler
105
+ * The type of the sprite styler. The sprite styler must adhere to the
106
+ * SpriteSubject concept,
107
+ *
108
+ * \param s
109
+ * The sprite styler to be used for the button.
110
+ *
111
+ * \return
112
+ * A proxy object that combines the sprite button styler with the
113
+ * momentary button.
114
+ */
64
115
template <
65
116
concepts::MomentaryButton Base
66
117
, concepts::SpriteSubject Styler
@@ -71,6 +122,30 @@ namespace cycfi::elements
71
122
return {std::forward<Styler>(s)};
72
123
}
73
124
125
+ /* *
126
+ * \brief
127
+ * Creates a toggle button with a sprite button styler.
128
+ *
129
+ * This function template creates a proxy object for a toggle button
130
+ * styled with a sprite. A toggle button is a button that remains
131
+ * active until it is pressed again.
132
+ *
133
+ * \tparam Base
134
+ * The base type of the latching button. `Base` should be a toggle
135
+ * button that adheres to ` ToggleButton` concept with
136
+ * `basic_toggle_button` as the default type.
137
+ *
138
+ * \tparam Styler
139
+ * The type of the sprite styler. The sprite styler must adhere to the
140
+ * SpriteSubject concept,
141
+ *
142
+ * \param s
143
+ * The sprite styler to be used for the button.
144
+ *
145
+ * \return
146
+ * A proxy object that combines the sprite button styler with the
147
+ * toggle button.
148
+ */
74
149
template <
75
150
concepts::ToggleButton Base
76
151
, concepts::SpriteSubject Styler
@@ -81,6 +156,31 @@ namespace cycfi::elements
81
156
return {std::forward<Styler>(s)};
82
157
}
83
158
159
+ /* *
160
+ * \brief
161
+ * Creates a latching button with a sprite button styler.
162
+ *
163
+ * This function template creates a proxy object for a latching button
164
+ * styled with a sprite. A latching button is a button that maintains
165
+ * its state after being clicked and holds this state indefinitely
166
+ * until it is reset programmatically.
167
+ *
168
+ * \tparam Base
169
+ * The base type of the latching button. `Base` should be a latching
170
+ * button that adheres to `LatchingButton` concept with
171
+ * `basic_latching_button` as the default type.
172
+ *
173
+ * \tparam Styler
174
+ * The type of the sprite styler. The sprite styler must adhere to the
175
+ * SpriteSubject concept,
176
+ *
177
+ * \param s
178
+ * The sprite styler to be used for the button.
179
+ *
180
+ * \return
181
+ * A proxy object that combines the sprite button styler with the
182
+ * latching button.
183
+ */
84
184
template <
85
185
concepts::LatchingButton Base
86
186
, concepts::SpriteSubject Styler
0 commit comments