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

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

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

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

Public Member Functions

 Builder (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Create a builder set to the defaults of reset().
std::shared_ptr< TextField > buildEntity (void) override
 Build a text field and its children from the current configuration, without registering it or setting its parent.
void reset (void) override
 Restore the defaults: Filled variant, no label, no icon, no supporting text, no error, empty text and a default pose.
Builder & withPose (const utility::graphic::PoseF &pose)
 Set the pose the field is created with.
Builder & withVariant (Variant variant)
 Set the field variant.
Builder & withPlaceholder (const std::string &placeholder)
 Set the label.
Builder & withLeadingIcon (const std::string &iconGlyph)
 Set the icon shown at the start of the box.
Builder & withTrailingIcon (const std::string &iconGlyph)
 Set the icon shown at the end of the box.
Builder & withSupportingText (const std::string &supportingText)
 Set the helper text shown under the box.
Builder & withError (bool error)
 Choose whether the field starts in the error state.
Builder & withText (const std::string &text)
 Set the text the field holds when created.
std::shared_ptr< TextField > makeTextField (std::shared_ptr< ecs::Entity > parent, Variant variant, const std::string &placeholder, const std::string &leadingIcon, const std::string &trailingIcon, const std::string &supportingText, bool error, const std::string &text="")
 Build a text field, register it under parent and reset the builder.
Public Member Functions inherited from guillaume::entities::EntityBuilderBase< TextField >
 EntityBuilderBase (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Construct a builder bound to two registries.
 ~EntityBuilderBase (void) override=default
 Default destructor.
std::shared_ptr< TextField > 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 TextField, then builds it and registers it in the entity registry given at construction.

Definition at line 134 of file text_field.hpp.

Constructor & Destructor Documentation

◆ Builder()

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

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

Parameters
componentRegistryThe registry the field's components are created in.
entityRegistryThe registry the built fields are added to.

Definition at line 37 of file text_field.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ buildEntity()

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

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

Returns
The new text field.

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

Definition at line 44 of file text_field.cpp.

Here is the call graph for this function:

◆ makeTextField()

std::shared_ptr< TextField > guillaume::entities::TextField::Builder::makeTextField ( std::shared_ptr< ecs::Entity > parent,
Variant variant,
const std::string & placeholder,
const std::string & leadingIcon,
const std::string & trailingIcon,
const std::string & supportingText,
bool error,
const std::string & text = "" )

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

The arguments replace every setting but the pose.

Parameters
parentThe entity the field is attached to.
variantThe field variant.
placeholderThe label text (empty: no label).
leadingIconThe glyph name of the icon at the start of the box (empty: none).
trailingIconThe glyph name of the icon at the end of the box (empty: none).
supportingTextThe helper text under the box (empty: none).
errorTrue to start in the error state.
textThe initial text.
Returns
The registered text field.

Definition at line 127 of file text_field.cpp.

Here is the call graph for this function:

◆ reset()

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

Restore the defaults: Filled variant, no label, no icon, no supporting text, no error, empty text and a default pose.

Implements guillaume::ecs::EntityBuilder.

Definition at line 52 of file text_field.cpp.

Here is the caller graph for this function:

◆ withError()

TextField::Builder & guillaume::entities::TextField::Builder::withError ( bool error)

Choose whether the field starts in the error state.

Parameters
errorTrue for the error state. Default: false.
Returns
This builder, for chaining.

Definition at line 115 of file text_field.cpp.

◆ withLeadingIcon()

TextField::Builder & guillaume::entities::TextField::Builder::withLeadingIcon ( const std::string & iconGlyph)

Set the icon shown at the start of the box.

Parameters
iconGlyphThe glyph name. Default: empty, no icon.
Returns
This builder, for chaining.

Definition at line 95 of file text_field.cpp.

◆ withPlaceholder()

TextField::Builder & guillaume::entities::TextField::Builder::withPlaceholder ( const std::string & placeholder)

Set the label.

The label is shown in place of the typed text while the field is empty and unfocused, and floats above it otherwise.

Parameters
placeholderThe label text. Default: empty, which builds no label.
Returns
This builder, for chaining.

Definition at line 88 of file text_field.cpp.

◆ withPose()

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

Set the pose the field is created with.

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

Definition at line 75 of file text_field.cpp.

◆ withSupportingText()

TextField::Builder & guillaume::entities::TextField::Builder::withSupportingText ( const std::string & supportingText)

Set the helper text shown under the box.

Parameters
supportingTextThe text. Default: empty, no text.
Returns
This builder, for chaining.

Definition at line 108 of file text_field.cpp.

◆ withText()

TextField::Builder & guillaume::entities::TextField::Builder::withText ( const std::string & text)

Set the text the field holds when created.

Parameters
textThe initial text. Default: empty.
Returns
This builder, for chaining.

Definition at line 121 of file text_field.cpp.

◆ withTrailingIcon()

TextField::Builder & guillaume::entities::TextField::Builder::withTrailingIcon ( const std::string & iconGlyph)

Set the icon shown at the end of the box.

Parameters
iconGlyphThe glyph name. Default: empty, no icon. The "error" icon takes its place in the error state.
Returns
This builder, for chaining.

Definition at line 102 of file text_field.cpp.

◆ withVariant()

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

Set the field variant.

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

Definition at line 81 of file text_field.cpp.

Here is the caller graph for this function:

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