|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
State of one destination of a navigation drawer: an icon, a label and an optional text at the trailing edge. More...
#include <headers/guillaume/components/navigation_drawer_destination.hpp>


Public Types | |
| using | PressHandler = std::function<void(void)> |
| Callback run when the user presses the destination. | |
Public Member Functions | |
| NavigationDrawerDestination (void)=default | |
| Create the configuration of an enabled, regular destination with no icon and no text. | |
| ~NavigationDrawerDestination (void)=default | |
| Default destructor. | |
| const std::string & | getIcon (void) const noexcept |
| Get the icon of the destination. | |
| NavigationDrawerDestination & | setIcon (const std::string &icon) |
| Set the icon of the destination. | |
| const std::string & | getLabel (void) const noexcept |
| Get the label of the destination. | |
| NavigationDrawerDestination & | setLabel (const std::string &label) |
| Set the label of the destination. | |
| const std::string & | getRight (void) const noexcept |
| Get the text shown at the trailing edge of a regular item. | |
| NavigationDrawerDestination & | setRight (const std::string &right) |
| Set the text shown at the trailing edge of a regular item, such as an unread count. | |
| bool | isDisabled (void) const noexcept |
| Tell whether the destination ignores presses. | |
| NavigationDrawerDestination & | setDisabled (bool disabled) |
| Disable or enable the destination. | |
| bool | isCollapsed (void) const noexcept |
| Tell which rendering the destination uses. | |
| NavigationDrawerDestination & | setCollapsed (bool collapsed) |
| Choose between the regular row and the collapsed (rail) rendering. | |
| ecs::Entity::Identifier | getLead (void) const noexcept |
| Get the leading child of the destination. | |
| NavigationDrawerDestination & | setLead (ecs::Entity::Identifier identifier) |
| Record the leading child of the destination. | |
| ecs::Entity::Identifier | getIconEntity (void) const noexcept |
| Get the child that draws the icon. | |
| NavigationDrawerDestination & | 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. | |
| NavigationDrawerDestination & | setLabelEntity (ecs::Entity::Identifier identifier) |
| Record the child that draws the label. | |
| ecs::Entity::Identifier | getRightEntity (void) const noexcept |
| Get the child that draws the trailing text. | |
| NavigationDrawerDestination & | setRightEntity (ecs::Entity::Identifier identifier) |
| Record the child that draws the trailing text. | |
| const PressHandler & | getOnPress (void) const noexcept |
| Get the callback run when the user presses the destination. | |
| NavigationDrawerDestination & | setOnPress (PressHandler handler) |
| Set the callback run when the user presses the destination while it is enabled. | |
| 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 | Height = 56.0f |
| Height of a regular destination, in dp. | |
| static constexpr float | CollapsedIndicatorWidth = 56.0f |
| Width of the active indicator pill of a collapsed item, in dp. | |
| static constexpr float | CollapsedIndicatorHeight = 32.0f |
| Height of the active indicator pill of a collapsed item, in dp. | |
| static constexpr float | IconSize = 24.0f |
| Size of the icon, in dp. | |
State of one destination of a navigation drawer: an icon, a label and an optional text at the trailing edge.
It has two renderings. A regular item is a 56 dp row whose whole surface is the active pill. A collapsed item (the rail of a collapsed drawer) stacks a small pill holding the icon above the label.
The entities::detail::DrawerDestination widget writes the content and the identifiers of the children it builds. systems::NavigationDrawerDestination reads everything in the Layout phase and turns it into the pill color, the content colors 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 54 of file navigation_drawer_destination.hpp.
| using guillaume::components::NavigationDrawerDestination::PressHandler = std::function<void(void)> |
Callback run when the user presses the destination.
Definition at line 58 of file navigation_drawer_destination.hpp.
|
noexcept |
Get the icon of the destination.
Definition at line 29 of file navigation_drawer_destination.cpp.
|
noexcept |
Get the child that draws the icon.
Definition at line 123 of file navigation_drawer_destination.cpp.
|
noexcept |
Get the label of the destination.
Definition at line 45 of file navigation_drawer_destination.cpp.
|
noexcept |
Get the child that draws the label.
Definition at line 139 of file navigation_drawer_destination.cpp.
|
noexcept |
Get the leading child of the destination.
Definition at line 107 of file navigation_drawer_destination.cpp.

|
noexcept |
Get the callback run when the user presses the destination.
Definition at line 171 of file navigation_drawer_destination.cpp.
|
noexcept |
Get the text shown at the trailing edge of a regular item.
Definition at line 61 of file navigation_drawer_destination.cpp.
|
noexcept |
Get the child that draws the trailing text.
Definition at line 155 of file navigation_drawer_destination.cpp.
|
noexcept |
Tell which rendering the destination uses.
Definition at line 91 of file navigation_drawer_destination.cpp.

|
noexcept |
Tell whether the destination ignores presses.
Definition at line 76 of file navigation_drawer_destination.cpp.
| NavigationDrawerDestination & guillaume::components::NavigationDrawerDestination::setCollapsed | ( | bool | collapsed | ) |
Choose between the regular row and the collapsed (rail) rendering.
Marks the component changed only when the flag differs.
| collapsed | True for a collapsed item. |
Definition at line 97 of file navigation_drawer_destination.cpp.

| NavigationDrawerDestination & guillaume::components::NavigationDrawerDestination::setDisabled | ( | bool | disabled | ) |
Disable or enable the destination.
A disabled destination is drawn with the disabled content color, shows no active pill and does not run its press callback. systems::NavigationDrawerDestination copies the flag to the entity's components::StyleState. Marks the component changed only when the flag differs.
| disabled | True to disable the destination. |
Definition at line 82 of file navigation_drawer_destination.cpp.

| NavigationDrawerDestination & guillaume::components::NavigationDrawerDestination::setIcon | ( | const std::string & | icon | ) |
Set the icon of the destination.
Marks the component changed only when the name differs.
| icon | The glyph name. |
Definition at line 35 of file navigation_drawer_destination.cpp.

| NavigationDrawerDestination & guillaume::components::NavigationDrawerDestination::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 128 of file navigation_drawer_destination.cpp.

| NavigationDrawerDestination & guillaume::components::NavigationDrawerDestination::setLabel | ( | const std::string & | label | ) |
Set the label of the destination.
Marks the component changed only when the text differs.
| label | The new label. |
Definition at line 51 of file navigation_drawer_destination.cpp.

| NavigationDrawerDestination & guillaume::components::NavigationDrawerDestination::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 144 of file navigation_drawer_destination.cpp.

| NavigationDrawerDestination & guillaume::components::NavigationDrawerDestination::setLead | ( | ecs::Entity::Identifier | identifier | ) |
Record the leading child of the destination.
Marks the component changed only when the identifier differs.
| identifier | The identifier of the icon-and-label group (regular item) or of the pill (collapsed item). |
Definition at line 113 of file navigation_drawer_destination.cpp.

| NavigationDrawerDestination & guillaume::components::NavigationDrawerDestination::setOnPress | ( | PressHandler | handler | ) |
Set the callback run when the user presses the destination while it is enabled.
Inside a navigation drawer, systems::NavigationDrawer::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 177 of file navigation_drawer_destination.cpp.
| NavigationDrawerDestination & guillaume::components::NavigationDrawerDestination::setRight | ( | const std::string & | right | ) |
Set the text shown at the trailing edge of a regular item, such as an unread count.
When it is not empty, the row spreads its content so this text reaches the far edge. Marks the component changed only when the text differs.
| right | The new text; empty for none. |
Definition at line 67 of file navigation_drawer_destination.cpp.

| NavigationDrawerDestination & guillaume::components::NavigationDrawerDestination::setRightEntity | ( | ecs::Entity::Identifier | identifier | ) |
Record the child that draws the trailing text.
Marks the component changed only when the identifier differs.
| identifier | The child's identifier. |
Definition at line 160 of file navigation_drawer_destination.cpp.

|
staticconstexpr |
Height of the active indicator pill of a collapsed item, in dp.
Definition at line 67 of file navigation_drawer_destination.hpp.
|
staticconstexpr |
Width of the active indicator pill of a collapsed item, in dp.
Definition at line 64 of file navigation_drawer_destination.hpp.
|
staticconstexpr |
Height of a regular destination, in dp.
Definition at line 61 of file navigation_drawer_destination.hpp.
|
staticconstexpr |
Size of the icon, in dp.
Definition at line 70 of file navigation_drawer_destination.hpp.