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

Configures a NavigationBar, creates it and registers it in an entity registry. More...

#include <headers/guillaume/entities/navigation_bar.hpp>

Inheritance diagram for guillaume::entities::NavigationBar::Builder:
Collaboration diagram for guillaume::entities::NavigationBar::Builder:

Public Member Functions

 Builder (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Create a builder set to the defaults of reset().
std::shared_ptr< NavigationBar > buildEntity (void) override
 Build a navigation bar and its destinations from the current configuration, without registering it or setting its parent.
void reset (void) override
 Restore the defaults.
Builder & withPose (const utility::graphic::PoseF &pose)
 Set where the bar is placed.
Builder & withVariant (Variant variant)
 Set the variant.
Builder & addDestination (const std::string &iconGlyph, const std::string &label, const std::string &focusedIconGlyph="", const std::string &badge="")
 Append a destination after the ones already added.
Builder & withOnIndexChange (std::function< void(std::size_t)> onIndexChange)
 Set the handler called when the user selects another destination (Paper onIndexChange).
std::shared_ptr< NavigationBar > makeNavigationBar (std::shared_ptr< ecs::Entity > parent, Variant variant, const std::vector< std::pair< std::string, std::string > > &destinations)
 Build a navigation bar, register it under parent and reset the builder.
Public Member Functions inherited from guillaume::entities::EntityBuilderBase< NavigationBar >
 EntityBuilderBase (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Construct a builder bound to two registries.
 ~EntityBuilderBase (void) override=default
 Default destructor.
std::shared_ptr< NavigationBar > registerEntity (std::shared_ptr< ecs::Entity > parent)
 Build the widget, attach it to its parent, hand it to the entity registry, then reset the builder to its defaults.
Public Member Functions inherited from guillaume::ecs::EntityBuilder
 EntityBuilder (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Create a builder working on a pair of registries, normally those of one scene.
virtual ~EntityBuilder (void)=default
 Virtual destructor.

Additional Inherited Members

Protected Member Functions inherited from guillaume::ecs::EntityBuilder
ComponentRegistry & getComponentRegistry (void)
 Get the registry in which the builder creates components.
EntityRegistry & getEntityRegistry (void)
 Get the registry in which the builder registers the entities it creates.

Detailed Description

Configures a NavigationBar, creates it and registers it in an entity registry.

Definition at line 111 of file navigation_bar.hpp.

Constructor & Destructor Documentation

◆ Builder()

guillaume::entities::NavigationBar::Builder::Builder ( ecs::ComponentRegistry & componentRegistry,
ecs::EntityRegistry & entityRegistry )

Create a builder set to the defaults of reset().

Parameters
componentRegistryThe registry that stores the components of the bars built.
entityRegistryThe registry the bars are added to.

Definition at line 89 of file navigation_bar.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ addDestination()

NavigationBar::Builder & guillaume::entities::NavigationBar::Builder::addDestination ( const std::string & iconGlyph,
const std::string & label,
const std::string & focusedIconGlyph = "",
const std::string & badge = "" )

Append a destination after the ones already added.

Parameters
iconGlyphThe glyph name of the icon, such as "home".
labelThe text shown under the icon.
focusedIconGlyphThe glyph name of the icon shown while the destination is selected; empty to keep iconGlyph.
badgeThe badge label; empty for no badge.
Returns
This builder, for chaining.

Definition at line 136 of file navigation_bar.cpp.

◆ buildEntity()

std::shared_ptr< NavigationBar > guillaume::entities::NavigationBar::Builder::buildEntity ( void )
overridevirtual

Build a navigation bar and its destinations from the current configuration, without registering it or setting its parent.

Returns
The new navigation bar.

Implements guillaume::entities::EntityBuilderBase< NavigationBar >.

Definition at line 96 of file navigation_bar.cpp.

Here is the call graph for this function:

◆ makeNavigationBar()

std::shared_ptr< NavigationBar > guillaume::entities::NavigationBar::Builder::makeNavigationBar ( std::shared_ptr< ecs::Entity > parent,
Variant variant,
const std::vector< std::pair< std::string, std::string > > & destinations )

Build a navigation bar, register it under parent and reset the builder.

The destinations given here come after the ones already added with addDestination().

Parameters
parentThe entity the bar becomes a child of, or nullptr for a root entity.
variantThe variant of the bar.
destinationsThe (icon glyph name, label) pair of each destination to append, in display order.
Returns
The new navigation bar.

Definition at line 153 of file navigation_bar.cpp.

Here is the call graph for this function:

◆ reset()

void guillaume::entities::NavigationBar::Builder::reset ( void )
overridevirtual

Restore the defaults.

Defaults: WithLabels variant, no destination, no index-change handler, default pose, 360 dp wide, 80 dp high (components::NavigationBar::Height), 8 dp of padding.

Implements guillaume::ecs::EntityBuilder.

Definition at line 104 of file navigation_bar.cpp.

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

◆ withOnIndexChange()

NavigationBar::Builder & guillaume::entities::NavigationBar::Builder::withOnIndexChange ( std::function< void(std::size_t)> onIndexChange)

Set the handler called when the user selects another destination (Paper onIndexChange).

Parameters
onIndexChangeCalled with the index of the newly selected destination. Not called by select(). Default: none.
Returns
This builder, for chaining.

Definition at line 146 of file navigation_bar.cpp.

◆ withPose()

NavigationBar::Builder & guillaume::entities::NavigationBar::Builder::withPose ( const utility::graphic::PoseF & pose)

Set where the bar is placed.

Parameters
poseThe pose of the bar. Default: a default-constructed pose.
Returns
This builder, for chaining.

Definition at line 124 of file navigation_bar.cpp.

◆ withVariant()

NavigationBar::Builder & guillaume::entities::NavigationBar::Builder::withVariant ( Variant variant)

Set the variant.

Parameters
variantWithLabels (the default) to show every label, WithoutLabels to show only the label of the selected destination.
Returns
This builder, for chaining.

Definition at line 130 of file navigation_bar.cpp.

Here is the caller graph for this function:

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