A single toggleable checkbox widget. More...
Public Member Functions | |
| Checkbox () | |
| Object-initializer constructor; all properties default. | |
| Checkbox (string label="", bool isChecked=false, char checkedChar='✓', char uncheckedChar=' ', Style? style=null) | |
| Positional constructor for inline usage. | |
| void | OnKeyEvent (KeyMsg key, Action< IMsg > dispatch) |
| Toggle the checkbox state when Space or Enter is pressed. | |
| void | Render (IRenderContext ctx) |
Renders the checkbox as [✓] Label or [ ] Label. | |
Properties | |
| char | CheckedChar = '✓' [get] |
Character rendered inside the brackets when checked. Default '✓'. | |
| bool | HasFocus [get, set] |
| True when this widget holds keyboard focus. | |
| SizeConstraint | Height = SizeConstraint.Fixed(1) [get] |
| Height constraint used by the layout engine. | |
| bool | IsChecked [get] |
| Whether the checkbox is currently checked. | |
| string | Label = "" [get] |
| Text label displayed after the checkbox indicator. | |
| Style | Style = Style.Default [get] |
| Visual style for the widget. Inherits theme base style when unset. | |
| char | UncheckedChar = ' ' [get] |
Character rendered inside the brackets when unchecked. Default ' '. | |
| SizeConstraint | Width = SizeConstraint.Flex(1) [get] |
| Width constraint used by the layout engine. | |
A single toggleable checkbox widget.
Renders as [✓] Label or [ ] Label. Dispatches CheckboxToggledMsg when the user presses Space or Enter.
| ConsoleForge.Widgets.Checkbox.Checkbox | ( | string | label = "", |
| bool | isChecked = false, | ||
| char | checkedChar = '✓', | ||
| char | uncheckedChar = ' ', | ||
| Style? | style = null ) |
Positional constructor for inline usage.
| label | Text displayed next to the checkbox. |
| isChecked | Initial checked state. |
| checkedChar | Indicator character when checked. |
| uncheckedChar | Indicator character when unchecked. |
| style | Optional visual style override. |
| void ConsoleForge.Widgets.Checkbox.Render | ( | IRenderContext | ctx | ) |
Renders the checkbox as [✓] Label or [ ] Label.
The indicator brackets and label are styled together. When focused, the active theme's Theme.FocusedStyle is blended in.
Implements ConsoleForge.Layout.IWidget.