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/loading_indicator.hpp"
39#include "guillaume/entities/builder_base.hpp"
40#include "guillaume/entities/surface.hpp"
90 class LoadingIndicator:
91 public SurfaceBase<components::Animation, components::Accessibility,
92 components::LoadingIndicator>
107 Variant _variant { Variant::Circular };
108 float _size { 48.0f };
127 std::shared_ptr<LoadingIndicator>
buildEntity(
void)
override;
133 void reset(
void)
override;
169 std::shared_ptr<LoadingIndicator>
188 template<
typename... Arguments>
static std::shared_ptr<LoadingIndicator>
191 std::shared_ptr<LoadingIndicator> entity(
192 new LoadingIndicator(std::forward<Arguments>(arguments)...));
318 void buildChild(
void);
Variant
Shape of the indicator.
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)
void reset(void) override
Restore the defaults: Circular variant, a 48 dp diameter and a default pose.
std::shared_ptr< LoadingIndicator > makeLoadingIndicator(std::shared_ptr< ecs::Entity > parent, Variant variant)
Build a loading indicator, register it under parent and reset the builder.
Builder(ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
Create a builder set to the defaults of reset().
Builder & withVariant(Variant variant)
Set the indicator variant.
Builder & withPose(const utility::graphic::PoseF &pose)
Set the pose the indicator is created with.
std::shared_ptr< LoadingIndicator > buildEntity(void) override
Build a loading indicator and its animated child from the current configuration, without registering ...
Builder & withSize(float size)
Set the diameter of the Circular variant.
An animation that loops for as long as work is in progress: a rotating arc or a sliding bar,...
float getSize(void) const
Get the diameter of the Circular variant.
float getStrokeWidth(void) const
Get the thickness of the arc of the Circular variant.
Variant getVariant(void) const
Get the indicator variant.
utility::graphic::Color32Bit getIndicatorColor(void) const
Get the color of the arc or bar.
float getOpacity(void) const
Get the opacity of the fade.
static std::shared_ptr< LoadingIndicator > create(Arguments &&...arguments)
Create a loading indicator and its animated child, without registering it in an entity registry.
LoadingIndicator & stop(void)
Stop the looping animation.
LoadingIndicator & start(void)
Start the looping animation and fade the indicator in over 200 ms.
components::LoadingIndicator::Variant Variant
LoadingIndicator & setIndicatorColor(const utility::graphic::Color32Bit &color)
Set the color of the arc or bar. Redraws at once.
LoadingIndicator & setSize(float size)
Set the diameter of the Circular variant (Paper size).
~LoadingIndicator(void) override
Default destructor.
bool hidesWhenStopped(void) const
Check whether a stopped indicator is hidden.
LoadingIndicator & setVariant(Variant variant)
Change the indicator variant.
bool isRunning(void) const
Check whether the looping animation is playing.
LoadingIndicator & setHidesWhenStopped(bool hides)
Choose whether a stopped indicator is hidden (Paper hidesWhenStopped).
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...