29#include <utility/graphic/color.hpp>
30#include <utility/graphic/pose.hpp>
32#include "guillaume/ecs/component_registry.hpp"
33#include "guillaume/ecs/entity_builder.hpp"
35#include "guillaume/components/accessibility.hpp"
36#include "guillaume/components/animation.hpp"
37#include "guillaume/components/progress_indicator.hpp"
38#include "guillaume/components/value.hpp"
40#include "guillaume/entities/builder_base.hpp"
41#include "guillaume/entities/surface.hpp"
104 class ProgressIndicator:
105 public SurfaceBase<components::Value, components::Animation,
106 components::Accessibility,
107 components::ProgressIndicator>
122 Variant _variant { Variant::LinearDeterminate };
123 float _value { 0.0f };
124 float _width { 200.0f };
125 float _size { 48.0f };
144 std::shared_ptr<ProgressIndicator>
buildEntity(
void)
override;
150 void reset(
void)
override;
204 std::shared_ptr<ProgressIndicator>
224 template<
typename... Arguments>
225 static std::shared_ptr<ProgressIndicator>
228 std::shared_ptr<ProgressIndicator> entity(
229 new ProgressIndicator(std::forward<Arguments>(arguments)...));
336 void buildChildren(
void);
static constexpr float IndeterminateSegment
Variant
Shape of the indicator and whether it shows a value.
Stores every component of a scene, per component type and per entity identifier, and knows which ones...
Owns entities and gives the systems the list of entities to visit.
EntityBuilderBase(ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
std::shared_ptr< ProgressIndicator > makeProgressIndicator(std::shared_ptr< ecs::Entity > parent, Variant variant, float value)
Build a progress indicator, register it under parent and reset the builder.
Builder & withValue(float value)
Set the progress the indicator starts with.
Builder & withWidth(float width)
Set the length of the bar of the linear variants.
Builder & withSize(float size)
Set the diameter of the ring of the circular variants.
Builder(ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
Create a builder set to the defaults of reset().
Builder & withPose(const utility::graphic::PoseF &pose)
Set the pose the indicator is created with.
Builder & withVariant(Variant variant)
Set the indicator variant.
std::shared_ptr< ProgressIndicator > buildEntity(void) override
Build a progress indicator and its track and fill children from the current configuration,...
void reset(void) override
Restore the defaults: LinearDeterminate variant, value 0, a 200 dp long bar, a 48 dp wide ring and a ...
A bar or a ring that fills up to show how far a task has progressed, or that loops when the progress ...
Variant getVariant(void) const
Get the indicator variant.
ProgressIndicator & setVariant(Variant variant)
Change the indicator variant.
ProgressIndicator & setVisible(bool visible)
Show or hide the indicator with a 200 ms fade (Paper visible).
bool isVisible(void) const
Check whether the indicator is meant to be visible.
ProgressIndicator & setValue(float value)
Set the progress.
float getOpacity(void) const
Get the opacity of the fade.
float getValue(void) const
Get the progress last set.
static constexpr float IndeterminateSegment
Length of the sliding segment of the LinearIndeterminate variant, as a fraction of the bar length: 0....
components::ProgressIndicator::Variant Variant
static std::shared_ptr< ProgressIndicator > create(Arguments &&...arguments)
Create a progress indicator and its track and fill children, without registering it in an entity regi...
ProgressIndicator & setIndicatorColor(const utility::graphic::Color32Bit &color)
Set the color of the fill. Redraws at once.
utility::graphic::Color32Bit getIndicatorColor(void) const
Get the color of the fill.
float getDisplayedValue(void) const
Get the progress drawn at the moment.
~ProgressIndicator(void) override
Default destructor.
SurfaceBase(ecs::ComponentRegistry ®istry, const SurfaceConfig &config)
Widgets: the classes used to create entities with the right components and children.
Everything needed to set up a surface in one value: where it is, how it looks and how it arranges its...