|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
Configures, creates and registers SegmentedButton widgets. More...
#include <headers/guillaume/entities/segmented_button.hpp>


Public Member Functions | |
| Builder (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry) | |
| Construct a builder with the default configuration (see reset()). | |
| std::shared_ptr< SegmentedButton > | buildEntity (void) override |
| Build a SegmentedButton, with one button per segment, from the current configuration, without registering it. | |
| void | reset (void) override |
| Restore the default configuration. | |
| Builder & | withLabels (const std::vector< std::string > &labels) |
| Describe the segments by their labels only. | |
| Builder & | withSelectionMode (const SelectionMode &selectionMode) |
| Set the selection mode. | |
| Builder & | withOnChange (std::function< void(std::size_t)> onChange) |
| Set the change handler. | |
| Builder & | withSegments (const std::vector< Segment > &segments) |
| Describe the segments one by one (label, icon, disabled, accessibility label). | |
| std::shared_ptr< SegmentedButton > | makeSegmentedButton (std::shared_ptr< Entity > parent, const std::vector< std::string > &labels, SelectionMode selectionMode, std::function< void(std::size_t)> onChange) |
| Build a segmented button from labels, register it under parent and reset the builder. | |
| Public Member Functions inherited from guillaume::entities::EntityBuilderBase< SegmentedButton > | |
| EntityBuilderBase (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry) | |
| Construct a builder bound to two registries. | |
| ~EntityBuilderBase (void) override=default | |
| Default destructor. | |
| std::shared_ptr< SegmentedButton > | 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, creates and registers SegmentedButton widgets.
Describe the segments with withLabels() or withSegments(), then call registerEntity(), or use makeSegmentedButton() to do both in one call.
Definition at line 114 of file segmented_button.hpp.
| guillaume::entities::SegmentedButton::Builder::Builder | ( | ecs::ComponentRegistry & | componentRegistry, |
| ecs::EntityRegistry & | entityRegistry ) |
Construct a builder with the default configuration (see reset()).
| componentRegistry | The registry that stores the components of the segmented buttons to build. |
| entityRegistry | The registry the built segmented buttons are added to (usually the scene's). |
Definition at line 55 of file segmented_button.cpp.

|
overridevirtual |
Build a SegmentedButton, with one button per segment, from the current configuration, without registering it.
The segments come from withSegments() when it was given a non-empty list, from withLabels() otherwise. registerEntity() calls this function, then sets the parent, registers the segmented button and resets the builder.
Implements guillaume::entities::EntityBuilderBase< SegmentedButton >.
Definition at line 62 of file segmented_button.cpp.

| std::shared_ptr< SegmentedButton > guillaume::entities::SegmentedButton::Builder::makeSegmentedButton | ( | std::shared_ptr< Entity > | parent, |
| const std::vector< std::string > & | labels, | ||
| SelectionMode | selectionMode, | ||
| std::function< void(std::size_t)> | onChange ) |
Build a segmented button from labels, register it under parent and reset the builder.
Segments given earlier to withSegments() still take the place of labels.
| parent | The entity the segmented button becomes a child of. |
| labels | One label per segment, in display order. |
| selectionMode | Single or Multi selection. |
| onChange | The function called with the index of the segment the user pressed (may be empty). |
Definition at line 111 of file segmented_button.cpp.

|
overridevirtual |
Restore the default configuration.
Defaults: no label, no segment configuration, SelectionMode::Single, no change handler.
Implements guillaume::ecs::EntityBuilder.
Definition at line 74 of file segmented_button.cpp.

| SegmentedButton::Builder & guillaume::entities::SegmentedButton::Builder::withLabels | ( | const std::vector< std::string > & | labels | ) |
Describe the segments by their labels only.
| labels | One label per segment, in display order. Each segment has no icon and is enabled. Default: empty. Ignored when withSegments() was given a non-empty list. |
Definition at line 82 of file segmented_button.cpp.

| SegmentedButton::Builder & guillaume::entities::SegmentedButton::Builder::withOnChange | ( | std::function< void(std::size_t)> | onChange | ) |
Set the change handler.
| onChange | The function called with the index of the segment the user pressed, after the selection was updated. Default: empty, nothing is called. |
Definition at line 103 of file segmented_button.cpp.
| SegmentedButton::Builder & guillaume::entities::SegmentedButton::Builder::withSegments | ( | const std::vector< Segment > & | segments | ) |
Describe the segments one by one (label, icon, disabled, accessibility label).
| segments | One configuration per segment, in display order. When not empty, it is used in place of the labels given to withLabels(). Default: empty. |
Definition at line 96 of file segmented_button.cpp.
| SegmentedButton::Builder & guillaume::entities::SegmentedButton::Builder::withSelectionMode | ( | const SelectionMode & | selectionMode | ) |
Set the selection mode.
| selectionMode | SelectionMode::Single to keep at most one segment selected, SelectionMode::Multi to let each segment toggle on its own. Default: SelectionMode::Single. |
Definition at line 89 of file segmented_button.cpp.