A small colored pill showing a count or a short label, or a plain status dot (react-native-paper Badge).
More...
|
| | ~Badge (void) override |
| | Destructor.
|
| 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.
|
| Badge & | setLabel (const std::string &label) |
| | Change the text shown in the badge. Restyles at once.
|
| Badge & | setSize (float size) |
| | Override the height of the variant (Paper size). Resizes at once.
|
| Badge & | clearSize (void) |
| | Drop the height override and use the height of the variant again. Resizes at once.
|
| float | getSize (void) const |
| | Get the height the badge is drawn with.
|
| Badge & | setContainerColor (const utility::graphic::Color32Bit &color) |
| | Override the fill color of the pill. Restyles at once.
|
| Badge & | setContentColor (const utility::graphic::Color32Bit &color) |
| | Override the color of the label. Restyles at once.
|
| Badge & | setVisible (bool visible) |
| | Show or hide the badge with a 150 ms fade (Paper visible).
|
| bool | isVisible (void) const |
| | Get the visibility the badge is fading to.
|
| float | getOpacity (void) const |
| | Get the current opacity of the fade.
|
|
| ~SurfaceBase (void) override=default |
| | Default destructor.
|
| SurfaceBase & | setPose (const utility::graphic::PoseF &pose) |
| | Move the surface.
|
| SurfaceBase & | setColor (const utility::graphic::Color32Bit &color) |
| | Set the fill color (Color component).
|
| SurfaceBase & | setBorderRadius (float radius) |
| | Set the radius of the four corners (Borders component).
|
| SurfaceBase & | setSurfaceConfig (const SurfaceConfig &config) |
| | Apply every field of a configuration at once.
|
| SurfaceConfig | getSurfaceConfig (void) const |
| | Read the current configuration back from the components.
|
| SurfaceBase & | setChildren (const Children &children) |
| | Choose the children this surface arranges, in order.
|
| std::vector< ecs::Entity::Identifier > | getChildren (void) const |
| | Get the children this surface arranges.
|
| | ParentEntityFiller (ComponentRegistry &componentRegistry) |
| | Create the entity, its listed components and its components::Hierarchy. It owns no child yet.
|
|
virtual | ~ParentEntityFiller (void)=default |
| | Destroy the entity object and release the children it owns; components stay in the registry (see EntityRegistry::removeEntity).
|
| | Entity (void) |
| | Create an entity with a fresh identifier, an empty signature, no parent and no component.
|
| virtual | ~Entity (void)=default |
| | Destroy the entity object.
|
| Entity::Identifier | getIdentifier (void) const noexcept |
| | Get the identifier of the entity.
|
| Entity::Signature | getSignature (void) const noexcept |
| | Get the set of component types the entity declares.
|
| void | setSignature (const Signature &signature) |
| | Replace the signature of the entity.
|
| std::int32_t | getLayer (void) const noexcept |
| | Get the depth of the entity in the tree.
|
| Entity & | setParent (std::shared_ptr< Entity > parent) |
| | Attach the entity under another one, or detach it.
|
| std::vector< Identifier > | releaseComponents (void) |
| | Drop the entity's place in the tree and all its components.
|
| std::shared_ptr< Entity > | getParent (void) const noexcept |
| | Get the parent entity.
|
|
| EntityRegistry (void)=default |
| | Create a registry.
|
| virtual | ~EntityRegistry (void)=default |
| | Virtual destructor.
|
| void | addEntity (std::shared_ptr< Entity > entity) |
| | Make this registry own an entity, so that it stays alive and systems visit it.
|
| bool | removeEntity (Entity::Identifier identifier) |
| | Remove an entity, with its children and all their components.
|
| void | clearEntities (void) |
| | Remove every entity owned by this registry, with everything they own and all their components.
|
| const std::vector< std::shared_ptr< Entity > > & | getEntities (void) const |
| | Get the entities this registry owns directly.
|
| std::vector< std::shared_ptr< Entity > > | getEntitiesBreadthFirst (void) |
| | List every entity of this registry and of the registries nested in it, level by level.
|
| std::vector< std::shared_ptr< Entity > > | getEntitiesBreadthFirst (void) const |
| | List every entity of this registry and of the registries nested in it, level by level (const overload).
|
| template<InheritFromEntity EntityType> |
| std::shared_ptr< EntityType > | getEntity (Entity::Identifier identifier) |
| | Find an entity owned directly by this registry, by identifier.
|
| template<InheritFromEntity EntityType> |
| std::shared_ptr< const EntityType > | getEntity (Entity::Identifier identifier) const |
| | Find an entity owned directly by this registry, by identifier (const overload).
|
| std::vector< Entity::Identifier > | getEntityWithSignature (Entity::Signature systemSignature) const |
| | List the entities that have every component type of a signature, from the root down.
|
| std::vector< Entity::Identifier > | getEntityWithSignature (Entity::Signature systemSignature, const EntityTreeTraveler &traveler) const |
| | List the entities that have every component type of a signature, in the order chosen by a traveler.
|
A small colored pill showing a count or a short label, or a plain status dot (react-native-paper Badge).
Its state lives in components::Badge (variant, label, size and color overrides, visibility and fade opacity); systems::Badge sizes and colors the pill and styles its label each frame, in the Layout phase. components::Animation drives the 150 ms fade played when the visibility changes. The class itself holds no field: its setters write the component and restyle at once. The label is a Text child owned by the badge.
auto badge = builder.makeBadge(parent, "3", Badge::Variant::Large);
badge->setLabel("4");
badge->setVisible(false);
ComponentRegistry & getComponentRegistry(void)
Configures Badge widgets and registers them in the scene's entity registry.
Badge::create(registry, config, variant, label) builds the same widget, label included, without registering it in an entity registry.
Watch out:
- The label child is created only at construction, and only when the variant is not Dot and the label is not empty. A badge built without it never shows text: setLabel() and setVariant() update an existing label child but do not create one.
- The height is the size of the variant (6, 16 or 20 dp) or the override of setSize(). The width is the height, or more when the label is wider: the label width plus 3 dp on each side.
- systems::Badge overwrites the fill color, the corner radius, the padding, the spacing and the fixed size every frame. Use setContainerColor() and setSize(); SurfaceBase::setColor() and SurfaceBase::setBorderRadius() do not last.
- The default colors are the Error and OnError roles of the active theme.
- See also
- components::Badge, systems::Badge, SurfaceBase
Definition at line 84 of file badge.hpp.