|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
State of a floating action button menu (speed dial): a trigger button that expands into a column of action buttons above it. More...
#include <headers/guillaume/components/floating_action_button_menu.hpp>


Classes | |
| struct | Action |
| One entry of the menu: what its button shows and does. More... | |
Public Types | |
| using | StateChangeHandler = std::function<void(bool)> |
Public Member Functions | |
| FloatingActionButtonMenu (void)=default | |
| Create the state of a closed menu with no action. | |
| ~FloatingActionButtonMenu (void)=default | |
| Default destructor. | |
| const std::string & | getIconGlyphName (void) const noexcept |
| Get the icon the trigger shows while the menu is closed. | |
| FloatingActionButtonMenu & | setIconGlyphName (const std::string &name) |
| Set the icon the trigger shows while the menu is closed. | |
| const std::vector< Action > & | getActions (void) const noexcept |
| Get the actions of the menu. | |
| FloatingActionButtonMenu & | setActions (std::vector< Action > actions) |
| Replace the actions of the menu. | |
| const std::string & | getAccessibilityLabel (void) const noexcept |
| Get the accessibility label of the trigger button. | |
| FloatingActionButtonMenu & | setAccessibilityLabel (const std::string &label) |
| Set the accessibility label of the trigger button. | |
| bool | isOpen (void) const noexcept |
| Check whether the menu is open. | |
| FloatingActionButtonMenu & | setOpen (bool open) |
| Store whether the menu is open. | |
| const StateChangeHandler & | getOnStateChange (void) const noexcept |
| Get the callback run when the menu opens or closes. | |
| FloatingActionButtonMenu & | setOnStateChange (StateChangeHandler handler) |
| Set the callback run when the menu opens or closes. | |
| ecs::Entity::Identifier | getTrigger (void) const noexcept |
| Get the child entity of the trigger button. | |
| FloatingActionButtonMenu & | setTrigger (ecs::Entity::Identifier identifier) |
| Record which child entity is the trigger button. | |
| const std::vector< ecs::Entity::Identifier > & | getActionButtons (void) const noexcept |
| Get the child entities of the action buttons. | |
| FloatingActionButtonMenu & | setActionButtons (const std::vector< ecs::Entity::Identifier > &buttons) |
| Record which child entities are the action buttons. | |
| 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. | |
Static Public Attributes | |
| static constexpr float | Spacing = 16.0f |
| Gap between the buttons of the column, in dp. | |
State of a floating action button menu (speed dial): a trigger button that expands into a column of action buttons above it.
It holds the trigger's icon and accessibility label, the list of actions, whether the menu is open, and the identifiers of the button children.
Role in the frame:
setOpen() only stores the flag. To open or close the menu from code and have the state-change callback run, call systems::FloatingActionButtonMenu::setOpen(), open(), close() or toggle().
Definition at line 60 of file floating_action_button_menu.hpp.
| using guillaume::components::FloatingActionButtonMenu::StateChangeHandler = std::function<void(bool)> |
Called with the new open state (true when open) each time the menu opens or closes.
Definition at line 77 of file floating_action_button_menu.hpp.
|
noexcept |
Get the accessibility label of the trigger button.
Definition at line 60 of file floating_action_button_menu.cpp.
|
noexcept |
Get the child entities of the action buttons.
Definition at line 119 of file floating_action_button_menu.cpp.
|
noexcept |
Get the actions of the menu.
Definition at line 46 of file floating_action_button_menu.cpp.
|
noexcept |
Get the icon the trigger shows while the menu is closed.
Definition at line 30 of file floating_action_button_menu.cpp.
|
noexcept |
Get the callback run when the menu opens or closes.
Definition at line 90 of file floating_action_button_menu.cpp.
|
noexcept |
Get the child entity of the trigger button.
Definition at line 103 of file floating_action_button_menu.cpp.

|
noexcept |
Check whether the menu is open.
Definition at line 75 of file floating_action_button_menu.cpp.
| FloatingActionButtonMenu & guillaume::components::FloatingActionButtonMenu::setAccessibilityLabel | ( | const std::string & | label | ) |
Set the accessibility label of the trigger button.
systems::FloatingActionButtonMenu::install() copies it to the trigger's Accessibility. Marks the component changed when the label differs.
| label | The text announced for the trigger. |
Definition at line 65 of file floating_action_button_menu.cpp.

| FloatingActionButtonMenu & guillaume::components::FloatingActionButtonMenu::setActionButtons | ( | const std::vector< ecs::Entity::Identifier > & | buttons | ) |
Record which child entities are the action buttons.
Marks the component changed when the list differs.
| buttons | Their identifiers, in action order. |
Definition at line 124 of file floating_action_button_menu.cpp.

| FloatingActionButtonMenu & guillaume::components::FloatingActionButtonMenu::setActions | ( | std::vector< Action > | actions | ) |
Replace the actions of the menu.
The widget class creates one button child per action from this list. Does not mark the component changed (actions carry callbacks, which cannot be compared).
| actions | The new actions. |
Definition at line 52 of file floating_action_button_menu.cpp.
| FloatingActionButtonMenu & guillaume::components::FloatingActionButtonMenu::setIconGlyphName | ( | const std::string & | name | ) |
Set the icon the trigger shows while the menu is closed.
While open, the system shows systems::FloatingActionButtonMenu::CloseGlyph instead. Marks the component changed when the name differs.
| name | The glyph name in the icon font. |
Definition at line 36 of file floating_action_button_menu.cpp.

| FloatingActionButtonMenu & guillaume::components::FloatingActionButtonMenu::setOnStateChange | ( | StateChangeHandler | handler | ) |
Set the callback run when the menu opens or closes.
Does not mark the component changed.
| handler | The callback; it receives true when the menu just opened and false when it just closed. |
Definition at line 96 of file floating_action_button_menu.cpp.
| FloatingActionButtonMenu & guillaume::components::FloatingActionButtonMenu::setOpen | ( | bool | open | ) |
Store whether the menu is open.
Marks the component changed when the state differs. It does not run the state-change callback; use systems::FloatingActionButtonMenu::setOpen() for that.
| open | True to show the action buttons. |
Definition at line 80 of file floating_action_button_menu.cpp.

| FloatingActionButtonMenu & guillaume::components::FloatingActionButtonMenu::setTrigger | ( | ecs::Entity::Identifier | identifier | ) |
Record which child entity is the trigger button.
Marks the component changed when the identifier differs.
| identifier | The trigger button child. |
Definition at line 109 of file floating_action_button_menu.cpp.

|
staticconstexpr |
Gap between the buttons of the column, in dp.
Definition at line 80 of file floating_action_button_menu.hpp.