Checkbox class new in Git master
#include <Magnum/Ui/Checkbox.h>
Checkbox widget.
Base classes
-
template<class UserInterface>class BasicWidget<UserInterface> new in Git master
- Templated abstract base for stateful widgets.
Constructors, destructors, conversion operators
-
Checkbox(Anchor anchor,
Containers::
StringView text, const TextProperties& textProperties, CheckboxStyle style = CheckboxStyle::Checkbox) explicit - Constructor.
-
Checkbox(Anchor anchor,
Containers::
StringView text, CheckboxStyle style = CheckboxStyle::Checkbox) explicit -
Checkbox(Anchor anchor,
const StorageQuery<bool>& query,
Containers::
StringView text, const TextProperties& textProperties, CheckboxStyle style = CheckboxStyle::Checkbox) explicit - Construct a checkbox with a data binding for the checked state.
-
Checkbox(Anchor anchor,
const StorageQuery<bool>& query,
Containers::
StringView text, CheckboxStyle style = CheckboxStyle::Checkbox) explicit -
Checkbox(NonOwnedT,
Anchor anchor,
const StorageQuery<bool>& query,
Containers::
StringView text, const TextProperties& textProperties, CheckboxStyle style = CheckboxStyle::Checkbox) explicit - Construct a non-owned checkbox with a data binding for the checked state.
-
Checkbox(NonOwnedT,
Anchor anchor,
const StorageQuery<bool>& query,
Containers::
StringView text, CheckboxStyle style = CheckboxStyle::Checkbox) explicit - Checkbox(NoCreateT) explicit
- Construct with no underlying node.
Public functions
- auto style() const -> CheckboxStyle
- Style.
- auto setStyle(CheckboxStyle style) -> Checkbox&
- Set style.
-
auto setText(Containers::
StringView text, const TextProperties& textProperties = {}) -> Checkbox& - Set label text.
- auto isChecked() const -> bool
- Whether the checkbox is checked.
- auto setChecked(bool checked) -> Checkbox&
- Check or uncheck the checkbox.
- auto toggleChecked() -> Checkbox&
- Toggle a checkbox.
- auto backgroundData() const -> DataHandle
- Background data.
- auto checkboxData() const -> DataHandle
- Checkbox data.
- auto textData() const -> DataHandle
- Text data.
- auto dataBindingData() const -> DataHandle
- Data binding data.
Function documentation
Magnum:: Ui:: Checkbox:: Checkbox(Anchor anchor,
Containers:: StringView text,
const TextProperties& textProperties,
CheckboxStyle style = CheckboxStyle::Checkbox) explicit
Constructor.
| Parameters | |
|---|---|
| anchor | Positioning anchor |
| text | Label text. Passing an empty string makes it just a checkbox with no label |
| textProperties | Text shaping and layouting properties |
| style | Checkbox style |
Creates an internal data storage instance to maintain the checked state. Use Checkbox(Anchor, const StorageQuery<bool>&, Containers::
Magnum:: Ui:: Checkbox:: Checkbox(Anchor anchor,
Containers:: StringView text,
CheckboxStyle style = CheckboxStyle::Checkbox) explicit
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Magnum:: Ui:: Checkbox:: Checkbox(Anchor anchor,
const StorageQuery<bool>& query,
Containers:: StringView text,
const TextProperties& textProperties,
CheckboxStyle style = CheckboxStyle::Checkbox) explicit
Construct a checkbox with a data binding for the checked state.
| Parameters | |
|---|---|
| anchor | Positioning anchor |
| query | DataLayer storage query |
| text | Label text. Passing an empty string makes it just a checkbox with no label |
| textProperties | Text shaping and layouting properties |
| style | Checkbox style |
If the query is mutable, it's expected to support both StorageOperation::
Magnum:: Ui:: Checkbox:: Checkbox(Anchor anchor,
const StorageQuery<bool>& query,
Containers:: StringView text,
CheckboxStyle style = CheckboxStyle::Checkbox) explicit
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Magnum:: Ui:: Checkbox:: Checkbox(NonOwnedT,
Anchor anchor,
const StorageQuery<bool>& query,
Containers:: StringView text,
const TextProperties& textProperties,
CheckboxStyle style = CheckboxStyle::Checkbox) explicit
Construct a non-owned checkbox with a data binding for the checked state.
| Parameters | |
|---|---|
| anchor | Positioning anchor |
| query | DataLayer storage query |
| text | Label text. Passing an empty string makes it just a checkbox with no label |
| textProperties | Text shaping and layouting properties |
| style | Checkbox style |
Like Checkbox(Anchor, const StorageQuery<bool>&, Containers::
Magnum:: Ui:: Checkbox:: Checkbox(NonOwnedT,
Anchor anchor,
const StorageQuery<bool>& query,
Containers:: StringView text,
CheckboxStyle style = CheckboxStyle::Checkbox) explicit
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Checkbox& Magnum:: Ui:: Checkbox:: setStyle(CheckboxStyle style)
Set style.
| Returns | Reference to self (for method chaining) |
|---|
Checkbox& Magnum:: Ui:: Checkbox:: setText(Containers:: StringView text,
const TextProperties& textProperties = {})
Set label text.
| Returns | Reference to self (for method chaining) |
|---|
Passing an empty text removes the label.
Checkbox& Magnum:: Ui:: Checkbox:: setChecked(bool checked)
Check or uncheck the checkbox.
| Returns | Reference to self (for method chaining) |
|---|
Note that whether the checkbox actually gets checked or unchecked depends on the underlying storage implementation — for example it may not be possible to uncheck all from a set of radio buttons. Use isChecked() to verify the checked state afterwards, if needed.
If the checkbox was created with an immutable data binding, this function does nothing.
Checkbox& Magnum:: Ui:: Checkbox:: toggleChecked()
Toggle a checkbox.
| Returns | Reference to self (for method chaining) |
|---|
Note that whether the checkbox actually gets checked or unchecked depends on the underlying storage implementation — for example it may not be possible to uncheck all from a set of radio buttons. Use isChecked() to verify the checked state afterwards, if needed.
If the checkbox was created with an immutable data binding, this function does nothing.
DataHandle Magnum:: Ui:: Checkbox:: backgroundData() const
Background data.
Exposed mainly for testing purposes, not meant to be modified directly.
DataHandle Magnum:: Ui:: Checkbox:: checkboxData() const
Checkbox data.
Exposed mainly for testing purposes, not meant to be modified directly.
DataHandle Magnum:: Ui:: Checkbox:: textData() const
Text data.
Exposed mainly for testing purposes, not meant to be modified directly.
DataHandle Magnum:: Ui:: Checkbox:: dataBindingData() const
Data binding data.
Exposed mainly for testing purposes, not meant to be modified directly.