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

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

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

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

Public Member Functions

 Builder (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Create a builder set to the defaults of reset().
std::shared_ptr< NavigationDrawer > buildEntity (void) override
 Build a drawer and its children 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 drawer is placed.
Builder & withVariant (Variant variant)
 Set the variant.
Builder & addDestination (const std::string &iconGlyph, const std::string &label, const std::string &right="", bool disabled=false)
 Append a destination after the entries already added.
Builder & addSection (const std::string &title)
 Append a section title after the entries already added.
Builder & addDivider (void)
 Append a horizontal divider after the entries already added.
Builder & withOnIndexChange (std::function< void(std::size_t)> onIndexChange)
 Set the handler called when the user selects another destination.
std::shared_ptr< NavigationDrawer > makeNavigationDrawer (std::shared_ptr< ecs::Entity > parent, Variant variant, const std::vector< std::pair< std::string, std::string > > &destinations)
 Build a drawer, register it under parent and reset the builder.
Public Member Functions inherited from guillaume::entities::EntityBuilderBase< NavigationDrawer >
 EntityBuilderBase (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Construct a builder bound to two registries.
 ~EntityBuilderBase (void) override=default
 Default destructor.
std::shared_ptr< NavigationDrawer > 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 NavigationDrawer, creates it and registers it in an entity registry.

Definition at line 125 of file navigation_drawer.hpp.

Constructor & Destructor Documentation

◆ Builder()

guillaume::entities::NavigationDrawer::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 drawers built.
entityRegistryThe registry the drawers are added to.

Definition at line 65 of file navigation_drawer.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ addDestination()

NavigationDrawer::Builder & guillaume::entities::NavigationDrawer::Builder::addDestination ( const std::string & iconGlyph,
const std::string & label,
const std::string & right = "",
bool disabled = false )

Append a destination after the entries already added.

Parameters
iconGlyphThe glyph name of the icon, such as "inbox"; empty for no icon.
labelThe text of the destination.
rightA short text shown at the far edge of the row, such as a count; empty for none. Not shown by the Collapsed variant.
disabledTrue to make the destination ignore presses.
Returns
This builder, for chaining.

Definition at line 114 of file navigation_drawer.cpp.

Here is the caller graph for this function:

◆ addDivider()

NavigationDrawer::Builder & guillaume::entities::NavigationDrawer::Builder::addDivider ( void )

Append a horizontal divider after the entries already added.

Returns
This builder, for chaining.

Definition at line 138 of file navigation_drawer.cpp.

◆ addSection()

NavigationDrawer::Builder & guillaume::entities::NavigationDrawer::Builder::addSection ( const std::string & title)

Append a section title after the entries already added.

Parameters
titleThe title text. The Collapsed variant builds no child for it.
Returns
This builder, for chaining.

Definition at line 129 of file navigation_drawer.cpp.

◆ buildEntity()

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

Build a drawer and its children from the current configuration, without registering it or setting its parent.

Returns
The new drawer.

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

Definition at line 74 of file navigation_drawer.cpp.

Here is the call graph for this function:

◆ makeNavigationDrawer()

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

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

The destinations given here come after the entries already added with addDestination(), addSection() and addDivider().

Parameters
parentThe entity the drawer becomes a child of, or nullptr for a root entity.
variantThe variant of the drawer.
destinationsThe (icon glyph name, label) pair of each destination to append; may be empty.
Returns
The new drawer.

Definition at line 154 of file navigation_drawer.cpp.

Here is the call graph for this function:

◆ reset()

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

Restore the defaults.

Defaults: Standard variant, no entry, no index-change handler, default pose, 320 dp wide and 640 dp high (components::NavigationDrawer::Width and Height), 12 dp of padding and 4 dp between entries.

Implements guillaume::ecs::EntityBuilder.

Definition at line 82 of file navigation_drawer.cpp.

Here is the caller graph for this function:

◆ withOnIndexChange()

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

Set the handler called when the user selects another destination.

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

Definition at line 146 of file navigation_drawer.cpp.

◆ withPose()

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

Set where the drawer is placed.

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

Definition at line 101 of file navigation_drawer.cpp.

◆ withVariant()

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

Set the variant.

Parameters
variantStandard (the default), Modal or Collapsed.
Returns
This builder, for chaining.

Definition at line 108 of file navigation_drawer.cpp.

Here is the caller graph for this function:

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