guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
guillaume::systems::FloatingActionButtonMenu Class Reference

Opens and closes a floating action button menu (speed dial): a trigger button that reveals a column of action buttons above it. More...

#include <headers/guillaume/systems/floating_action_button_menu.hpp>

Inheritance diagram for guillaume::systems::FloatingActionButtonMenu:
Collaboration diagram for guillaume::systems::FloatingActionButtonMenu:

Public Member Functions

 FloatingActionButtonMenu (void)
 Create the system for the Layout phase, matching entities that have a components::FloatingActionButtonMenu.
 ~FloatingActionButtonMenu (void) override=default
 Default destructor.
void update (const ecs::Entity::Identifier &entityIdentifier) override
 Frame entry point: call apply on one menu.
Public Member Functions inherited from guillaume::ecs::SystemFiller< components::FloatingActionButtonMenu >
 SystemFiller (Phase phase)
 Create the system and set its signature from ComponentTypes.
virtual ~SystemFiller (void)=default
 Virtual destructor.
Public Member Functions inherited from guillaume::ecs::System
 System (Phase phase)
 Create a system that runs in a given phase, with an empty signature.
virtual ~System (void)=default
 Virtual destructor.
Phase getPhase (void) const noexcept
 Get the phase of the frame in which the system runs.
Entity::Signature getSignature (void) const noexcept
 Get the component types an entity must declare to be visited by this system.
void routine (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry, const ecs::EntityTreeTraveler &traveler)
 Run the system once over a scene: prepare(), update() on each matching entity, cleanup().
void bindComponentRegistry (ecs::ComponentRegistry &componentRegistry)
 Bind a component registry so update() can be called directly, without routine().
void unbindComponentRegistry (void)
 Drop the binding made by bindComponentRegistry().
virtual void prepare (void)
 Called once per pass, before the first update().
virtual void cleanup (void)
 Called once per pass, after the last update().

Static Public Member Functions

static void install (ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
 Make an entity behave as a floating action button menu.
static void apply (ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
 Bring the buttons in line with the open flag of the component, then lay out the column.
static void open (ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
 Open the menu: show its actions at once, then call the state-change callback with true.
static void close (ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
 Close the menu: hide its actions at once, then call the state-change callback with false.
static void toggle (ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
 Open the menu when it is closed, close it when it is open, and call the state-change callback with the new state.

Static Public Attributes

static constexpr const char * CloseGlyph = "close"

Additional Inherited Members

Protected Member Functions inherited from guillaume::ecs::System
template<InheritFromComponent... ComponentTypes>
void setSignature (void)
 Replace the signature by the one made of the given component types.
ecs::EntityRegistry & getEntityRegistry (void)
 Get the entity registry of the scene being processed.
const ecs::EntityRegistry & getEntityRegistry (void) const
 Get the entity registry of the scene being processed, read-only.
ecs::ComponentRegistry & getComponentRegistry (void)
 Get the component registry of the scene being processed.
const ecs::ComponentRegistry & getComponentRegistry (void) const
 Get the component registry of the scene being processed, read-only.
template<InheritFromComponent ComponentType>
bool hasComponent (const ecs::Entity::Identifier &entityIdentifier) const
 Tell whether an entity has a component, in the bound registry.
template<InheritFromComponent ComponentType>
ComponentType & getComponent (const ecs::Entity::Identifier &entityIdentifier)
 Get a component of an entity from the bound registry, to read or modify it.
template<InheritFromComponent ComponentType>
const ComponentType & getComponent (const ecs::Entity::Identifier &entityIdentifier) const
 Get a component of an entity from the bound registry, read-only.
template<InheritFromComponent ComponentType>
bool requireComponent (const ecs::Entity::Identifier &entityIdentifier)
 Tell whether an entity has a component, and log a warning naming the entity and the component when it does not.

Detailed Description

Opens and closes a floating action button menu (speed dial): a trigger button that reveals a column of action buttons above it.

The menu entity is a vertical layout container. Its children are buttons built by the widget class (entities::FloatingActionButtonMenu) and recorded by identifier in components::FloatingActionButtonMenu: one trigger and one button per action.

// Close the menu from code, for example after an action ran.
static void close(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Close the menu: hide its actions at once, then call the state-change callback with false.

The list of children in the menu's components::Layout is overwritten each frame: add or remove actions through the component (and call install again), not through the layout.

See also
guillaume::components::FloatingActionButtonMenu, guillaume::systems::FloatingActionButton, guillaume::systems::Layout

Definition at line 66 of file floating_action_button_menu.hpp.

Constructor & Destructor Documentation

◆ FloatingActionButtonMenu()

guillaume::systems::FloatingActionButtonMenu::FloatingActionButtonMenu ( void )

Create the system for the Layout phase, matching entities that have a components::FloatingActionButtonMenu.

Definition at line 51 of file floating_action_button_menu.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ apply()

void guillaume::systems::FloatingActionButtonMenu::apply ( ecs::ComponentRegistry & componentRegistry,
const ecs::Entity::Identifier & entityIdentifier )
static

Bring the buttons in line with the open flag of the component, then lay out the column.

Each action button is made visible and focusable when the menu is open, hidden and not focusable when it is closed, and restyled when its visibility changed. The trigger shows CloseGlyph while open and the configured icon otherwise, and reports its expanded state to accessibility. The layout children become the open actions followed by the trigger, and systems::Layout::apply places them at once.

The frame calls it through update; open, close and toggle call it on a change. Call it yourself after writing components::FloatingActionButtonMenu::setOpen directly, which changes the flag without calling the state-change callback.

Parameters
componentRegistryThe registry holding the components.
entityIdentifierThe menu entity.

Definition at line 147 of file floating_action_button_menu.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ close()

void guillaume::systems::FloatingActionButtonMenu::close ( ecs::ComponentRegistry & componentRegistry,
const ecs::Entity::Identifier & entityIdentifier )
static

Close the menu: hide its actions at once, then call the state-change callback with false.

Does nothing, and calls nothing, when the menu is already closed. Clicking an action does not close the menu by itself; call this from the action's handler when that is wanted.

Parameters
componentRegistryThe registry holding the components.
entityIdentifierThe menu entity.

Definition at line 129 of file floating_action_button_menu.cpp.

Here is the caller graph for this function:

◆ install()

void guillaume::systems::FloatingActionButtonMenu::install ( ecs::ComponentRegistry & componentRegistry,
const ecs::Entity::Identifier & entityIdentifier )
static

Make an entity behave as a floating action button menu.

Does three things:

  • configures the menu's components::Layout as a vertical column, packed at the end, centered across, with components::FloatingActionButtonMenu::Spacing between buttons and no padding;
  • makes a click on the trigger call toggle, and copies the accessibility label of the component onto the trigger;
  • gives each action button the onClick of the action at the same index.

Call it once the trigger and the action buttons exist and are recorded in the component, and again whenever the actions or their buttons change. A child identifier that is invalid or has no components::Button is skipped. It does not show or hide anything: apply does.

Parameters
componentRegistryThe registry holding the components. The trigger handler keeps its address, so it must outlive the menu.
entityIdentifierThe menu entity. It must have a components::FloatingActionButtonMenu and a components::Layout.

Definition at line 57 of file floating_action_button_menu.cpp.

Here is the call graph for this function:

◆ open()

void guillaume::systems::FloatingActionButtonMenu::open ( ecs::ComponentRegistry & componentRegistry,
const ecs::Entity::Identifier & entityIdentifier )
static

Open the menu: show its actions at once, then call the state-change callback with true.

Does nothing, and calls nothing, when the menu is already open.

Parameters
componentRegistryThe registry holding the components.
entityIdentifierThe menu entity.

Definition at line 122 of file floating_action_button_menu.cpp.

Here is the caller graph for this function:

◆ toggle()

void guillaume::systems::FloatingActionButtonMenu::toggle ( ecs::ComponentRegistry & componentRegistry,
const ecs::Entity::Identifier & entityIdentifier )
static

Open the menu when it is closed, close it when it is open, and call the state-change callback with the new state.

This is what a click on the trigger does.

Parameters
componentRegistryThe registry holding the components.
entityIdentifierThe menu entity.

Definition at line 136 of file floating_action_button_menu.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update()

void guillaume::systems::FloatingActionButtonMenu::update ( const ecs::Entity::Identifier & entityIdentifier)
overridevirtual

Frame entry point: call apply on one menu.

Parameters
entityIdentifierThe menu entity. An entity without a components::FloatingActionButtonMenu is logged and skipped.

Implements guillaume::ecs::System.

Definition at line 207 of file floating_action_button_menu.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ CloseGlyph

const char* guillaume::systems::FloatingActionButtonMenu::CloseGlyph = "close"
staticconstexpr

Name of the glyph the trigger shows while the menu is open, in place of the icon configured in the component.

Definition at line 72 of file floating_action_button_menu.hpp.


The documentation for this class was generated from the following files: