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

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

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

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

Public Member Functions

 Builder (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Construct a builder holding the defaults of reset().
std::shared_ptr< Icon > buildEntity (void) override
 Build an icon from the current configuration, without registering it or giving it a parent.
void reset (void) override
 Restore the defaults: empty glyph name, font size 24, the OnSurface color of the active theme, and the Outlined style.
Builder & withGlyphName (const std::string &glyphName)
 Choose the icon to draw.
Builder & withFontSize (float fontSize)
 Set the size of the icon.
Builder & withColor (const utility::graphic::Color32Bit &color)
 Set the icon color.
Builder & withStyle (const components::Glyph::Style &style)
 Set the Material Symbols style of the glyph.
std::shared_ptr< Icon > makeIcon (std::shared_ptr< Entity > parent, const std::string &iconName, const float &fontSize, const utility::graphic::Color32Bit &color, const components::Glyph::Style &style)
 Build an icon, register it under parent and reset the builder.
Public Member Functions inherited from guillaume::entities::EntityBuilderBase< Icon >
 EntityBuilderBase (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Construct a builder bound to two registries.
 ~EntityBuilderBase (void) override=default
 Default destructor.
std::shared_ptr< Icon > 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 Icon widgets and registers them in the scene's entity registry.

Definition at line 86 of file icon.hpp.

Constructor & Destructor Documentation

◆ Builder()

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

Construct a builder holding the defaults of reset().

Parameters
componentRegistryThe registry the components of the built icons are stored in.
entityRegistryThe registry that owns the icons built by makeIcon.
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ buildEntity()

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

Build an icon from the current configuration, without registering it or giving it a parent.

Returns
The new icon.

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

Definition at line 39 of file icon.cpp.

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

◆ makeIcon()

std::shared_ptr< Icon > guillaume::entities::Icon::Builder::makeIcon ( std::shared_ptr< Entity > parent,
const std::string & iconName,
const float & fontSize,
const utility::graphic::Color32Bit & color,
const components::Glyph::Style & style )

Build an icon, register it under parent and reset the builder.

Parameters
parentThe entity the icon is attached to, or nullptr for a root entity.
iconNameThe Material Symbols name of the icon, such as "favorite".
fontSizeThe font size of the glyph, in dp.
colorThe icon color (RGBA).
styleThe Material Symbols style of the glyph.
Returns
The registered icon.

Definition at line 80 of file icon.cpp.

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

◆ reset()

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

Restore the defaults: empty glyph name, font size 24, the OnSurface color of the active theme, and the Outlined style.

Implements guillaume::ecs::EntityBuilder.

Definition at line 46 of file icon.cpp.

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

◆ withColor()

Icon::Builder & guillaume::entities::Icon::Builder::withColor ( const utility::graphic::Color32Bit & color)

Set the icon color.

Parameters
colorThe color (RGBA). By default the OnSurface color the active theme had when the builder was last reset.
Returns
Reference to this builder for chaining.

Definition at line 67 of file icon.cpp.

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

◆ withFontSize()

Icon::Builder & guillaume::entities::Icon::Builder::withFontSize ( float fontSize)

Set the size of the icon.

Parameters
fontSizeThe font size of the glyph, in dp. 24 by default.
Returns
Reference to this builder for chaining.

Definition at line 60 of file icon.cpp.

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

◆ withGlyphName()

Icon::Builder & guillaume::entities::Icon::Builder::withGlyphName ( const std::string & glyphName)

Choose the icon to draw.

Parameters
glyphNameThe Material Symbols name of the icon, such as "favorite". Empty by default.
Returns
Reference to this builder for chaining.
See also
components::Glyph::getName

Definition at line 54 of file icon.cpp.

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

◆ withStyle()

Icon::Builder & guillaume::entities::Icon::Builder::withStyle ( const components::Glyph::Style & style)

Set the Material Symbols style of the glyph.

Parameters
styleThe style stored in components::Glyph. Outlined by default.
Returns
Reference to this builder for chaining.

Definition at line 74 of file icon.cpp.

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

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