|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
Look of a Material 3 common button: color style, corner shape, size and padding options. More...
#include <headers/guillaume/components/common_button.hpp>


Classes | |
| struct | Corners |
| Radius of each corner, for a button joined to its neighbours (a segment of a segmented button). More... | |
Public Types | |
| enum class | Color { Elevated , Filled , Tonal , Outlined , Text , Segmented } |
| Which theme colors fill the container, the content and the outline. More... | |
| enum class | Shape { Round , Square } |
| Corner shape at rest: fully rounded (Round) or the rounded rectangle of the size (Square). More... | |
| enum class | Size { ExtraSmall , Small , Medium , Large , ExtraLarge } |
| Size step. It sets the padding, the icon size, the gap between icon and label and the corner radius; the label always uses the label-large type role. More... | |
Public Member Functions | |
| CommonButton (void)=default | |
| Create the configuration of a small, round text button. | |
| ~CommonButton (void)=default | |
| Default destructor. | |
| Color | getColorStyle (void) const noexcept |
| Get the color style. | |
| CommonButton & | setColorStyle (Color style) |
| Choose which theme colors the button uses. | |
| Shape | getShape (void) const noexcept |
| Get the corner shape at rest. | |
| CommonButton & | setShape (Shape shape) |
| Choose the corner shape at rest. | |
| Size | getSize (void) const noexcept |
| Get the size step. | |
| CommonButton & | setSize (Size size) |
| Choose the size step. | |
| bool | isCompact (void) const noexcept |
| Check whether the horizontal padding is halved. | |
| CommonButton & | setCompact (bool compact) |
| Halve the horizontal padding, or restore it. | |
| float | getMinWidth (void) const noexcept |
| Get the requested minimum width. | |
| CommonButton & | setMinWidth (float width) |
| Request a minimum container width. | |
| bool | isUppercase (void) const noexcept |
| Check whether the label is drawn in upper case. | |
| CommonButton & | setUppercase (bool uppercase) |
| Draw the label in upper case, or as written. | |
| const std::optional< Corners > & | getCorners (void) const noexcept |
| Get the per-corner radius override. | |
| CommonButton & | setCorners (const std::optional< Corners > &corners) |
| Override the radius of each corner. | |
| Public Member Functions inherited from guillaume::ecs::Component | |
| bool | hasChanged (void) const |
| Tell whether a value of the component changed since the flags were last reset (the end of the previous frame). | |
| void | setHasChanged (bool hasChanged) |
| Raise or lower the changed flag. | |
| Component (void)=default | |
| Create a component that is not marked as changed. | |
| virtual | ~Component (void)=default |
| Virtual destructor, so components can be destroyed through the base class. | |
Static Public Attributes | |
| static constexpr float | MinWidth = 64.0f |
| Minimum width of the container, in dp. | |
| static constexpr float | MinHeight = 40.0f |
Look of a Material 3 common button: color style, corner shape, size and padding options.
It sits on the same entity as components::Button, which holds the content and the interaction state. entities::Button writes it; systems::CommonButton reads both, each frame in the Layout phase and at once after every input change, and writes the button's Color, Borders, Elevation and Bound and the pose of its icon and label.
Every setter compares before writing and marks the component changed only when the value differs.
Definition at line 55 of file common_button.hpp.
|
strong |
Which theme colors fill the container, the content and the outline.
Elevated, Filled and Tonal have a filled container; Outlined has a transparent container and an outline; Text has neither. Segmented is the style of one segment of a segmented button: outlined, and filled while selected without losing its outline.
Definition at line 67 of file common_button.hpp.
|
strong |
Corner shape at rest: fully rounded (Round) or the rounded rectangle of the size (Square).
Definition at line 73 of file common_button.hpp.
|
strong |
Size step. It sets the padding, the icon size, the gap between icon and label and the corner radius; the label always uses the label-large type role.
Definition at line 80 of file common_button.hpp.
|
noexcept |
Get the color style.
Definition at line 29 of file common_button.cpp.
|
noexcept |
Get the per-corner radius override.
Definition at line 114 of file common_button.cpp.
|
noexcept |
Get the requested minimum width.
Definition at line 85 of file common_button.cpp.
|
noexcept |
Get the corner shape at rest.
Definition at line 43 of file common_button.cpp.
|
noexcept |
Get the size step.
Definition at line 57 of file common_button.cpp.
|
noexcept |
Check whether the horizontal padding is halved.
Definition at line 71 of file common_button.cpp.
|
noexcept |
Check whether the label is drawn in upper case.
Definition at line 99 of file common_button.cpp.
| CommonButton & guillaume::components::CommonButton::setColorStyle | ( | Color | style | ) |
Choose which theme colors the button uses.
| style | The color style. |
Definition at line 34 of file common_button.cpp.

| CommonButton & guillaume::components::CommonButton::setCompact | ( | bool | compact | ) |
Halve the horizontal padding, or restore it.
| compact | True for half the horizontal padding of the size. |
Definition at line 76 of file common_button.cpp.

| CommonButton & guillaume::components::CommonButton::setCorners | ( | const std::optional< Corners > & | corners | ) |
Override the radius of each corner.
systems::SegmentedButton sets it on each segment so that only the outer corners of the group are rounded.
| corners | The corners, or std::nullopt to let the shape decide. |
Definition at line 120 of file common_button.cpp.

| CommonButton & guillaume::components::CommonButton::setMinWidth | ( | float | width | ) |
Request a minimum container width.
The container is as wide as the largest of its padded content, MinWidth and this value.
| width | The minimum width, in dp. |
Definition at line 90 of file common_button.cpp.

| CommonButton & guillaume::components::CommonButton::setShape | ( | Shape | shape | ) |
Choose the corner shape at rest.
While pressed the button takes the pressed radius of its size whatever the shape, and a selected toggle with Button::setMorph(true) draws the opposite shape.
| shape | Round or Square. |
Definition at line 48 of file common_button.cpp.

| CommonButton & guillaume::components::CommonButton::setSize | ( | Size | size | ) |
Choose the size step.
| size | The size; it drives padding, icon size and radius. |
Definition at line 62 of file common_button.cpp.

| CommonButton & guillaume::components::CommonButton::setUppercase | ( | bool | uppercase | ) |
Draw the label in upper case, or as written.
The text stored in components::Button is left as written; only the label child receives the upper-cased copy.
| uppercase | True to upper-case the label. |
Definition at line 104 of file common_button.cpp.

|
staticconstexpr |
Minimum height of the container, in dp. ExtraSmall buttons are exempt.
Definition at line 87 of file common_button.hpp.
|
staticconstexpr |
Minimum width of the container, in dp.
Definition at line 83 of file common_button.hpp.