|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
Base of every widget Builder: turns a configuration into a widget that is attached to a parent and owned by an entity registry. More...
#include <headers/guillaume/entities/builder_base.hpp>


Public Member Functions | |
| EntityBuilderBase (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry) | |
| Construct a builder bound to two registries. | |
| ~EntityBuilderBase (void) override=default | |
| Default destructor. | |
| std::shared_ptr< EntityType > | 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. | |
| virtual void | reset (void)=0 |
| Forget the configuration accumulated for the entity being built, so the builder is ready for the next one. | |
Protected Member Functions | |
| virtual std::shared_ptr< EntityType > | buildEntity (void)=0 |
| Create the widget from the current configuration. | |
| 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. | |
Base of every widget Builder: turns a configuration into a widget that is attached to a parent and owned by an entity registry.
A concrete builder (Button::Builder, Checkbox::Builder, ...) stores the configuration in its fields, exposes with...() setters and make...() shortcuts, and implements two hooks: buildEntity(), which creates the widget from the fields, and reset(), which restores the default configuration. registerEntity() does the rest.
One builder can create several widgets in a row: it is back to its defaults after each registerEntity(), so nothing leaks from one widget to the next.
| EntityType | The widget class the builder creates. |
Definition at line 58 of file builder_base.hpp.
| guillaume::entities::EntityBuilderBase< EntityType >::EntityBuilderBase | ( | ecs::ComponentRegistry & | componentRegistry, |
| ecs::EntityRegistry & | entityRegistry ) |
Construct a builder bound to two registries.
| componentRegistry | The registry that stores the components of the widgets built. |
| entityRegistry | The registry that owns the widgets built: a scene's registry for a top-level widget, or a parent widget for its own children. |
|
protectedpure virtual |
Create the widget from the current configuration.
Implemented by each concrete builder, usually as a call to the widget's static create(). It must not attach the parent nor register the widget: registerEntity() does both.
Implemented in guillaume::entities::AppBar::Builder, guillaume::entities::Badge::Builder, guillaume::entities::Button::Builder, guillaume::entities::Card::Builder, guillaume::entities::Checkbox::Builder, guillaume::entities::Chip::Builder, guillaume::entities::Dialog::Builder, guillaume::entities::Divider::Builder, guillaume::entities::ExtendedFloatingActionButton::Builder, guillaume::entities::FloatingActionButton::Builder, guillaume::entities::FloatingActionButtonMenu::Builder, guillaume::entities::Icon::Builder, guillaume::entities::IconButton::Builder, guillaume::entities::Image::Builder, guillaume::entities::List::Builder, guillaume::entities::LoadingIndicator::Builder, guillaume::entities::Menu::Builder, guillaume::entities::Mesh::Builder, guillaume::entities::NavigationBar::Builder, guillaume::entities::NavigationDrawer::Builder, guillaume::entities::ProgressIndicator::Builder, guillaume::entities::RadioButton::Builder, guillaume::entities::RadioGroup::Builder, guillaume::entities::Search::Builder, guillaume::entities::SegmentedButton::Builder, guillaume::entities::Snackbar::Builder, guillaume::entities::Surface::Builder, guillaume::entities::Switch::Builder, guillaume::entities::Text::Builder, guillaume::entities::TextField::Builder, guillaume::entities::Tooltip::Builder, and guillaume::entities::View::Builder.
| std::shared_ptr< EntityType > guillaume::entities::EntityBuilderBase< EntityType >::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.
The make...() methods of the concrete builders end with this call.
| parent | The entity the widget becomes a child of, or nullptr for a widget without parent. |