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

Styles one destination of a navigation drawer and places its icon, label and trailing text. More...

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

Inheritance diagram for guillaume::systems::NavigationDrawerDestination:
Collaboration diagram for guillaume::systems::NavigationDrawerDestination:

Public Member Functions

 NavigationDrawerDestination (void)
 Create the system in the Layout phase.
 ~NavigationDrawerDestination (void) override=default
 Default destructor.
void update (const ecs::Entity::Identifier &entityIdentifier) override
 Run apply() on one destination; called by the frame loop.
Public Member Functions inherited from guillaume::ecs::SystemFiller< components::NavigationDrawerDestination >
 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 a destination pressable.
static void apply (ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
 Style one destination from its selection, enabled and interaction state, then arrange it.
static void arrange (ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
 Place the children of one destination without restyling it.
static void press (ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
 Activate the destination as a press on it would.
static void setDisabled (ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier, bool disabled)
 Enable or disable the destination and restyle it.
static bool isDisabled (const ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
 Whether the destination ignores input.
static bool isSelected (const ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
 Whether the destination is the selected one.

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

Styles one destination of a navigation drawer and places its icon, label and trailing text.

Runs in the Layout phase on every entity that has a components::NavigationDrawerDestination. It is registered before systems::NavigationDrawer: the destination is styled on its own first, then the drawer that owns it gives it its final size and position.

A destination has two shapes, chosen by the collapsed flag of its component:

  • regular: a row holding the lead group (icon and label) and, pushed to the far edge, the trailing text. The whole row is the active pill;
  • collapsed (the drawer shown as a rail): the lead group, which is then the active pill around the icon, stacked above the label.

This system does not change the selection: a press only calls the press callback of the component. systems::NavigationDrawer::install replaces that callback with its own, which selects the destination.

See also
components::NavigationDrawerDestination, systems::NavigationDrawer, entities::NavigationDrawerDestination

Definition at line 67 of file navigation_drawer_destination.hpp.

Constructor & Destructor Documentation

◆ NavigationDrawerDestination()

guillaume::systems::NavigationDrawerDestination::NavigationDrawerDestination ( void )

Create the system in the Layout phase.

Definition at line 85 of file navigation_drawer_destination.cpp.

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

Member Function Documentation

◆ apply()

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

Style one destination from its selection, enabled and interaction state, then arrange it.

This is what update() runs each frame. systems::NavigationDrawer calls it after sizing the destination, and the interaction components call it when the pointer enters, leaves or presses the destination.

The active pill is filled only for a selected, enabled destination, and carries the hover or press state layer. A disabled destination draws its icon and texts with the disabled content color. The disabled flag of the component is copied to the enabled flag of components::StyleState on every call, so set it with setDisabled() rather than on the style state. Ends with arrange().

Parameters
componentRegistryThe registry holding the components.
entityIdentifierThe destination entity.
Exceptions
ecs::EntityComponentNotFoundExceptionWhen the entity lacks components::NavigationDrawerDestination, Layout, Borders or Color.

Definition at line 162 of file navigation_drawer_destination.cpp.

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

◆ arrange()

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

Place the children of one destination without restyling it.

The layout children are, in order, the lead group, the label when the destination is collapsed (otherwise the label is inside the lead group) and the trailing text, skipping the ones that do not exist. The content of the lead group is then placed inside it. systems::NavigationDrawer calls it after moving the destination, so the children follow.

Parameters
componentRegistryThe registry holding the components.
entityIdentifierThe destination entity.

Definition at line 245 of file navigation_drawer_destination.cpp.

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

◆ install()

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

Make a destination pressable.

Adds the interaction components (hover and press state, focus, the Button accessibility role) and wires an activation to press() and a hover or press change to apply(). Call it once, after the entity has its components::NavigationDrawerDestination, Layout, Transform, Bound, Color, Borders and Selectable.

Parameters
componentRegistryThe registry holding the components. It is captured by the handlers and must outlive the entity.
entityIdentifierThe destination entity.

Definition at line 91 of file navigation_drawer_destination.cpp.

Here is the call graph for this function:

◆ isDisabled()

bool guillaume::systems::NavigationDrawerDestination::isDisabled ( const ecs::ComponentRegistry & componentRegistry,
const ecs::Entity::Identifier & entityIdentifier )
static

Whether the destination ignores input.

Parameters
componentRegistryThe registry holding the components.
entityIdentifierThe destination entity.
Returns
True when the disabled flag of components::NavigationDrawerDestination is set or the entity itself has been disabled.

Definition at line 120 of file navigation_drawer_destination.cpp.

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

◆ isSelected()

bool guillaume::systems::NavigationDrawerDestination::isSelected ( const ecs::ComponentRegistry & componentRegistry,
const ecs::Entity::Identifier & entityIdentifier )
static

Whether the destination is the selected one.

Parameters
componentRegistryThe registry holding the components.
entityIdentifierThe destination entity. May be ecs::Entity::InvalidIdentifier.
Returns
True when the entity has a components::Selectable that is selected; false when it has none.

Definition at line 109 of file navigation_drawer_destination.cpp.

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

◆ press()

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

Activate the destination as a press on it would.

Calls the press callback of components::NavigationDrawerDestination when there is one. Does nothing when the destination is disabled. The selection is not changed here; see the class description.

Parameters
componentRegistryThe registry holding the components.
entityIdentifierThe destination entity.

Definition at line 142 of file navigation_drawer_destination.cpp.

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

◆ setDisabled()

void guillaume::systems::NavigationDrawerDestination::setDisabled ( ecs::ComponentRegistry & componentRegistry,
const ecs::Entity::Identifier & entityIdentifier,
bool disabled )
static

Enable or disable the destination and restyle it.

Parameters
componentRegistryThe registry holding the components.
entityIdentifierThe destination entity.
disabledTrue to make the destination ignore presses and draw it dimmed, false to enable it.

Definition at line 131 of file navigation_drawer_destination.cpp.

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

◆ update()

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

Run apply() on one destination; called by the frame loop.

Logs a warning and does nothing when the entity has no components::NavigationDrawerDestination.

Parameters
entityIdentifierThe destination entity.

Implements guillaume::ecs::System.

Definition at line 279 of file navigation_drawer_destination.cpp.

Here is the call graph for this function:

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