|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
State of one destination of a navigation bar: an icon in a pill, a label under it and an optional badge. More...
#include <headers/guillaume/components/navigation_bar_destination.hpp>


Public Types | |
| using | PressHandler = std::function<void(void)> |
| Callback run when the user presses the destination. | |
Public Member Functions | |
| NavigationBarDestination (void)=default | |
| Create the configuration of a destination with no icon, no text and a visible label. | |
| ~NavigationBarDestination (void)=default | |
| Default destructor. | |
| const std::string & | getIcon (void) const noexcept |
| Get the icon shown while the destination is not selected. | |
| NavigationBarDestination & | setIcon (const std::string &icon) |
| Set the icon shown while the destination is not selected. | |
| const std::string & | getFocusedIcon (void) const noexcept |
| Get the icon shown while the destination is selected. | |
| NavigationBarDestination & | setFocusedIcon (const std::string &icon) |
| Set the icon shown while the destination is selected, typically the filled version of the unselected one. | |
| const std::string & | getLabel (void) const noexcept |
| Get the text shown under the icon. | |
| NavigationBarDestination & | setLabel (const std::string &label) |
| Set the text shown under the icon. | |
| const std::string & | getBadge (void) const noexcept |
| Get the text of the badge. | |
| NavigationBarDestination & | setBadge (const std::string &badge) |
| Set the text of the badge. | |
| bool | isLabelShown (void) const noexcept |
| Tell whether the label is visible. | |
| NavigationBarDestination & | setShowLabel (bool show) |
| Show or hide the label. | |
| ecs::Entity::Identifier | getIndicator (void) const noexcept |
| Get the pill drawn behind the icon of the selected destination. | |
| NavigationBarDestination & | setIndicator (ecs::Entity::Identifier identifier) |
| Record the active indicator pill child. | |
| ecs::Entity::Identifier | getIconEntity (void) const noexcept |
| Get the child that draws the icon. | |
| NavigationBarDestination & | setIconEntity (ecs::Entity::Identifier identifier) |
| Record the child that draws the icon. | |
| ecs::Entity::Identifier | getLabelEntity (void) const noexcept |
| Get the child that draws the label. | |
| NavigationBarDestination & | setLabelEntity (ecs::Entity::Identifier identifier) |
| Record the child that draws the label. | |
| ecs::Entity::Identifier | getBadgeEntity (void) const noexcept |
| Get the child that draws the badge. | |
| NavigationBarDestination & | setBadgeEntity (ecs::Entity::Identifier identifier) |
| Record the child that draws the badge. | |
| const PressHandler & | getOnPress (void) const noexcept |
| Get the callback run when the user presses the destination. | |
| NavigationBarDestination & | setOnPress (PressHandler handler) |
| Set the callback run when the user presses the destination. | |
| Public Member Functions inherited from guillaume::ecs::Component | |
| bool | hasChanged (void) const |
| Tell whether a value of the component changed since the flags were last reset (the end of the previous frame). | |
| void | setHasChanged (bool hasChanged) |
| Raise or lower the changed flag. | |
| Component (void)=default | |
| Create a component that is not marked as changed. | |
| virtual | ~Component (void)=default |
| Virtual destructor, so components can be destroyed through the base class. | |
Static Public Attributes | |
| static constexpr float | IndicatorWidth = 64.0f |
| Width of the active indicator pill, in dp. | |
| static constexpr float | IndicatorHeight = 32.0f |
| Height of the active indicator pill, in dp. | |
| static constexpr float | IconSize = 24.0f |
| Size of the icon, in dp. | |
| static constexpr float | BadgeOffsetX = 36.0f |
| static constexpr float | BadgeOffsetY = 2.0f |
| Vertical offset of the badge from the indicator origin, in dp. | |
State of one destination of a navigation bar: an icon in a pill, a label under it and an optional badge.
The entities::detail::BarDestination widget writes the glyphs, the label and the badge text, and records the identifiers of the children it builds (pill, icon, label, badge). systems::NavigationBar writes the label visibility and the press callback. systems::NavigationBarDestination reads everything in the Layout phase and turns it into the colors, the glyph and the placement of those children.
Whether the destination is selected is not stored here: it is the components::Selectable of the same entity.
Definition at line 51 of file navigation_bar_destination.hpp.
| using guillaume::components::NavigationBarDestination::PressHandler = std::function<void(void)> |
Callback run when the user presses the destination.
Definition at line 55 of file navigation_bar_destination.hpp.
|
noexcept |
Get the text of the badge.
Definition at line 75 of file navigation_bar_destination.cpp.
|
noexcept |
Get the child that draws the badge.
Definition at line 153 of file navigation_bar_destination.cpp.

|
noexcept |
Get the icon shown while the destination is selected.
Definition at line 45 of file navigation_bar_destination.cpp.
|
noexcept |
Get the icon shown while the destination is not selected.
Definition at line 29 of file navigation_bar_destination.cpp.
|
noexcept |
Get the child that draws the icon.
Definition at line 121 of file navigation_bar_destination.cpp.

|
noexcept |
Get the pill drawn behind the icon of the selected destination.
Definition at line 105 of file navigation_bar_destination.cpp.

|
noexcept |
Get the text shown under the icon.
Definition at line 60 of file navigation_bar_destination.cpp.
|
noexcept |
Get the child that draws the label.
Definition at line 137 of file navigation_bar_destination.cpp.

|
noexcept |
Get the callback run when the user presses the destination.
Definition at line 169 of file navigation_bar_destination.cpp.
|
noexcept |
Tell whether the label is visible.
Definition at line 90 of file navigation_bar_destination.cpp.
| NavigationBarDestination & guillaume::components::NavigationBarDestination::setBadge | ( | const std::string & | badge | ) |
Set the text of the badge.
systems::NavigationBarDestination shows it on the badge child, when that child exists: a large badge with the text, or a dot when the text is empty. Marks the component changed only when the text differs.
| badge | The new badge text. |
Definition at line 81 of file navigation_bar_destination.cpp.

| NavigationBarDestination & guillaume::components::NavigationBarDestination::setBadgeEntity | ( | ecs::Entity::Identifier | identifier | ) |
Record the child that draws the badge.
The widget builds it the first time the badge text is not empty. Marks the component changed only when the identifier differs.
| identifier | The child's identifier. |
Definition at line 158 of file navigation_bar_destination.cpp.

| NavigationBarDestination & guillaume::components::NavigationBarDestination::setFocusedIcon | ( | const std::string & | icon | ) |
Set the icon shown while the destination is selected, typically the filled version of the unselected one.
Marks the component changed only when the name differs.
| icon | The glyph name; empty keeps the unselected icon. |
Definition at line 51 of file navigation_bar_destination.cpp.

| NavigationBarDestination & guillaume::components::NavigationBarDestination::setIcon | ( | const std::string & | icon | ) |
Set the icon shown while the destination is not selected.
It is also the icon of a selected destination that has no focused icon. Marks the component changed only when the name differs.
| icon | The glyph name. |
Definition at line 35 of file navigation_bar_destination.cpp.

| NavigationBarDestination & guillaume::components::NavigationBarDestination::setIconEntity | ( | ecs::Entity::Identifier | identifier | ) |
Record the child that draws the icon.
Marks the component changed only when the identifier differs.
| identifier | The child's identifier. |
Definition at line 126 of file navigation_bar_destination.cpp.

| NavigationBarDestination & guillaume::components::NavigationBarDestination::setIndicator | ( | ecs::Entity::Identifier | identifier | ) |
Record the active indicator pill child.
Marks the component changed only when the identifier differs.
| identifier | The child's identifier. |
Definition at line 110 of file navigation_bar_destination.cpp.

| NavigationBarDestination & guillaume::components::NavigationBarDestination::setLabel | ( | const std::string & | label | ) |
Set the text shown under the icon.
Marks the component changed only when the text differs.
| label | The new label. |
Definition at line 66 of file navigation_bar_destination.cpp.

| NavigationBarDestination & guillaume::components::NavigationBarDestination::setLabelEntity | ( | ecs::Entity::Identifier | identifier | ) |
Record the child that draws the label.
Marks the component changed only when the identifier differs.
| identifier | The child's identifier. |
Definition at line 142 of file navigation_bar_destination.cpp.

| NavigationBarDestination & guillaume::components::NavigationBarDestination::setOnPress | ( | PressHandler | handler | ) |
Set the callback run when the user presses the destination.
Inside a navigation bar, systems::NavigationBar::install sets it to select the destination, so a callback set by hand is replaced. Does not mark the component changed.
| handler | The callback; an empty one removes it. |
Definition at line 175 of file navigation_bar_destination.cpp.
| NavigationBarDestination & guillaume::components::NavigationBarDestination::setShowLabel | ( | bool | show | ) |
Show or hide the label.
A hidden label is drawn transparent and keeps its place in the column. systems::NavigationBar overwrites this flag every frame from the bar's variant and the selection. Marks the component changed only when the flag differs.
| show | True to draw the label. |
Definition at line 95 of file navigation_bar_destination.cpp.

|
staticconstexpr |
Horizontal offset of the badge from the indicator origin, in dp, so the badge sits on the top-right corner of the icon.
Definition at line 68 of file navigation_bar_destination.hpp.
|
staticconstexpr |
Vertical offset of the badge from the indicator origin, in dp.
Definition at line 71 of file navigation_bar_destination.hpp.
|
staticconstexpr |
Size of the icon, in dp.
Definition at line 64 of file navigation_bar_destination.hpp.
|
staticconstexpr |
Height of the active indicator pill, in dp.
Definition at line 61 of file navigation_bar_destination.hpp.
|
staticconstexpr |
Width of the active indicator pill, in dp.
Definition at line 58 of file navigation_bar_destination.hpp.