|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
Configures Switch widgets and registers them in the scene's entity registry. More...
#include <headers/guillaume/entities/switch.hpp>


Public Member Functions | |
| Builder (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry) | |
| Construct a builder holding the defaults of reset(). | |
| std::shared_ptr< Switch > | buildEntity (void) override |
| Build a switch and its children from the current configuration, without registering it or giving it a parent. | |
| void | reset (void) override |
| Restore the defaults: default pose, the Enabled variant, off, no icon, no label, and a 52 x 32 dp track with fully rounded ends. | |
| Builder & | withPose (const utility::graphic::PoseF &pose) |
| Set where the switch is. | |
| Builder & | withVariant (Variant variant) |
| Choose whether the switch reacts to input. | |
| Builder & | withChecked (bool checked) |
| Choose whether the switch starts on. | |
| Builder & | withIcon (const std::string &iconGlyph) |
| Draw an icon on the thumb. | |
| Builder & | withLabel (const std::string &label) |
| Set the text shown to the right of the track. | |
| std::shared_ptr< Switch > | makeSwitch (std::shared_ptr< ecs::Entity > parent, Variant variant, bool checked, const std::string &iconGlyph, const std::string &label) |
| Build a switch and its children, register it under parent and reset the builder. | |
| Public Member Functions inherited from guillaume::entities::EntityBuilderBase< Switch > | |
| EntityBuilderBase (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry) | |
| Construct a builder bound to two registries. | |
| ~EntityBuilderBase (void) override=default | |
| Default destructor. | |
| std::shared_ptr< Switch > | 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. | |
Configures Switch widgets and registers them in the scene's entity registry.
Definition at line 108 of file switch.hpp.
| guillaume::entities::Switch::Builder::Builder | ( | ecs::ComponentRegistry & | componentRegistry, |
| ecs::EntityRegistry & | entityRegistry ) |
Construct a builder holding the defaults of reset().
| componentRegistry | The registry the components of the built switches are stored in. |
| entityRegistry | The registry that owns the switches built by makeSwitch. |
Definition at line 92 of file switch.cpp.

|
overridevirtual |
Build a switch and its children from the current configuration, without registering it or giving it a parent.
Implements guillaume::entities::EntityBuilderBase< Switch >.
Definition at line 99 of file switch.cpp.

| std::shared_ptr< Switch > guillaume::entities::Switch::Builder::makeSwitch | ( | std::shared_ptr< ecs::Entity > | parent, |
| Variant | variant, | ||
| bool | checked, | ||
| const std::string & | iconGlyph, | ||
| const std::string & | label ) |
Build a switch and its children, register it under parent and reset the builder.
| parent | The entity the switch is attached to, or nullptr for a root entity. |
| variant | Enabled, Disabled or WithIcon. |
| checked | True to start on, false to start off. |
| iconGlyph | The Material Symbols name of the thumb icon, or an empty string for no icon. |
| label | The text shown to the right of the track, or an empty string for no label. |
Definition at line 157 of file switch.cpp.

|
overridevirtual |
Restore the defaults: default pose, the Enabled variant, off, no icon, no label, and a 52 x 32 dp track with fully rounded ends.
Implements guillaume::ecs::EntityBuilder.
Definition at line 106 of file switch.cpp.

| Switch::Builder & guillaume::entities::Switch::Builder::withChecked | ( | bool | checked | ) |
Choose whether the switch starts on.
| checked | True for on, false for off. Off by default. |
Definition at line 139 of file switch.cpp.
| Switch::Builder & guillaume::entities::Switch::Builder::withIcon | ( | const std::string & | iconGlyph | ) |
Draw an icon on the thumb.
| iconGlyph | The Material Symbols name of the icon, such as "check". Empty by default, which builds no icon. |
Definition at line 145 of file switch.cpp.
| Switch::Builder & guillaume::entities::Switch::Builder::withLabel | ( | const std::string & | label | ) |
Set the text shown to the right of the track.
| label | The label. It is also the accessibility label. Empty by default, which builds no label child. |
Definition at line 151 of file switch.cpp.
| Switch::Builder & guillaume::entities::Switch::Builder::withPose | ( | const utility::graphic::PoseF & | pose | ) |
Set where the switch is.
| pose | The pose of the top-left corner of the track. A default-constructed pose by default. |
Definition at line 127 of file switch.cpp.
| Switch::Builder & guillaume::entities::Switch::Builder::withVariant | ( | Variant | variant | ) |
Choose whether the switch reacts to input.
| variant | Enabled, Disabled or WithIcon. Enabled by default. |
Definition at line 133 of file switch.cpp.
