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

Configures and registers Surface widgets. More...

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

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

Public Member Functions

 Builder (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Construct a builder set to the defaults of reset().
std::shared_ptr< Surface > buildEntity (void) override
 Create a surface from the current configuration, without attaching nor registering it.
void reset (void) override
 Restore the defaults: elevation level 1, a shadow (Mode::Elevated), square corners, children in a column aligned at the start and centered across, no spacing, no padding, no fixed size, default pose.
Builder & withPose (const utility::graphic::PoseF &pose)
 Set where the surface is.
Builder & withElevation (theme::ElevationLevel elevation)
 Set the elevation level, which tints the background and sizes the shadow.
Builder & withMode (Mode mode)
 Choose whether the surface casts a shadow.
Builder & withShape (theme::ShapeRole role)
 Set the corner radius from a shape role of the theme.
Builder & withConfig (const SurfaceConfig &config)
 Replace the layout configuration: axis, alignment, spacing, padding, fixed size and corner radius.
std::shared_ptr< Surface > makeSurface (std::shared_ptr< ecs::Entity > parent, theme::ElevationLevel elevation, Mode mode=Mode::Elevated)
 Build a surface with the given elevation and register it under a parent.
Public Member Functions inherited from guillaume::entities::EntityBuilderBase< Surface >
 EntityBuilderBase (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Construct a builder bound to two registries.
 ~EntityBuilderBase (void) override=default
 Default destructor.
std::shared_ptr< Surface > 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 and registers Surface widgets.

Definition at line 402 of file surface.hpp.

Constructor & Destructor Documentation

◆ Builder()

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

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

Parameters
componentRegistryThe registry that stores the components of the surfaces built.
entityRegistryThe registry that owns the surfaces built.

Definition at line 118 of file surface.cpp.

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

Member Function Documentation

◆ buildEntity()

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

Create a surface from the current configuration, without attaching nor registering it.

Returns
The new surface.

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

Definition at line 125 of file surface.cpp.

Here is the call graph for this function:

◆ makeSurface()

std::shared_ptr< Surface > guillaume::entities::Surface::Builder::makeSurface ( std::shared_ptr< ecs::Entity > parent,
theme::ElevationLevel elevation,
Mode mode = Mode::Elevated )

Build a surface with the given elevation and register it under a parent.

The other settings are those given with the with...() methods. The builder is back to its defaults afterwards.

Parameters
parentThe entity the surface becomes a child of, or nullptr.
elevationThe elevation level, from Level0 to Level5.
modeElevated for a shadow, Flat for none.
Returns
The registered surface.

Definition at line 175 of file surface.cpp.

Here is the call graph for this function:

◆ reset()

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

Restore the defaults: elevation level 1, a shadow (Mode::Elevated), square corners, children in a column aligned at the start and centered across, no spacing, no padding, no fixed size, default pose.

Implements guillaume::ecs::EntityBuilder.

Definition at line 131 of file surface.cpp.

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

◆ withConfig()

Surface::Builder & guillaume::entities::Surface::Builder::withConfig ( const SurfaceConfig & config)

Replace the layout configuration: axis, alignment, spacing, padding, fixed size and corner radius.

The pose already given to the builder is kept, so call withShape() after this method, not before. The color of the configuration has no lasting effect: the fill color comes from the elevation.

Parameters
configThe configuration to copy, except its pose.
Returns
This builder, for chaining.

Definition at line 166 of file surface.cpp.

◆ withElevation()

Surface::Builder & guillaume::entities::Surface::Builder::withElevation ( theme::ElevationLevel elevation)

Set the elevation level, which tints the background and sizes the shadow.

Parameters
elevationThe level, from Level0 to Level5 (default: Level1).
Returns
This builder, for chaining.

Definition at line 148 of file surface.cpp.

Here is the caller graph for this function:

◆ withMode()

Surface::Builder & guillaume::entities::Surface::Builder::withMode ( Mode mode)

Choose whether the surface casts a shadow.

Parameters
modeElevated for a shadow, Flat for none (default: Elevated).
Returns
This builder, for chaining.

Definition at line 154 of file surface.cpp.

◆ withPose()

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

Set where the surface is.

Parameters
poseThe position and orientation (default: the default pose).
Returns
This builder, for chaining.

Definition at line 141 of file surface.cpp.

◆ withShape()

Surface::Builder & guillaume::entities::Surface::Builder::withShape ( theme::ShapeRole role)

Set the corner radius from a shape role of the theme.

Parameters
roleThe shape role, such as theme::ShapeRole::Medium (default: None, square corners).
Returns
This builder, for chaining.

Definition at line 160 of file surface.cpp.

Here is the call graph for this function:

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