23#include "guillaume/components/progress_indicator.hpp"
35 if (_variant != variant) {
61 if (_trackLength != length) {
62 _trackLength = length;
75 if (_diameter != diameter) {
90 if (_track != identifier) {
105 if (_fill != identifier) {
119 if (_built != built) {
133 if (_displayed != displayed) {
134 _displayed = displayed;
147 if (_valueFrom != value) {
161 if (_visible != visible) {
175 if (_opacity != opacity) {
189 if (_opacityFrom != opacity) {
190 _opacityFrom = opacity;
203 if (_cycle != cycle) {
210 const std::optional<utility::graphic::Color32Bit> &
213 return _indicatorColor;
217 const std::optional<utility::graphic::Color32Bit> &color)
219 if (_indicatorColor != color) {
220 _indicatorColor = color;
State of a progress indicator: a bar or a ring that fills up with a value from 0 to 1,...
float getDiameter(void) const noexcept
Get the diameter of the circular variants.
ProgressIndicator & setIndicatorColor(const std::optional< utility::graphic::Color32Bit > &color)
Choose the color of the fill.
ProgressIndicator & setDisplayed(float displayed)
Store the value currently drawn.
bool isCircular(void) const noexcept
Tell whether the indicator is a ring.
float getValueFrom(void) const noexcept
Get the value that was drawn when the running transition began.
bool isVisible(void) const noexcept
Tell whether the indicator is meant to be visible.
float getOpacity(void) const noexcept
Get the opacity the indicator is drawn with.
ProgressIndicator & setOpacity(float opacity)
Store the opacity the indicator is drawn with.
ProgressIndicator & setTrackLength(float length)
Set the length of the track of the linear variants.
ProgressIndicator & setDiameter(float diameter)
Set the diameter of the circular variants.
ProgressIndicator(void)=default
Create the state of a visible linear determinate indicator with the default sizes and no child.
const std::optional< utility::graphic::Color32Bit > & getIndicatorColor(void) const noexcept
Get the color chosen for the fill.
ProgressIndicator & setVariant(Variant variant)
Set the shape of the indicator and whether it shows a value.
ProgressIndicator & setOpacityFrom(float opacity)
Store the opacity at the start of a fade.
ProgressIndicator & setCycle(float cycle)
Store how far the loop of an indeterminate variant has advanced.
ProgressIndicator & setBuilt(bool built)
Record whether the track and fill children match the current variant.
Variant
Shape of the indicator and whether it shows a value.
@ CircularDeterminate
Ring filled up to the value.
Variant getVariant(void) const noexcept
Get the shape of the indicator and whether it shows a value.
float getTrackLength(void) const noexcept
Get the length of the track of the linear variants.
float getCycle(void) const noexcept
Get how far the loop of an indeterminate variant has advanced.
ecs::Entity::Identifier getTrack(void) const noexcept
Get the child that draws the track: the full bar or ring behind the fill.
bool isIndeterminate(void) const noexcept
Tell whether the indicator loops instead of showing a value.
ProgressIndicator & setVisible(bool visible)
Record whether the indicator is meant to be visible.
ProgressIndicator & setFill(ecs::Entity::Identifier identifier)
Record the child that draws the fill.
ProgressIndicator & setTrack(ecs::Entity::Identifier identifier)
Record the child that draws the track.
float getOpacityFrom(void) const noexcept
Get the opacity the indicator had when the running fade began.
float getDisplayed(void) const noexcept
Get the value currently drawn.
bool isBuilt(void) const noexcept
Tell whether the track and fill children match the current variant.
ProgressIndicator & setValueFrom(float value)
Store the value drawn at the start of a transition.
ecs::Entity::Identifier getFill(void) const noexcept
Get the child that draws the fill: the part of the bar or ring that shows the progress.
void setHasChanged(bool hasChanged)
Raise or lower the changed flag.
std::size_t Identifier
The key under which an entity's components are stored. Systems and components refer to entities by th...
State. Every class here is plain data attached to an entity.