|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
One destination of a NavigationBar: a pressable column with an active-indicator pill around the icon, a label under it and an optional badge on the icon. More...
#include <headers/guillaume/entities/navigation_bar_destination.hpp>


Public Member Functions | |
| ~BarDestination (void) override=default | |
| Default destructor. | |
| void | setOnPress (std::function< void(void)> onPress) |
| Set the handler called when the user presses the destination. | |
| void | setBadge (const std::string &badge) |
| Change the badge label. | |
| void | setShowLabel (bool show) |
| Show or hide the label. Restyles at once. | |
| void | setOnSelectionChanged (const components::Selectable::Handler &handler) |
| Set the handler of the destination's components::Selectable. | |
| bool | isSelected (void) const |
| Whether the destination is the selected one of its bar. | |
| ecs::Entity::Identifier | getIndicatorIdentifier (void) const |
| Get the active-indicator pill: the rounded shape behind the icon. | |
| ecs::Entity::Identifier | getIconIdentifier (void) const |
| Get the icon entity. | |
| ecs::Entity::Identifier | getLabelIdentifier (void) const |
| Get the label entity. | |
| ecs::Entity::Identifier | getBadgeIdentifier (void) const |
| Get the badge entity. | |
| Public Member Functions inherited from guillaume::ecs::ParentEntityFiller< components::Layout, components::Transform, components::Bound, components::Color, components::Borders, components::Selectable, components::NavigationBarDestination > | |
| 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). | |
| Public Member Functions inherited from guillaume::ecs::Entity | |
| 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. | |
| Public Member Functions inherited from guillaume::ecs::EntityRegistry | |
| 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. | |
Static Public Member Functions | |
| template<typename... Arguments> | |
| static std::shared_ptr< BarDestination > | create (Arguments &&...arguments) |
| Create a destination and its children, without registering it in an entity registry or setting its parent. | |
| Static Public Member Functions inherited from guillaume::ecs::Entity | |
| template<InheritFromComponent... ComponentTypes> | |
| static Signature | getSignatureFromTypes (void) |
| Build the signature that has exactly the bits of the given component types. | |
Additional Inherited Members | |
| Public Types inherited from guillaume::ecs::Entity | |
| using | Identifier = std::size_t |
| The key under which an entity's components are stored. Systems and components refer to entities by this value. | |
| using | Signature = std::bitset<128> |
| A set of component types, one bit per type (bit position given by ComponentTypeId, MaxComponentTypes bits). | |
| Static Public Attributes inherited from guillaume::ecs::Entity | |
| static constexpr Identifier | InvalidIdentifier |
| "No entity": never the identifier of a real entity | |
| Protected Member Functions inherited from guillaume::ecs::ParentEntityFiller< components::Layout, components::Transform, components::Bound, components::Color, components::Borders, components::Selectable, components::NavigationBarDestination > | |
| ComponentRegistry & | getComponentRegistry (void) |
| Get the registry that stores this entity's components. | |
| Protected Member Functions inherited from guillaume::ecs::ParentEntity | |
| std::vector< std::shared_ptr< Entity > > & | accessDirectEntities (void) override |
| Give access to the list of entities this entity owns directly. | |
| const std::vector< std::shared_ptr< Entity > > & | accessDirectEntities (void) const override |
| Give read access to the list of entities this entity owns directly. | |
| Protected Member Functions inherited from guillaume::ecs::Entity | |
| void | attachHierarchy (ComponentRegistry &componentRegistry) |
| Give the entity a components::Hierarchy in a registry and add that component to its signature. | |
| template<InheritFromComponent... ComponentTypes> | |
| void | setSignature (void) |
| Replace the signature by the one made of the given component types. | |
One destination of a NavigationBar: a pressable column with an active-indicator pill around the icon, a label under it and an optional badge on the icon.
Internal to NavigationBar, which creates one per destination with BarDestination::create(registry, spec) and adds it to itself; applications use the NavigationBar methods instead. Its state lives in components::NavigationBarDestination (icon, focused icon, label, badge, child identifiers, press handler) and its selection in components::Selectable; systems::NavigationBarDestination styles it for its selection and places its children each frame, in the Layout phase. The class itself holds no field.
The destination is the entity registry that owns the pill and the label; the pill owns the icon and the badge. systems::NavigationBar overwrites the size of the destination, whether it shows its label, its press handler and its selection-change handler.
Definition at line 70 of file navigation_bar_destination.hpp.
|
inlinestatic |
Create a destination and its children, without registering it in an entity registry or setting its parent.
The constructor is private because the children need the destination to be owned by a shared pointer before they can take it as parent; create() constructs it, then builds the pill, the icon, the label and the badge.
| Arguments | The types of the constructor arguments. |
| arguments | Forwarded to the private constructor: (registry, spec). |
Definition at line 92 of file navigation_bar_destination.hpp.
| ecs::Entity::Identifier guillaume::entities::detail::BarDestination::getBadgeIdentifier | ( | void | ) | const |
Get the badge entity.
Definition at line 210 of file navigation_bar_destination.cpp.
| ecs::Entity::Identifier guillaume::entities::detail::BarDestination::getIconIdentifier | ( | void | ) | const |
Get the icon entity.
Definition at line 196 of file navigation_bar_destination.cpp.
| ecs::Entity::Identifier guillaume::entities::detail::BarDestination::getIndicatorIdentifier | ( | void | ) | const |
Get the active-indicator pill: the rounded shape behind the icon.
Definition at line 189 of file navigation_bar_destination.cpp.
| ecs::Entity::Identifier guillaume::entities::detail::BarDestination::getLabelIdentifier | ( | void | ) | const |
Get the label entity.
Definition at line 203 of file navigation_bar_destination.cpp.
| bool guillaume::entities::detail::BarDestination::isSelected | ( | void | ) | const |
Whether the destination is the selected one of its bar.
Definition at line 183 of file navigation_bar_destination.cpp.
| void guillaume::entities::detail::BarDestination::setBadge | ( | const std::string & | badge | ) |
Change the badge label.
Builds the badge child the first time the label is not empty, then restyles at once.
| badge | The badge label. An empty label builds no badge, and turns an existing badge into a dot. |
Definition at line 155 of file navigation_bar_destination.cpp.
| void guillaume::entities::detail::BarDestination::setOnPress | ( | std::function< void(void)> | onPress | ) |
Set the handler called when the user presses the destination.
systems::NavigationBar::install sets this handler on every destination of a bar; setting another one replaces it.
| onPress | The handler; an empty function for none. |
Definition at line 148 of file navigation_bar_destination.cpp.
| void guillaume::entities::detail::BarDestination::setOnSelectionChanged | ( | const components::Selectable::Handler & | handler | ) |
Set the handler of the destination's components::Selectable.
systems::NavigationBar::install sets this handler on every destination of a bar; setting another one replaces it.
| handler | Called with the new state when the destination becomes selected or deselected. |
Definition at line 175 of file navigation_bar_destination.cpp.
| void guillaume::entities::detail::BarDestination::setShowLabel | ( | bool | show | ) |
Show or hide the label. Restyles at once.
A hidden label keeps its place in the column.
| show | True to show the label. |
Definition at line 166 of file navigation_bar_destination.cpp.