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

Configures a Dialog, then builds it and registers it in the entity registry given at construction. More...

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

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

Public Member Functions

 Builder (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Create a builder set to the defaults of reset().
std::shared_ptr< Dialog > buildEntity (void) override
 Build a dialog and its children from the current configuration, without registering it or setting its parent.
void reset (void) override
 Restore the defaults: Alert variant, no title, no message, no action, no icon, no dismiss handler, and a default pose.
Builder & withPose (const utility::graphic::PoseF &pose)
 Set the pose the dialog is created with.
Builder & withVariant (Variant variant)
 Set the dialog variant.
Builder & withTitle (const std::string &title)
 Set the title, shown above the message.
Builder & withMessage (const std::string &message)
 Set the message, shown under the title.
Builder & addAction (const std::string &label, std::function< void(void)> onPress={})
 Append an action, shown as a text button at the end of the action row.
Builder & withIcon (const std::string &iconGlyph)
 Set the icon shown above the title.
Builder & withOnDismiss (std::function< void(void)> onDismiss)
 Set the handler called when the dialog is dismissed (see Dialog::setOnDismiss()).
std::shared_ptr< Dialog > makeDialog (std::shared_ptr< ecs::Entity > parent, Variant variant, const std::string &title, const std::string &message, const std::vector< std::string > &actions={})
 Build a dialog, register it under parent and reset the builder.
Public Member Functions inherited from guillaume::entities::EntityBuilderBase< Dialog >
 EntityBuilderBase (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Construct a builder bound to two registries.
 ~EntityBuilderBase (void) override=default
 Default destructor.
std::shared_ptr< Dialog > 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 Dialog, then builds it and registers it in the entity registry given at construction.

Definition at line 125 of file dialog.hpp.

Constructor & Destructor Documentation

◆ Builder()

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

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

Parameters
componentRegistryThe registry the dialog's components are created in.
entityRegistryThe registry the built dialogs are added to.

Definition at line 67 of file dialog.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ addAction()

Dialog::Builder & guillaume::entities::Dialog::Builder::addAction ( const std::string & label,
std::function< void(void)> onPress = {} )

Append an action, shown as a text button at the end of the action row.

Parameters
labelThe button label. An action with an empty label gets no button.
onPressCalled when the button is pressed. May be empty. The dialog stays open after the call.
Returns
This builder, for chaining.

Definition at line 129 of file dialog.cpp.

Here is the caller graph for this function:

◆ buildEntity()

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

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

Returns
The new dialog, hidden.

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

Definition at line 74 of file dialog.cpp.

Here is the call graph for this function:

◆ makeDialog()

std::shared_ptr< Dialog > guillaume::entities::Dialog::Builder::makeDialog ( std::shared_ptr< ecs::Entity > parent,
Variant variant,
const std::string & title,
const std::string & message,
const std::vector< std::string > & actions = {} )

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

The arguments replace the variant, title and message set before; actions are appended to the actions already added with addAction(). The icon and dismiss handler set before are kept.

Parameters
parentThe entity the dialog is attached to.
variantThe dialog variant.
titleThe title text (empty: no title).
messageThe message text (empty: no message).
actionsLabels of extra actions without a press handler.
Returns
The registered dialog, hidden until show() is called.

Definition at line 150 of file dialog.cpp.

Here is the call graph for this function:

◆ reset()

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

Restore the defaults: Alert variant, no title, no message, no action, no icon, no dismiss handler, and a default pose.

Implements guillaume::ecs::EntityBuilder.

Definition at line 82 of file dialog.cpp.

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

◆ withIcon()

Dialog::Builder & guillaume::entities::Dialog::Builder::withIcon ( const std::string & iconGlyph)

Set the icon shown above the title.

Parameters
iconGlyphThe glyph name. Default: empty, which builds no icon, except for a Confirmation dialog, which then shows "info".
Returns
This builder, for chaining.

Definition at line 136 of file dialog.cpp.

◆ withMessage()

Dialog::Builder & guillaume::entities::Dialog::Builder::withMessage ( const std::string & message)

Set the message, shown under the title.

Parameters
messageThe message text. Default: empty, which builds no message.
Returns
This builder, for chaining.

Definition at line 122 of file dialog.cpp.

◆ withOnDismiss()

Dialog::Builder & guillaume::entities::Dialog::Builder::withOnDismiss ( std::function< void(void)> onDismiss)

Set the handler called when the dialog is dismissed (see Dialog::setOnDismiss()).

Parameters
onDismissThe handler. Default: none.
Returns
This builder, for chaining.

Definition at line 143 of file dialog.cpp.

◆ withPose()

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

Set the pose the dialog is created with.

Parameters
poseThe position and orientation of the panel. Default: a default-constructed pose.
Returns
This builder, for chaining.

Definition at line 104 of file dialog.cpp.

◆ withTitle()

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

Set the title, shown above the message.

Parameters
titleThe title text. Default: empty, which builds no title.
Returns
This builder, for chaining.

Definition at line 116 of file dialog.cpp.

◆ withVariant()

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

Set the dialog variant.

Parameters
variantThe variant. Default: Variant::Alert.
Returns
This builder, for chaining.

Definition at line 110 of file dialog.cpp.

Here is the caller graph for this function:

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