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/animation.hpp"
36#include "guillaume/components/badge.hpp"
38#include "guillaume/entities/builder_base.hpp"
39#include "guillaume/entities/surface.hpp"
40#include "guillaume/entities/text.hpp"
84 class Badge:
public SurfaceBase<components::Animation, components::Badge>
99 Variant _variant { Variant::Large };
100 std::string _label {};
125 void reset(
void)
override;
161 std::shared_ptr<Badge>
162 makeBadge(std::shared_ptr<ecs::Entity> parent,
163 const std::string &label,
Variant variant);
178 template<
typename... Arguments>
179 static std::shared_ptr<Badge>
create(Arguments &&...arguments)
181 std::shared_ptr<Badge> entity(
182 new Badge(std::forward<Arguments>(arguments)...));
295 Variant variant,
const std::string &label);
Variant
Kind of badge; it sets the height and whether a label is shown.
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.
std::shared_ptr< Badge > buildEntity(void) override
Build a badge and its label from the current configuration, without registering it or giving it a par...
Builder & withLabel(const std::string &label)
Set the text shown in the badge.
Builder & withVariant(Variant variant)
Choose the size class of the badge.
Builder(ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
Construct a builder holding the defaults of reset().
void reset(void) override
Restore the defaults: default pose, the Large variant, an empty label, and a horizontal layout center...
Builder & withPose(const utility::graphic::PoseF &pose)
Set where the badge is.
std::shared_ptr< Badge > makeBadge(std::shared_ptr< ecs::Entity > parent, const std::string &label, Variant variant)
Build a badge and its label, register it under parent and reset the builder.
A small colored pill showing a count or a short label, or a plain status dot (react-native-paper Badg...
Badge & setSize(float size)
Override the height of the variant (Paper size). Resizes at once.
Badge & setLabel(const std::string &label)
Change the text shown in the badge. Restyles at once.
Badge & setContainerColor(const utility::graphic::Color32Bit &color)
Override the fill color of the pill. Restyles at once.
Badge & clearSize(void)
Drop the height override and use the height of the variant again. Resizes at once.
~Badge(void) override
Destructor.
Badge & setContentColor(const utility::graphic::Color32Bit &color)
Override the color of the label. Restyles at once.
float getOpacity(void) const
Get the current opacity of the fade.
Badge & setVariant(Variant variant)
Change the size class of the badge. Resizes at once.
Variant getVariant(void) const
Get the size class of the badge.
components::Badge::Variant Variant
static std::shared_ptr< Badge > create(Arguments &&...arguments)
Build a badge without registering it in an entity registry.
bool isVisible(void) const
Get the visibility the badge is fading to.
float getSize(void) const
Get the height the badge is drawn with.
Badge & setVisible(bool visible)
Show or hide the badge with a 150 ms fade (Paper visible).
EntityBuilderBase(ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
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...