|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
Marks an entity whose Selectable children are mutually exclusive, and remembers which one is selected. More...
#include <headers/guillaume/components/selection.hpp>


Public Member Functions | |
| SelectionGroup (void)=default | |
| Create a group with no selection that may stay empty. | |
| ~SelectionGroup (void)=default | |
| Default destructor for the SelectionGroup component. | |
| bool | hasSelection (void) const |
| Check whether the group names a selected child. | |
| ecs::Entity::Identifier | getSelected (void) const |
| Get the selected child. | |
| SelectionGroup & | setSelected (ecs::Entity::Identifier selected) |
| Record which child is selected. | |
| SelectionGroup & | clearSelection (void) |
| Record that no child is selected. | |
| bool | isEmptyAllowed (void) const |
| Check whether the group may have no selection. | |
| SelectionGroup & | setAllowEmpty (bool allowEmpty) |
| Choose whether the group may have no selection. | |
| Public Member Functions inherited from guillaume::ecs::Component | |
| bool | hasChanged (void) const |
| Tell whether a value of the component changed since the flags were last reset (the end of the previous frame). | |
| void | setHasChanged (bool hasChanged) |
| Raise or lower the changed flag. | |
| Component (void)=default | |
| Create a component that is not marked as changed. | |
| virtual | ~Component (void)=default |
| Virtual destructor, so components can be destroyed through the base class. | |
Marks an entity whose Selectable children are mutually exclusive, and remembers which one is selected.
systems::Selection (Event phase) reads the children from the entity's components::Hierarchy each frame: when several are selected it keeps the first one, and it writes the result here. The navigation bar and the navigation drawer use it for their destinations.
To change the selection, call systems::Selection::select() or select the child's Selectable; setSelected() here only records the result.
Watch out: when no child is selected but this component still names one, the system selects that child again. Deselecting the selected child alone is therefore undone on the next frame; call clearSelection() as well to empty the group.
Definition at line 131 of file selection.hpp.
| SelectionGroup & guillaume::components::SelectionGroup::clearSelection | ( | void | ) |
Record that no child is selected.
Same as setSelected(ecs::Entity::InvalidIdentifier).
Definition at line 77 of file selection.cpp.

| ecs::Entity::Identifier guillaume::components::SelectionGroup::getSelected | ( | void | ) | const |
Get the selected child.
Definition at line 61 of file selection.cpp.
| bool guillaume::components::SelectionGroup::hasSelection | ( | void | ) | const |
Check whether the group names a selected child.
Definition at line 56 of file selection.cpp.
| bool guillaume::components::SelectionGroup::isEmptyAllowed | ( | void | ) | const |
Check whether the group may have no selection.
Definition at line 82 of file selection.cpp.
| SelectionGroup & guillaume::components::SelectionGroup::setAllowEmpty | ( | bool | allowEmpty | ) |
Choose whether the group may have no selection.
When it may not, systems::Selection selects the first Selectable child whenever the group is empty. Marks the component changed when the flag differs.
| allowEmpty | False to always keep one child selected. |
Definition at line 87 of file selection.cpp.

| SelectionGroup & guillaume::components::SelectionGroup::setSelected | ( | ecs::Entity::Identifier | selected | ) |
Record which child is selected.
Marks the component changed when the identifier differs. It does not touch the Selectable of any child.
| selected | The selected child, or ecs::Entity::InvalidIdentifier for none. |
Definition at line 67 of file selection.cpp.

