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

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

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

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

Public Member Functions

 Builder (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Create a builder set to the defaults of reset().
std::shared_ptr< Menu > buildEntity (void) override
 Build a menu and its rows 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 menu is placed while it has no anchor.
Builder & withVariant (Variant variant)
 Set the variant.
Builder & addItem (const std::string &label, const std::string &leadingIcon="")
 Append an enabled item without press handler.
Builder & addItem (const Item &item)
 Append an item described in full.
std::shared_ptr< Menu > makeMenu (std::shared_ptr< ecs::Entity > parent, Variant variant, const std::vector< Item > &items)
 Build a menu, register it under parent and reset the builder.
Public Member Functions inherited from guillaume::entities::EntityBuilderBase< Menu >
 EntityBuilderBase (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Construct a builder bound to two registries.
 ~EntityBuilderBase (void) override=default
 Default destructor.
std::shared_ptr< Menu > 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 Menu, creates it and registers it in an entity registry.

Definition at line 133 of file menu.hpp.

Constructor & Destructor Documentation

◆ Builder()

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

Definition at line 78 of file menu.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ addItem() [1/2]

Menu::Builder & guillaume::entities::Menu::Builder::addItem ( const Item & item)

Append an item described in full.

Parameters
itemThe label, icons, press handler and flags of the item.
Returns
This builder, for chaining.

Definition at line 131 of file menu.cpp.

◆ addItem() [2/2]

Menu::Builder & guillaume::entities::Menu::Builder::addItem ( const std::string & label,
const std::string & leadingIcon = "" )

Append an enabled item without press handler.

Parameters
labelThe text of the item.
leadingIconThe glyph name of the icon shown before the label; empty for none.
Returns
This builder, for chaining.

Definition at line 121 of file menu.cpp.

Here is the caller graph for this function:

◆ buildEntity()

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

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

Returns
The new menu.

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

Definition at line 85 of file menu.cpp.

Here is the call graph for this function:

◆ makeMenu()

std::shared_ptr< Menu > guillaume::entities::Menu::Builder::makeMenu ( std::shared_ptr< ecs::Entity > parent,
Variant variant,
const std::vector< Item > & items )

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

The items given here come after the ones already added with addItem().

Parameters
parentThe entity the menu becomes a child of, or nullptr for a root entity.
variantThe variant of the menu.
itemsThe items to append, in display order; may be empty.
Returns
The new menu, closed.

Definition at line 138 of file menu.cpp.

Here is the call graph for this function:

◆ reset()

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

Restore the defaults.

Defaults: Dropdown variant, no item, default pose. The mode (Elevated), the anchor (none) and the anchor position (Bottom) are set on the menu after it is built.

Implements guillaume::ecs::EntityBuilder.

Definition at line 92 of file menu.cpp.

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

◆ withPose()

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

Set where the menu is placed while it has no anchor.

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

Definition at line 109 of file menu.cpp.

◆ withVariant()

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

Set the variant.

Parameters
variantThe variant to store. Default: Dropdown.
Returns
This builder, for chaining.

Definition at line 115 of file menu.cpp.

Here is the caller graph for this function:

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