Skip to content

Commit bf091fa

Browse files
committed
- Button doc update
- Use unordered list for Semantics
1 parent d5e8ed3 commit bf091fa

14 files changed

+982
-359
lines changed

docs/modules/ROOT/pages/elements/button_stylers.adoc

+673-110
Large diffs are not rendered by default.

docs/modules/ROOT/pages/elements/buttons.adoc

+122-62
Original file line numberDiff line numberDiff line change
@@ -59,35 +59,71 @@ namespace concepts
5959
`TBase`:: Type that conforms to the ToggleButton concept.
6060
`LBase`:: Type that conforms to the LatchingButton concept.
6161

62+
6263
=== Expressions
6364

64-
[,c++]
65+
[cols="2,3", options="header"]
66+
|===
67+
| Expression | Semantics
68+
69+
a|
70+
[source,c++]
6571
----
66-
// Basic default buttons
6772
momentary_button(styler);
73+
----
74+
a|
75+
* Creates a momentary button with the given styler element.
76+
77+
a|
78+
[source,c++]
79+
----
6880
toggle_button(styler);
69-
latching_button(styler);
81+
----
82+
a|
83+
* Creates a toggle button with the given styler element.
84+
85+
a|
86+
[source,c++]
87+
----
88+
latching_button(styler)
89+
----
90+
a|
91+
* Creates a latching button with the given styler element.
7092

71-
// Custom buttons
72-
momentary_button<MBase>(styler);
73-
toggle_button<TBase>(styler);
74-
latching_button<LBase>(styler);
93+
a|
94+
[source,c++]
7595
----
96+
momentary_button<MBase>(
97+
styler
98+
)
99+
----
100+
a|
101+
* Creates a momentary button with the given styler element.
102+
* `MBase` is the base type that must conform to the `MomentaryButton`
103+
concept.
76104

77-
=== Semantics
105+
a|
106+
[source,c++]
107+
----
108+
toggle_button<TBase>(
109+
styler
110+
)
111+
----
112+
a|
113+
* Creates a toggle button with the given styler element.
114+
* `TBase` is the base type that must conform to the `ToggleButton` concept.
78115

79-
. `momentary_button`
80-
is a function that creates a momentary button with the given styler
81-
element. `MBase`, if provided, is the base type that must conform to
82-
the `MomentaryButton` concept.
83-
. `toggle_button`
84-
is a function that creates a toggle button with the given styler
85-
element. `TBase`, if provided, is the the base type that must conform
86-
to the `ToggleButton` concept.
87-
. `latching_button`
88-
is a function that creates a latching button with the given styler
89-
element. `LBase`, if provided, is the the base type that must conform
90-
to the `LatchingButton` concept.
116+
a|
117+
[source,c++]
118+
----
119+
latching_button<LBase>(
120+
styler
121+
)
122+
----
123+
a|
124+
* Creates a latching button with the given styler element.
125+
* `LBase` is the base type that must conform to the `LatchingButton` concept.
126+
|===
91127

92128
The provided base types `MBase`, `TBase`, and `LBase` offer the flexibility
93129
to use custom button behavior, provided they adhere to their respective
@@ -103,43 +139,48 @@ button is clicked.
103139
`btn`:: A Button instance.
104140
`f` :: A callback function with the signature `void(bool state)`.
105141

106-
=== Expression
142+
=== Expressions
107143

108-
[,c++]
144+
[cols="2,3", options="header"]
145+
|===
146+
| Expression | Semantics
147+
148+
a|
149+
[source,c++]
109150
----
110151
btn.on_click = f;
111152
----
153+
a|
154+
* Assigns a callable function, `f`, to the button's `on_click` event.
155+
* The `on_click` callback is called at the trailing edge of the click, just
156+
before release.
157+
* Momentary and latching buttons will always have a state of `true` when
158+
its `on_click` callback is called.
159+
* Toggle buttons will will have a state that alternates between `true` and
160+
`false` with each click.
161+
|===
112162

113-
=== Semantics
114-
115-
The type of the `on_click` callable object is:
163+
The client provides a callback function, typically a c++ lambda, that will be
164+
called when the button is clicked. The type of the `on_click` callable object
165+
is:
116166

117-
[,c++]
167+
[source,c++]
118168
----
119-
std::function<void(bool state))
169+
std::function<void(bool state)>
120170
----
121171

122-
The client provides a callback function, typically a c++ lambda, that will be
123-
called when the button is clicked. The `state` argument indicates whether the
124-
button is ON (`true`) or OFF (`false`).
125-
126-
. The `on_click` callback is called at the trailing edge of the click, just
127-
before release.
128-
129-
. Momentary and latching buttons will always have a state of `true` when
130-
its `on_click` callback is called.
131-
132-
. Toggle buttons will will have a state that alternates between `true` and
133-
`false` with each click.
172+
The `state` argument indicates whether the button is ON (`true`) or OFF
173+
(`false`).
134174

135175
=== Example
136176

137177
[,c++]
138178
----
139-
btn.on_click = [](bool state)
140-
{
141-
std::cout << "Button clicked: " << state << std::endl;
142-
};
179+
btn.on_click =
180+
[](bool state)
181+
{
182+
std::cout << "Button clicked: " << state << std::endl;
183+
};
143184
----
144185

145186
== Enable/Disable
@@ -153,20 +194,29 @@ differently to indicate that it is disabled.
153194
`btn` :: A Button instance.
154195
`state` :: A boolean value indicating whether the button is enabled or disabled.
155196

156-
=== Expression
197+
=== Expressions
157198

158-
[,c++]
199+
[cols="2,3", options="header"]
200+
|===
201+
| Expression | Semantics
202+
203+
a|
204+
[source,c++]
159205
----
160-
btn.enable(state) <1>
161-
btn.is_enabled() <2>
206+
btn.enable(state)
162207
----
163-
164-
=== Semantics
165-
166-
<1> Pass `true` to the `state` argument to enable the button, or
167-
`false` to disable it. When disabled, the button will not respond
168-
to clicks.
169-
<2> Returns `true` if the button is enabled, and `false` otherwise.
208+
a|
209+
* Sets the button's enabled state. Pass `true` to the `state` argument to
210+
enable the button, or `false` to disable it.
211+
* When disabled, the button will not respond to clicks.
212+
a|
213+
[source,c++]
214+
----
215+
btn.is_enabled()
216+
----
217+
a|
218+
* Returns `true` if the button is enabled, `false` otherwise.
219+
|===
170220

171221
== Value
172222

@@ -183,18 +233,28 @@ functions, `value()` and `value(val)`.
183233
`btn` :: A Button instance.
184234
`val` :: A boolean value.
185235

186-
=== Expression
236+
=== Expressions
237+
238+
[cols="2,3", options="header"]
239+
|===
240+
| Expression | Semantics
187241

188-
[,c++]
242+
a|
243+
[source,c++]
189244
----
190-
btn.value(val) <1>
191-
btn.vauel() <2>
245+
btn.value(val)
192246
----
247+
a|
248+
* Sets the value of the button to `val`.
193249

194-
=== Semantics
195-
196-
<1> Sets the value of the button to `val`.
197-
<2> Returns the current value of the button.
250+
a|
251+
[source,c++]
252+
----
253+
btn.value()
254+
----
255+
a|
256+
* Returns the current value of the button.
257+
|===
198258

199259
== Button Styler
200260

0 commit comments

Comments
 (0)