27#include <utility/graphic/color.hpp>
29#include "guillaume/ecs/component.hpp"
30#include "guillaume/ecs/entity.hpp"
205 bool isBuilt(
void)
const noexcept;
312 float getCycle(
void)
const noexcept;
332 const std::optional<utility::graphic::Color32Bit> &
344 const std::optional<utility::graphic::Color32Bit> &color);
358 bool _built {
false };
359 float _displayed { 0.0f };
360 float _valueFrom { 0.0f };
361 bool _visible {
true };
362 float _opacity { 1.0f };
363 float _opacityFrom { 1.0f };
364 float _cycle { 0.0f };
365 std::optional<utility::graphic::Color32Bit>
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.
static constexpr float DefaultTrackLength
Default length of the linear track, in dp.
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.
static constexpr float IndeterminateSweep
static constexpr float LinearHeight
Thickness of the linear track, in dp.
static constexpr float DefaultDiameter
Default diameter of the circular variants, in dp.
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.
static constexpr float IndeterminateSegment
static constexpr float RingThickness
Stroke width of the circular track and fill, in dp.
~ProgressIndicator(void)=default
Default destructor.
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.
@ LinearDeterminate
Bar filled up to the 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.
Base class of every component: a piece of state attached to an entity, plus a "changed" flag.
std::size_t Identifier
The key under which an entity's components are stored. Systems and components refer to entities by th...
static constexpr Identifier InvalidIdentifier
"No entity": never the identifier of a real entity
State. Every class here is plain data attached to an entity.