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

Configures RadioGroup widgets and registers them in the scene's entity registry. More...

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

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

Public Member Functions

 Builder (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Construct a builder holding the defaults of reset().
std::shared_ptr< RadioGroup > buildEntity (void) override
 Build a group and its radio buttons from the current configuration, without registering it or giving it a parent.
void reset (void) override
 Restore the defaults: default pose, no option, no selected option, no value-change handler, and a vertical layout aligned to the start with RowSpacing between options.
Builder & withPose (const utility::graphic::PoseF &pose)
 Set where the group is.
Builder & addOption (const std::string &label)
 Append an option at the end of the list.
Builder & withValue (std::size_t index)
 Choose the option selected when the group is built.
Builder & withOnValueChange (std::function< void(std::size_t)> onValueChange)
 Set the function called when the user selects another option.
std::shared_ptr< RadioGroup > makeRadioGroup (std::shared_ptr< ecs::Entity > parent, const std::vector< std::string > &options)
 Build a group and its radio buttons, register it under parent and reset the builder.
Public Member Functions inherited from guillaume::entities::EntityBuilderBase< RadioGroup >
 EntityBuilderBase (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Construct a builder bound to two registries.
 ~EntityBuilderBase (void) override=default
 Default destructor.
std::shared_ptr< RadioGroup > 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 RadioGroup widgets and registers them in the scene's entity registry.

Definition at line 95 of file radio_group.hpp.

Constructor & Destructor Documentation

◆ Builder()

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

Construct a builder holding the defaults of reset().

Parameters
componentRegistryThe registry the components of the built groups are stored in.
entityRegistryThe registry that owns the groups built by makeRadioGroup.

Definition at line 31 of file radio_group.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ addOption()

RadioGroup::Builder & guillaume::entities::RadioGroup::Builder::addOption ( const std::string & label)

Append an option at the end of the list.

Parameters
labelThe text shown next to the radio button of the option.
Returns
Reference to this builder for chaining.

Definition at line 68 of file radio_group.cpp.

Here is the caller graph for this function:

◆ buildEntity()

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

Build a group and its radio buttons from the current configuration, without registering it or giving it a parent.

Returns
The new group.

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

Definition at line 38 of file radio_group.cpp.

Here is the call graph for this function:

◆ makeRadioGroup()

std::shared_ptr< RadioGroup > guillaume::entities::RadioGroup::Builder::makeRadioGroup ( std::shared_ptr< ecs::Entity > parent,
const std::vector< std::string > & options )

Build a group and its radio buttons, register it under parent and reset the builder.

The pose, selected option and handler set with the with... methods apply.

Parameters
parentThe entity the group is attached to, or nullptr for a root entity.
optionsThe option labels, in display order. They are appended to the options already given with addOption().
Returns
The registered group.

Definition at line 87 of file radio_group.cpp.

Here is the call graph for this function:

◆ reset()

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

Restore the defaults: default pose, no option, no selected option, no value-change handler, and a vertical layout aligned to the start with RowSpacing between options.

Implements guillaume::ecs::EntityBuilder.

Definition at line 44 of file radio_group.cpp.

Here is the caller graph for this function:

◆ withOnValueChange()

RadioGroup::Builder & guillaume::entities::RadioGroup::Builder::withOnValueChange ( std::function< void(std::size_t)> onValueChange)

Set the function called when the user selects another option.

Parameters
onValueChangeThe function to call, receiving the index of the newly selected option. Empty by default.
Returns
Reference to this builder for chaining.

Definition at line 80 of file radio_group.cpp.

◆ withPose()

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

Set where the group is.

Parameters
poseThe pose of the top-left corner of the group. A default-constructed pose by default.
Returns
Reference to this builder for chaining.

Definition at line 61 of file radio_group.cpp.

◆ withValue()

RadioGroup::Builder & guillaume::entities::RadioGroup::Builder::withValue ( std::size_t index)

Choose the option selected when the group is built.

Parameters
indexThe index of the option, starting at 0. It is not checked: with an index that matches no option, no radio button is selected. By default no option is selected.
Returns
Reference to this builder for chaining.

Definition at line 74 of file radio_group.cpp.


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