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

Styles an app bar and lays out its navigation button, title and action buttons in a row. More...

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

Inheritance diagram for guillaume::systems::AppBar:
Collaboration diagram for guillaume::systems::AppBar:

Public Member Functions

 AppBar (void)
 Create the system in the Layout phase.
 ~AppBar (void) override=default
 Default destructor.
void update (const ecs::Entity::Identifier &entityIdentifier) override
 Run apply() on one app bar; called by the frame loop.
Public Member Functions inherited from guillaume::ecs::SystemFiller< components::AppBar >
 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 installTitle (ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
 Expose the title child to assistive technology as a header.
static void apply (ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
 Style one app bar and arrange its children.
static float height (components::AppBar::Variant variant)
 Get the fixed height of a variant.
static theme::TypeRole titleRole (components::AppBar::Variant variant)
 Get the typescale role the title of a variant is drawn with.
static bool needsNavigationButton (const ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
 Whether the navigation button child still has to be created.
static bool needsTitle (const ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
 Whether the title child still has to be created.
static bool needsActionButtons (const ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
 Whether the action button children have to be created again.

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 an app bar and lays out its navigation button, title and action buttons in a row.

Runs in the Layout phase on every entity that has a components::AppBar. It is registered after systems::Layout, so the children are already measured when it arranges them.

A system cannot create entities: entities::AppBar builds the children and records their identifiers in components::AppBar. The needs... functions tell it which children are still missing.

The bar needs components::Layout, Color and Elevation next to its components::AppBar: apply() throws ecs::EntityComponentNotFoundException when one is missing.

See also
components::AppBar, entities::AppBar, systems::Layout

Definition at line 58 of file app_bar.hpp.

Constructor & Destructor Documentation

◆ AppBar()

guillaume::systems::AppBar::AppBar ( void )

Create the system in the Layout phase.

Definition at line 108 of file app_bar.cpp.

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

Member Function Documentation

◆ apply()

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

Style one app bar and arrange its children.

This is what update() runs each frame. Call it directly after changing components::AppBar to see the result before the next frame, which is what the setters of entities::AppBar do, or to drive an app bar in a test without a frame loop.

The children are laid out in the order navigation button, title, action buttons, skipping the ones that do not exist. A center-aligned bar centers a lone title and otherwise spreads its children across the bar.

Parameters
componentRegistryThe registry holding the components.
entityIdentifierThe app bar entity.
Exceptions
ecs::EntityComponentNotFoundExceptionWhen the entity lacks components::AppBar, Layout, Color or Elevation.

Definition at line 196 of file app_bar.cpp.

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

◆ height()

float guillaume::systems::AppBar::height ( components::AppBar::Variant variant)
static

Get the fixed height of a variant.

Parameters
variantThe app bar variant.
Returns
64 (small, center-aligned), 112 (medium), 152 (large) or 80 (bottom), in dp.

Definition at line 132 of file app_bar.cpp.

Here is the caller graph for this function:

◆ installTitle()

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

Expose the title child to assistive technology as a header.

Adds a components::Accessibility to the title entity recorded in components::AppBar when it has none, sets its role to Header and its label to the title text, and makes it non-focusable. Call it once, right after the title child has been created and recorded. Does nothing when no title child is recorded.

Parameters
componentRegistryThe registry holding the components.
entityIdentifierThe app bar entity.

Definition at line 113 of file app_bar.cpp.

Here is the call graph for this function:

◆ needsActionButtons()

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

Whether the action button children have to be created again.

Parameters
componentRegistryThe registry holding the components.
entityIdentifierThe app bar entity.
Returns
True when the number of recorded action buttons differs from the number of actions. Only the counts are compared, not the content of the actions.

Definition at line 186 of file app_bar.cpp.

Here is the call graph for this function:

◆ needsNavigationButton()

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

Whether the navigation button child still has to be created.

Parameters
componentRegistryThe registry holding the components.
entityIdentifierThe app bar entity.
Returns
True when the navigation action has an icon and no navigation button is recorded in components::AppBar.

Definition at line 165 of file app_bar.cpp.

Here is the call graph for this function:

◆ needsTitle()

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

Whether the title child still has to be created.

Parameters
componentRegistryThe registry holding the components.
entityIdentifierThe app bar entity.
Returns
True when the title text is not empty and no title entity is recorded in components::AppBar.

Definition at line 176 of file app_bar.cpp.

Here is the call graph for this function:

◆ titleRole()

theme::TypeRole guillaume::systems::AppBar::titleRole ( components::AppBar::Variant variant)
static

Get the typescale role the title of a variant is drawn with.

Parameters
variantThe app bar variant.
Returns
TitleLarge (small, center-aligned, bottom), HeadlineSmall (medium) or HeadlineMedium (large).

Definition at line 150 of file app_bar.cpp.

◆ update()

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

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

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

Parameters
entityIdentifierThe app bar entity.

Implements guillaume::ecs::System.

Definition at line 257 of file app_bar.cpp.

Here is the call graph for this function:

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