27#include <utility/graphic/color.hpp>
29#include "guillaume/ecs/component.hpp"
30#include "guillaume/ecs/entity.hpp"
93 std::string _label {};
98 std::optional<float> _size {};
99 std::optional<utility::graphic::Color32Bit>
101 std::optional<utility::graphic::Color32Bit>
103 bool _visible {
true };
104 float _opacity { 1.0f };
105 float _fadeFrom { 1.0f };
136 const std::string &
getLabel(
void)
const noexcept;
169 const std::optional<float> &
getSize(
void)
const noexcept;
185 const std::optional<utility::graphic::Color32Bit> &
195 std::optional<utility::graphic::Color32Bit> color);
201 const std::optional<utility::graphic::Color32Bit> &
static constexpr float SmallSize
Height of the Small variant, in dp.
Badge & setVisible(bool visible)
Store the visibility the fade heads to.
~Badge(void)=default
Default destructor.
Badge & setLabelEntity(ecs::Entity::Identifier identifier)
Record which child entity draws the label.
const std::string & getLabel(void) const noexcept
Get the label text.
Variant
Kind of badge; it sets the height and whether a label is shown.
@ Small
16 dp high badge with a label.
@ Large
20 dp high badge with a label (the default).
@ Dot
6 dp dot without label.
ecs::Entity::Identifier getLabelEntity(void) const noexcept
Get the child entity that draws the label.
Badge & setSize(std::optional< float > size)
Replace the height of the variant.
Badge(void)=default
Create the state of a visible Large badge with no label.
const std::optional< utility::graphic::Color32Bit > & getContentColor(void) const noexcept
Get the color that replaces the themed label color.
Badge & setVariant(Variant variant)
Choose the kind of badge.
Badge & setFadeFrom(float opacity)
Record the opacity a fade starts from.
Badge & setOpacity(float opacity)
Set the opacity the badge is drawn with.
bool isVisible(void) const noexcept
Check whether the badge is shown or fading in.
const std::optional< float > & getSize(void) const noexcept
Get the height that replaces the one of the variant.
Badge & setContentColor(std::optional< utility::graphic::Color32Bit > color)
Replace the themed label color.
float getOpacity(void) const noexcept
Get the opacity the badge is drawn with.
static constexpr float LargeSize
Height of the Large variant, in dp.
Badge & setLabel(const std::string &label)
Set the label text.
static constexpr float LabelScale
Label font size as a fraction of the badge height.
static constexpr float DotSize
Height of the Dot variant, in dp.
Variant getVariant(void) const noexcept
Get the kind of badge.
static constexpr float HorizontalPadding
Space on each side of the label, in dp.
float getFadeFrom(void) const noexcept
Get the opacity the running fade started from.
Badge & setContainerColor(std::optional< utility::graphic::Color32Bit > color)
Replace the themed container (background) color.
const std::optional< utility::graphic::Color32Bit > & getContainerColor(void) const noexcept
Get the color that replaces the themed container color.
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.