|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
State of a loading indicator: an arc that turns, or a bar that slides, in a loop while something is in progress. More...
#include <headers/guillaume/components/loading_indicator.hpp>


Public Types | |
| enum class | Variant { Linear , Circular } |
| Shape of the indicator. More... | |
Public Member Functions | |
| LoadingIndicator (void)=default | |
| Create the state of a circular indicator of the default size, with no child, that hides when stopped. | |
| ~LoadingIndicator (void)=default | |
| Default destructor. | |
| Variant | getVariant (void) const noexcept |
| Get the shape of the indicator. | |
| LoadingIndicator & | setVariant (Variant variant) |
| Set the shape of the indicator. | |
| float | getSize (void) const noexcept |
| Get the diameter of the circular variant. | |
| LoadingIndicator & | setSize (float size) |
| Set the diameter of the circular variant. | |
| ecs::Entity::Identifier | getIndicator (void) const noexcept |
| Get the child that draws the turning arc or the sliding bar. | |
| LoadingIndicator & | setIndicator (ecs::Entity::Identifier identifier) |
| Record the child that draws the turning arc or the sliding bar. | |
| bool | isBuilt (void) const noexcept |
| Tell whether the animated child matches the current variant. | |
| LoadingIndicator & | setBuilt (bool built) |
| Record whether the animated child matches the current variant. | |
| float | getProgress (void) const noexcept |
| Get how far the loop has advanced. | |
| LoadingIndicator & | setProgress (float progress) |
| Store how far the loop has advanced. | |
| bool | hidesWhenStopped (void) const noexcept |
| Tell whether the indicator fades out when it is stopped. | |
| LoadingIndicator & | setHidesWhenStopped (bool hides) |
| Choose whether the indicator fades out when it is stopped. | |
| float | getOpacity (void) const noexcept |
| Get the opacity the indicator is drawn with. | |
| LoadingIndicator & | setOpacity (float opacity) |
| Store the opacity the indicator is drawn with. | |
| float | getOpacityFrom (void) const noexcept |
| Get the opacity the indicator had when the running fade began. | |
| LoadingIndicator & | setOpacityFrom (float opacity) |
| Store the opacity at the start of a fade. | |
| float | getOpacityTarget (void) const noexcept |
| Get the opacity the running fade ends at. | |
| LoadingIndicator & | setOpacityTarget (float opacity) |
| Store the opacity a fade ends at. | |
| const std::optional< utility::graphic::Color32Bit > & | getIndicatorColor (void) const noexcept |
| Get the color chosen for the indicator. | |
| LoadingIndicator & | setIndicatorColor (const std::optional< utility::graphic::Color32Bit > &color) |
| Choose the color of the indicator. | |
| 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 | LinearWidth = 200.0f |
| Length of the linear variant, in dp. | |
| static constexpr float | LinearHeight = 4.0f |
| Thickness of the linear variant, in dp. | |
| static constexpr float | LinearSegment = 0.4f |
| static constexpr float | DefaultSize = 48.0f |
| Default diameter of the circular variant, in dp. | |
| static constexpr float | StrokeRatio = 4.0f / 48.0f |
State of a loading indicator: an arc that turns, or a bar that slides, in a loop while something is in progress.
It holds two kinds of state. The configuration (variant, diameter, color, whether it hides when stopped) and the identifier of the animated child are written by the entities::LoadingIndicator widget. The running state (loop progress, fade opacity) is written by systems::LoadingIndicator from the animations it installs. In the Layout phase, systems::LoadingIndicator turns all of it into the size of the widget and the geometry and color of the child.
Whether the indicator runs is not stored here: it is whether the looping components::Animation of the child plays. Use systems::LoadingIndicator::start and systems::LoadingIndicator::stop.
Definition at line 54 of file loading_indicator.hpp.
|
strong |
Shape of the indicator.
| Enumerator | |
|---|---|
| Linear | Bar that slides along a 200 dp line. |
| Circular | Arc that turns around a circle. |
Definition at line 60 of file loading_indicator.hpp.
|
noexcept |
Get the child that draws the turning arc or the sliding bar.
Definition at line 55 of file loading_indicator.cpp.
|
noexcept |
Get the color chosen for the indicator.
Definition at line 155 of file loading_indicator.cpp.
|
noexcept |
Get the opacity the indicator is drawn with.
Definition at line 112 of file loading_indicator.cpp.
|
noexcept |
Get the opacity the indicator had when the running fade began.
Definition at line 126 of file loading_indicator.cpp.
|
noexcept |
Get the opacity the running fade ends at.
Definition at line 140 of file loading_indicator.cpp.
|
noexcept |
Get how far the loop has advanced.
Definition at line 84 of file loading_indicator.cpp.
|
noexcept |
Get the diameter of the circular variant.
Definition at line 41 of file loading_indicator.cpp.
|
noexcept |
Get the shape of the indicator.
Definition at line 27 of file loading_indicator.cpp.
|
noexcept |
Tell whether the indicator fades out when it is stopped.
Definition at line 98 of file loading_indicator.cpp.
|
noexcept |
Tell whether the animated child matches the current variant.
Definition at line 70 of file loading_indicator.cpp.
| LoadingIndicator & guillaume::components::LoadingIndicator::setBuilt | ( | bool | built | ) |
Record whether the animated child matches the current variant.
The widget lowers the flag when it changes the variant and raises it once it has rebuilt the child. Marks the component changed only when the flag differs.
| built | True when the child is up to date. |
Definition at line 75 of file loading_indicator.cpp.


| LoadingIndicator & guillaume::components::LoadingIndicator::setHidesWhenStopped | ( | bool | hides | ) |
Choose whether the indicator fades out when it is stopped.
The choice is applied the next time the indicator starts or stops. Marks the component changed only when the flag differs.
| hides | True to hide a stopped indicator. |
Definition at line 103 of file loading_indicator.cpp.

| LoadingIndicator & guillaume::components::LoadingIndicator::setIndicator | ( | ecs::Entity::Identifier | identifier | ) |
Record the child that draws the turning arc or the sliding bar.
Marks the component changed only when the identifier differs.
| identifier | The child's identifier. |
Definition at line 61 of file loading_indicator.cpp.

| LoadingIndicator & guillaume::components::LoadingIndicator::setIndicatorColor | ( | const std::optional< utility::graphic::Color32Bit > & | color | ) |
Choose the color of the indicator.
Marks the component changed only when the value differs.
| color | The color, or std::nullopt to use the theme's Primary color. |
Definition at line 160 of file loading_indicator.cpp.

| LoadingIndicator & guillaume::components::LoadingIndicator::setOpacity | ( | float | opacity | ) |
Store the opacity the indicator is drawn with.
Running state written by systems::LoadingIndicator on every sample of the fade. Marks the component changed only when the value differs.
| opacity | The opacity, 0 to 1. |
Definition at line 117 of file loading_indicator.cpp.


| LoadingIndicator & guillaume::components::LoadingIndicator::setOpacityFrom | ( | float | opacity | ) |
Store the opacity at the start of a fade.
Marks the component changed only when the value differs.
| opacity | The starting opacity, 0 to 1. |
Definition at line 131 of file loading_indicator.cpp.

| LoadingIndicator & guillaume::components::LoadingIndicator::setOpacityTarget | ( | float | opacity | ) |
Store the opacity a fade ends at.
Written by systems::LoadingIndicator when the indicator starts or stops. Marks the component changed only when the value differs.
| opacity | The final opacity, 0 to 1. |
Definition at line 145 of file loading_indicator.cpp.

| LoadingIndicator & guillaume::components::LoadingIndicator::setProgress | ( | float | progress | ) |
Store how far the loop has advanced.
Running state written by the looping animation of the child. It sets the start angle of the arc or the position of the bar. Marks the component changed only when the value differs.
| progress | The eased progress of the current loop, 0 to 1. |
Definition at line 89 of file loading_indicator.cpp.

| LoadingIndicator & guillaume::components::LoadingIndicator::setSize | ( | float | size | ) |
Set the diameter of the circular variant.
The stroke width follows it (StrokeRatio). The linear variant ignores it. Marks the component changed only when the value differs.
| size | The new diameter, in dp. |
Definition at line 46 of file loading_indicator.cpp.


| LoadingIndicator & guillaume::components::LoadingIndicator::setVariant | ( | Variant | variant | ) |
Set the shape of the indicator.
The child depends on the variant; this setter does not rebuild it, the widget does. Marks the component changed only when the variant differs.
| variant | The new variant. |
Definition at line 32 of file loading_indicator.cpp.


|
staticconstexpr |
Default diameter of the circular variant, in dp.
Definition at line 76 of file loading_indicator.hpp.
|
staticconstexpr |
Thickness of the linear variant, in dp.
Definition at line 69 of file loading_indicator.hpp.
|
staticconstexpr |
Length of the sliding bar, as a fraction of the linear length (0 to 1).
Definition at line 73 of file loading_indicator.hpp.
|
staticconstexpr |
Length of the linear variant, in dp.
Definition at line 66 of file loading_indicator.hpp.
|
staticconstexpr |
Stroke width of the arc, as a fraction of the diameter: 4 dp for a 48 dp indicator.
Definition at line 80 of file loading_indicator.hpp.