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

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

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

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

Public Member Functions

 Builder (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Create a builder set to the defaults of reset().
std::shared_ptr< AppBar > buildEntity (void) override
 Build an app bar 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 app bar is placed.
Builder & withVariant (Variant variant)
 Set the variant.
Builder & withTitle (const std::string &title)
 Set the title text.
Builder & withNavigationIcon (const std::string &iconGlyphName)
 Set the icon of the leading navigation button.
Builder & addAction (const std::string &iconGlyphName)
 Append a trailing action button without press handler.
Builder & addAction (const std::string &iconGlyphName, std::function< void(void)> onPress, const std::string &accessibilityLabel="")
 Append a trailing action button with a press handler (Paper Appbar.Action).
Builder & withOnNavigation (std::function< void(void)> onPress, const std::string &accessibilityLabel="Navigate up")
 Set the press handler of the navigation button (Paper Appbar.BackAction).
Builder & withElevated (bool elevated)
 Choose the elevated look (Paper elevated).
Builder & withFixedWidth (float width)
 Set the width of the app bar.
std::shared_ptr< AppBar > makeAppBar (std::shared_ptr< ecs::Entity > parent, Variant variant)
 Build an app bar, register it under parent and reset the builder.
Public Member Functions inherited from guillaume::entities::EntityBuilderBase< AppBar >
 EntityBuilderBase (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Construct a builder bound to two registries.
 ~EntityBuilderBase (void) override=default
 Default destructor.
std::shared_ptr< AppBar > 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 an AppBar, creates it and registers it in an entity registry.

Definition at line 106 of file app_bar.hpp.

Constructor & Destructor Documentation

◆ Builder()

guillaume::entities::AppBar::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 app bars built.
entityRegistryThe registry the app bars are added to.

Definition at line 36 of file app_bar.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ addAction() [1/2]

AppBar::Builder & guillaume::entities::AppBar::Builder::addAction ( const std::string & iconGlyphName)

Append a trailing action button without press handler.

The glyph name is also used as the accessible name.

Parameters
iconGlyphNameThe glyph name of the icon.
Returns
This builder, for chaining.

Definition at line 98 of file app_bar.cpp.

◆ addAction() [2/2]

AppBar::Builder & guillaume::entities::AppBar::Builder::addAction ( const std::string & iconGlyphName,
std::function< void(void)> onPress,
const std::string & accessibilityLabel = "" )

Append a trailing action button with a press handler (Paper Appbar.Action).

Parameters
iconGlyphNameThe glyph name of the icon.
onPressCalled when the user presses the button.
accessibilityLabelThe accessible name of the button; the glyph name is used when empty.
Returns
This builder, for chaining.

Definition at line 105 of file app_bar.cpp.

◆ buildEntity()

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

Build an app bar and its children from the current configuration, without registering it or setting its parent.

Returns
The new app bar.

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

Definition at line 43 of file app_bar.cpp.

Here is the call graph for this function:

◆ makeAppBar()

std::shared_ptr< AppBar > guillaume::entities::AppBar::Builder::makeAppBar ( std::shared_ptr< ecs::Entity > parent,
Variant variant )

Build an app bar, register it under parent and reset the builder.

Uses the title, navigation, actions and other options set on the builder so far.

Parameters
parentThe entity the app bar becomes a child of, or nullptr for a root entity.
variantThe variant of the app bar.
Returns
The new app bar.

Definition at line 139 of file app_bar.cpp.

Here is the call graph for this function:

◆ reset()

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

Restore the defaults.

Defaults: Small variant, no title, no navigation icon, no action, not elevated, default pose, 360 dp wide.

Implements guillaume::ecs::EntityBuilder.

Definition at line 51 of file app_bar.cpp.

Here is the caller graph for this function:

◆ withElevated()

AppBar::Builder & guillaume::entities::AppBar::Builder::withElevated ( bool elevated)

Choose the elevated look (Paper elevated).

Parameters
elevatedTrue for the level-2 elevation and its tinted surface color, false (the default) for a flat bar.
Returns
This builder, for chaining.

Definition at line 125 of file app_bar.cpp.

◆ withFixedWidth()

AppBar::Builder & guillaume::entities::AppBar::Builder::withFixedWidth ( float width)

Set the width of the app bar.

Parameters
widthThe width, in dp. Default: 360.
Returns
This builder, for chaining.

Definition at line 131 of file app_bar.cpp.

◆ withNavigationIcon()

AppBar::Builder & guillaume::entities::AppBar::Builder::withNavigationIcon ( const std::string & iconGlyphName)

Set the icon of the leading navigation button.

The glyph name also becomes the button's accessible name when none has been set with withOnNavigation().

Parameters
iconGlyphNameThe glyph name of the icon, such as "menu". An empty name (the default) builds no navigation button.
Returns
This builder, for chaining.

Definition at line 88 of file app_bar.cpp.

◆ withOnNavigation()

AppBar::Builder & guillaume::entities::AppBar::Builder::withOnNavigation ( std::function< void(void)> onPress,
const std::string & accessibilityLabel = "Navigate up" )

Set the press handler of the navigation button (Paper Appbar.BackAction).

The button is built only when withNavigationIcon() gave it an icon.

Parameters
onPressCalled when the user presses the navigation button.
accessibilityLabelThe accessible name of the button.
Returns
This builder, for chaining.

Definition at line 117 of file app_bar.cpp.

◆ withPose()

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

Set where the app bar is placed.

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

Definition at line 69 of file app_bar.cpp.

◆ withTitle()

AppBar::Builder & guillaume::entities::AppBar::Builder::withTitle ( const std::string & title)

Set the title text.

Parameters
titleThe title; an empty string (the default) builds no title child.
Returns
This builder, for chaining.

Definition at line 81 of file app_bar.cpp.

◆ withVariant()

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

Set the variant.

Parameters
variantThe variant; it sets the height and the title typescale role. Default: Small.
Returns
This builder, for chaining.

Definition at line 75 of file app_bar.cpp.

Here is the caller graph for this function:

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