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

Styles one destination of a navigation bar (an icon in a pill with a label under it and an optional badge) and places those children. More...

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

Inheritance diagram for guillaume::systems::NavigationBarDestination:
Collaboration diagram for guillaume::systems::NavigationBarDestination:

Public Member Functions

 NavigationBarDestination (void)
 Create the system in the Layout phase.
 ~NavigationBarDestination (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::NavigationBarDestination >
 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 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 setBadge (ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier, const std::string &badge)
 Set the badge label and restyle the destination.
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 bar (an icon in a pill with a label under it and an optional badge) and places those children.

Runs in the Layout phase on every entity that has a components::NavigationBarDestination. It is registered before systems::NavigationBar: the destination is styled on its own first, then the bar that owns it gives it its final size and position and calls apply() and arrange() again.

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

See also
components::NavigationBarDestination, systems::NavigationBar, entities::NavigationBarDestination

Definition at line 63 of file navigation_bar_destination.hpp.

Constructor & Destructor Documentation

◆ NavigationBarDestination()

guillaume::systems::NavigationBarDestination::NavigationBarDestination ( void )

Create the system in the Layout phase.

Definition at line 116 of file navigation_bar_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::NavigationBarDestination::apply ( ecs::ComponentRegistry & componentRegistry,
const ecs::Entity::Identifier & entityIdentifier )
static

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

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

A selected destination has a filled indicator pill and shows its focused icon when it has one. The hover or press state layer is drawn on the pill. A label that is not shown is painted transparent and keeps its place in the column. The badge child, when it exists, shows the badge label, or a dot when the label is empty. Ends with arrange().

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

Definition at line 178 of file navigation_bar_destination.cpp.

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

◆ arrange()

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

Place the children of one destination without restyling it.

Stacks the indicator and the label in a column, places the icon inside the indicator, and puts the badge at the offset (components::NavigationBarDestination::BadgeOffsetX, BadgeOffsetY) from the origin of the indicator, over the corner of the icon. systems::NavigationBar 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_bar_destination.cpp.

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

◆ install()

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

Make a destination pressable.

Adds the interaction components (hover and press state, focus, the Tab 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::NavigationBarDestination, 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 122 of file navigation_bar_destination.cpp.

Here is the call graph for this function:

◆ isSelected()

bool guillaume::systems::NavigationBarDestination::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 139 of file navigation_bar_destination.cpp.

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

◆ press()

void guillaume::systems::NavigationBarDestination::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::NavigationBarDestination when there is one. The selection is not changed here; see the class description.

Parameters
componentRegistryThe registry holding the components.
entityIdentifierThe destination entity.

Definition at line 150 of file navigation_bar_destination.cpp.

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

◆ setBadge()

void guillaume::systems::NavigationBarDestination::setBadge ( ecs::ComponentRegistry & componentRegistry,
const ecs::Entity::Identifier & entityIdentifier,
const std::string & badge )
static

Set the badge label and restyle the destination.

Only the content of an existing badge child changes: this does not create or remove the badge entity.

Parameters
componentRegistryThe registry holding the components.
entityIdentifierThe destination entity.
badgeThe text shown in the badge, such as a count. An empty string shows a dot.

Definition at line 166 of file navigation_bar_destination.cpp.

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

◆ update()

void guillaume::systems::NavigationBarDestination::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::NavigationBarDestination.

Parameters
entityIdentifierThe destination entity.

Implements guillaume::ecs::System.

Definition at line 287 of file navigation_bar_destination.cpp.

Here is the call graph for this function:

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