|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
Look of a Material 3 floating action button (FAB): color variant, size and shadow. More...
#include <headers/guillaume/components/floating_action_button.hpp>


Public Types | |
| enum class | Variant { Surface , Primary , Secondary , Tertiary } |
| Which theme colors fill the container and the icon. More... | |
| enum class | Mode { Elevated , Flat } |
| Whether the button casts a shadow (Elevated) or not (Flat). More... | |
| enum class | Size { Small , Medium , Large } |
| Size step: a 40, 56 or 96 dp square container around a 24, 24 or 36 dp icon. More... | |
Public Member Functions | |
| FloatingActionButton (void)=default | |
| Create the configuration of a medium, elevated, primary FAB. | |
| ~FloatingActionButton (void)=default | |
| Default destructor. | |
| Variant | getVariant (void) const noexcept |
| Get the color variant. | |
| FloatingActionButton & | setVariant (Variant variant) |
| Choose which theme colors the button uses. | |
| Size | getSize (void) const noexcept |
| Get the size step. | |
| FloatingActionButton & | setSize (Size size) |
| Choose the size step. | |
| Mode | getMode (void) const noexcept |
| Get the shadow mode. | |
| FloatingActionButton & | setMode (Mode mode) |
| Choose whether the button casts a shadow. | |
| const std::optional< float > & | getCustomSize (void) const noexcept |
| Get the container size that replaces the one of the size step. | |
| FloatingActionButton & | setCustomSize (const std::optional< float > &size) |
| Replace the container size of the size step. | |
| bool | isLowered (void) const noexcept |
| Check whether the resting shadow is lowered. | |
| FloatingActionButton & | setLowered (bool lowered) |
| Lower the resting shadow, or restore it. | |
| 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. | |
Look of a Material 3 floating action button (FAB): color variant, size and shadow.
It sits on the same entity as components::Button, which holds the glyph and the interaction state. entities::FloatingActionButton writes it; systems::FloatingActionButton reads both, each frame in the Layout phase and at once after every input change, and writes the button's Color, Elevation, Borders and Bound and centers the icon child.
Hiding the button is done on components::Button (Button::setVisible(false)): the system then draws it transparent and without shadow.
Every setter compares before writing and marks the component changed only when the value differs.
Definition at line 53 of file floating_action_button.hpp.
|
strong |
Whether the button casts a shadow (Elevated) or not (Flat).
Definition at line 68 of file floating_action_button.hpp.
|
strong |
Size step: a 40, 56 or 96 dp square container around a 24, 24 or 36 dp icon.
Definition at line 74 of file floating_action_button.hpp.
|
strong |
Which theme colors fill the container and the icon.
Primary, Secondary and Tertiary use the matching container role. Surface uses the tonal surface color of the button's elevation with a primary icon.
Definition at line 63 of file floating_action_button.hpp.
|
noexcept |
Get the container size that replaces the one of the size step.
Definition at line 75 of file floating_action_button.cpp.
|
noexcept |
Get the shadow mode.
Definition at line 60 of file floating_action_button.cpp.
|
noexcept |
Get the size step.
Definition at line 45 of file floating_action_button.cpp.
|
noexcept |
Get the color variant.
Definition at line 30 of file floating_action_button.cpp.
|
noexcept |
Check whether the resting shadow is lowered.
Definition at line 90 of file floating_action_button.cpp.
| FloatingActionButton & guillaume::components::FloatingActionButton::setCustomSize | ( | const std::optional< float > & | size | ) |
Replace the container size of the size step.
The corner radius follows: it is the custom size divided by 3.5. The icon keeps the font size of the size step.
| size | The extent of the square container, in dp, or std::nullopt to follow the size step. |
Definition at line 81 of file floating_action_button.cpp.

| FloatingActionButton & guillaume::components::FloatingActionButton::setLowered | ( | bool | lowered | ) |
Lower the resting shadow, or restore it.
An elevated button rests at elevation level 3, or level 1 when lowered. The Surface variant takes the surface tone of the same level.
| lowered | True to rest at elevation level 1. |
Definition at line 95 of file floating_action_button.cpp.

| FloatingActionButton & guillaume::components::FloatingActionButton::setMode | ( | Mode | mode | ) |
Choose whether the button casts a shadow.
| mode | Elevated for a shadow that rises one level on hover, Flat for no shadow at all. |
Definition at line 65 of file floating_action_button.cpp.

| FloatingActionButton & guillaume::components::FloatingActionButton::setSize | ( | Size | size | ) |
Choose the size step.
| size | The size; it sets the container extent, the corner radius and the icon font size. |
Definition at line 50 of file floating_action_button.cpp.

| FloatingActionButton & guillaume::components::FloatingActionButton::setVariant | ( | Variant | variant | ) |
Choose which theme colors the button uses.
| variant | The color variant. |
Definition at line 35 of file floating_action_button.cpp.
