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

Everything needed to set up a surface in one value: where it is, how it looks and how it arranges its children. More...

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

Public Member Functions

SurfaceConfig & setPose (const utility::graphic::PoseF &value)
 Set where the surface is.
SurfaceConfig & setColor (const utility::graphic::Color32Bit &value)
 Set the fill color.
SurfaceConfig & setBorderRadius (float value)
 Set the radius of the four corners.
SurfaceConfig & setAxis (components::Layout::Axis value)
 Choose between a row and a column.
SurfaceConfig & setMainAxisAlignment (components::Layout::MainAxisAlignment value)
 Set where the children go along the axis.
SurfaceConfig & setCrossAxisAlignment (components::Layout::CrossAxisAlignment value)
 Set where the children go across the axis.
SurfaceConfig & setSpacing (float value)
 Set the gap between two consecutive children.
SurfaceConfig & setPadding (float value)
 Set the gap between the edges of the surface and its children.
SurfaceConfig & setFixedWidth (float value)
 Give the surface a width that does not depend on its children.
SurfaceConfig & setFixedHeight (float value)
 Give the surface a height that does not depend on its children.

Static Public Member Functions

static SurfaceConfig panel (float width, components::Layout::Axis axis, float spacing)
 Get the configuration shared by dialog and picker panels.

Public Attributes

utility::graphic::PoseF pose {}
 Position and orientation of the surface.
utility::graphic::Color32Bit color
 Fill color (transparent by default).
float borderRadius { 0.0f }
 Radius of the four corners, in dp.
components::Layout::Axis axis
 Direction the children are arranged in.
components::Layout::MainAxisAlignment mainAxisAlignment
 Where the children go along the axis.
components::Layout::CrossAxisAlignment crossAxisAlignment
 Where the children go across the axis.
float spacing { 0.0f }
 Gap between two children, in dp.
float padding
 Gap between the edges and the children, in dp.
bool hasFixedWidth
 True when fixedWidth replaces the content width.
float fixedWidth
 Width in dp, used only when hasFixedWidth.
bool hasFixedHeight
 True when fixedHeight replaces the content height.
float fixedHeight
 Height in dp, used only when hasFixedHeight.

Detailed Description

Everything needed to set up a surface in one value: where it is, how it looks and how it arranges its children.

A surface is a rectangle that contains other widgets. This struct is a plain value used to pass its settings around: SurfaceBase copies each field into the matching component (Transform, Color, Borders, Layout) and keeps no copy. Every widget constructor that derives from SurfaceBase takes one.

The setters return the configuration, so a value can be written in one expression:

auto config = SurfaceConfig()
.setSpacing(8.0f)
.setPadding(16.0f)
.setFixedWidth(320.0f);
@ Vertical
Column: children placed top to bottom.
Definition layout.hpp:76
Everything needed to set up a surface in one value: where it is, how it looks and how it arranges its...
Definition surface.hpp:71
SurfaceConfig & setAxis(components::Layout::Axis value)
Choose between a row and a column.
Definition surface.cpp:48
SurfaceConfig & setPadding(float value)
Set the gap between the edges of the surface and its children.
Definition surface.cpp:74
SurfaceConfig & setFixedWidth(float value)
Give the surface a width that does not depend on its children.
Definition surface.cpp:80
SurfaceConfig & setSpacing(float value)
Set the gap between two consecutive children.
Definition surface.cpp:68

Without a fixed width or height, the surface takes the size of its children plus the padding on both sides.

See also
SurfaceBase, components::Layout, systems::Layout

Definition at line 71 of file surface.hpp.

Member Function Documentation

◆ panel()

SurfaceConfig guillaume::entities::SurfaceConfig::panel ( float width,
components::Layout::Axis axis,
float spacing )
static

Get the configuration shared by dialog and picker panels.

The result has a fixed width, 24 dp of padding, the extra-large corner radius of the active theme (28 dp by default) and children centered on both axes. The color is left transparent and the height follows the content: the caller sets what differs.

Parameters
widthThe panel width, in dp.
axisThe direction the children are arranged in.
spacingThe gap between two children, in dp.
Returns
The panel configuration.

Definition at line 94 of file surface.cpp.

Here is the call graph for this function:

◆ setAxis()

SurfaceConfig & guillaume::entities::SurfaceConfig::setAxis ( components::Layout::Axis value)

Choose between a row and a column.

Parameters
valueHorizontal to arrange the children left to right, Vertical to arrange them top to bottom.
Returns
This configuration, for chaining.

Definition at line 48 of file surface.cpp.

◆ setBorderRadius()

SurfaceConfig & guillaume::entities::SurfaceConfig::setBorderRadius ( float value)

Set the radius of the four corners.

Parameters
valueThe radius, in dp. 0 gives square corners.
Returns
This configuration, for chaining.

Definition at line 42 of file surface.cpp.

◆ setColor()

SurfaceConfig & guillaume::entities::SurfaceConfig::setColor ( const utility::graphic::Color32Bit & value)

Set the fill color.

Parameters
valueThe color painted behind the children.
Returns
This configuration, for chaining.

Definition at line 36 of file surface.cpp.

◆ setCrossAxisAlignment()

SurfaceConfig & guillaume::entities::SurfaceConfig::setCrossAxisAlignment ( components::Layout::CrossAxisAlignment value)

Set where the children go across the axis.

Parameters
valueStart, Center or End.
Returns
This configuration, for chaining.

Definition at line 61 of file surface.cpp.

◆ setFixedHeight()

SurfaceConfig & guillaume::entities::SurfaceConfig::setFixedHeight ( float value)

Give the surface a height that does not depend on its children.

Sets both fixedHeight and hasFixedHeight.

Parameters
valueThe height, in dp.
Returns
This configuration, for chaining.

Definition at line 87 of file surface.cpp.

◆ setFixedWidth()

SurfaceConfig & guillaume::entities::SurfaceConfig::setFixedWidth ( float value)

Give the surface a width that does not depend on its children.

Sets both fixedWidth and hasFixedWidth.

Parameters
valueThe width, in dp.
Returns
This configuration, for chaining.

Definition at line 80 of file surface.cpp.

◆ setMainAxisAlignment()

SurfaceConfig & guillaume::entities::SurfaceConfig::setMainAxisAlignment ( components::Layout::MainAxisAlignment value)

Set where the children go along the axis.

Parameters
valueStart, Center, End or SpaceBetween.
Returns
This configuration, for chaining.

Definition at line 54 of file surface.cpp.

◆ setPadding()

SurfaceConfig & guillaume::entities::SurfaceConfig::setPadding ( float value)

Set the gap between the edges of the surface and its children.

Parameters
valueThe gap, in dp, applied on the four sides.
Returns
This configuration, for chaining.

Definition at line 74 of file surface.cpp.

◆ setPose()

SurfaceConfig & guillaume::entities::SurfaceConfig::setPose ( const utility::graphic::PoseF & value)

Set where the surface is.

Parameters
valueThe position and orientation of the surface.
Returns
This configuration, for chaining.

Definition at line 29 of file surface.cpp.

◆ setSpacing()

SurfaceConfig & guillaume::entities::SurfaceConfig::setSpacing ( float value)

Set the gap between two consecutive children.

Parameters
valueThe gap, in dp.
Returns
This configuration, for chaining.

Definition at line 68 of file surface.cpp.

Member Data Documentation

◆ axis

components::Layout::Axis guillaume::entities::SurfaceConfig::axis
Initial value:
{
}
@ Horizontal
Row: children placed left to right.
Definition layout.hpp:75

Direction the children are arranged in.

Definition at line 78 of file surface.hpp.

◆ borderRadius

float guillaume::entities::SurfaceConfig::borderRadius { 0.0f }

Radius of the four corners, in dp.

Definition at line 77 of file surface.hpp.

◆ color

utility::graphic::Color32Bit guillaume::entities::SurfaceConfig::color
Initial value:
{
0, 0, 0, 0
}

Fill color (transparent by default).

Definition at line 74 of file surface.hpp.

◆ crossAxisAlignment

components::Layout::CrossAxisAlignment guillaume::entities::SurfaceConfig::crossAxisAlignment
Initial value:

Where the children go across the axis.

Definition at line 84 of file surface.hpp.

◆ fixedHeight

float guillaume::entities::SurfaceConfig::fixedHeight
Initial value:
{
0.0f
}

Height in dp, used only when hasFixedHeight.

Definition at line 100 of file surface.hpp.

◆ fixedWidth

float guillaume::entities::SurfaceConfig::fixedWidth
Initial value:
{
0.0f
}

Width in dp, used only when hasFixedWidth.

Definition at line 94 of file surface.hpp.

◆ hasFixedHeight

bool guillaume::entities::SurfaceConfig::hasFixedHeight
Initial value:
{
false
}

True when fixedHeight replaces the content height.

Definition at line 97 of file surface.hpp.

◆ hasFixedWidth

bool guillaume::entities::SurfaceConfig::hasFixedWidth
Initial value:
{
false
}

True when fixedWidth replaces the content width.

Definition at line 91 of file surface.hpp.

◆ mainAxisAlignment

components::Layout::MainAxisAlignment guillaume::entities::SurfaceConfig::mainAxisAlignment
Initial value:

Where the children go along the axis.

Definition at line 81 of file surface.hpp.

◆ padding

float guillaume::entities::SurfaceConfig::padding
Initial value:
{
0.0f
}

Gap between the edges and the children, in dp.

Definition at line 88 of file surface.hpp.

◆ pose

utility::graphic::PoseF guillaume::entities::SurfaceConfig::pose {}

Position and orientation of the surface.

Definition at line 73 of file surface.hpp.

◆ spacing

float guillaume::entities::SurfaceConfig::spacing { 0.0f }

Gap between two children, in dp.

Definition at line 87 of file surface.hpp.


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