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

Configures, creates and registers Chip widgets. More...

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

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

Public Member Functions

 Builder (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Construct a builder with the default configuration (see reset()).
std::shared_ptr< Chip > buildEntity (void) override
 Build a Chip, with its icon and label children, from the current configuration, without registering it.
void reset (void) override
 Restore the default configuration.
Builder & withPose (const utility::graphic::PoseF &pose)
 Set the position and orientation of the chip.
Builder & withVariant (Variant variant)
 Set the variant, which decides the children built and whether a press toggles the selection.
Builder & withLabel (const std::string &label)
 Set the label text.
Builder & withIcon (const std::string &iconGlyph)
 Set the leading icon.
Builder & withSelected (bool selected)
 Choose whether the chip starts selected.
std::shared_ptr< Chip > makeChip (std::shared_ptr< ecs::Entity > parent, Variant variant, const std::string &label, const std::string &iconGlyph, bool selected)
 Build a chip, register it under parent and reset the builder.
Public Member Functions inherited from guillaume::entities::EntityBuilderBase< Chip >
 EntityBuilderBase (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Construct a builder bound to two registries.
 ~EntityBuilderBase (void) override=default
 Default destructor.
std::shared_ptr< Chip > 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, creates and registers Chip widgets.

Set options with the with... methods then call registerEntity(), or use makeChip() to do both in one call.

Definition at line 112 of file chip.hpp.

Constructor & Destructor Documentation

◆ Builder()

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

Construct a builder with the default configuration (see reset()).

Parameters
componentRegistryThe registry that stores the components of the chips to build.
entityRegistryThe registry the built chips are added to (usually the scene's).

Definition at line 37 of file chip.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ buildEntity()

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

Build a Chip, with its icon and label children, from the current configuration, without registering it.

registerEntity() calls it, then sets the parent, registers the chip and resets the builder.

Returns
The new chip.

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

Definition at line 44 of file chip.cpp.

Here is the call graph for this function:

◆ makeChip()

std::shared_ptr< Chip > guillaume::entities::Chip::Builder::makeChip ( std::shared_ptr< ecs::Entity > parent,
Variant variant,
const std::string & label,
const std::string & iconGlyph,
bool selected )

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

A pose set before the call with withPose() also applies.

Parameters
parentThe entity the chip becomes a child of.
variantThe variant.
labelThe text shown in the chip.
iconGlyphThe glyph name of the leading icon; may be empty.
selectedTrue for a chip that starts selected.
Returns
The new chip, registered in the entity registry.

Definition at line 101 of file chip.cpp.

Here is the call graph for this function:

◆ reset()

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

Restore the default configuration.

Defaults: Variant::Assist, empty label, no icon glyph, not selected, default pose. The pill is a horizontal row with centered content, 8 dp between children, 12 dp of padding, a fixed height of 32 dp and the theme's small corner radius.

Implements guillaume::ecs::EntityBuilder.

Definition at line 51 of file chip.cpp.

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

◆ withIcon()

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

Set the leading icon.

Parameters
iconGlyphThe glyph name of the leading icon. Default: empty, which means no leading icon, except for an Assist chip which then shows components::Chip::DefaultAssistGlyph.
Returns
Reference to the builder for chaining.

Definition at line 88 of file chip.cpp.

◆ withLabel()

Chip::Builder & guillaume::entities::Chip::Builder::withLabel ( const std::string & label)

Set the label text.

Parameters
labelThe text shown in the chip, also used as its accessibility label. Default: empty.
Returns
Reference to the builder for chaining.

Definition at line 82 of file chip.cpp.

◆ withPose()

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

Set the position and orientation of the chip.

Parameters
poseThe pose written to the chip's Transform. Default: a default-constructed pose.
Returns
Reference to the builder for chaining.

Definition at line 70 of file chip.cpp.

◆ withSelected()

Chip::Builder & guillaume::entities::Chip::Builder::withSelected ( bool selected)

Choose whether the chip starts selected.

Parameters
selectedTrue for a selected chip. Default: false.
Returns
Reference to the builder for chaining.

Definition at line 94 of file chip.cpp.

◆ withVariant()

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

Set the variant, which decides the children built and whether a press toggles the selection.

Parameters
variantThe variant. Default: Variant::Assist.
Returns
Reference to the builder for chaining.

Definition at line 76 of file chip.cpp.

Here is the caller graph for this function:

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