23#include "guillaume/components/navigation_drawer_destination.hpp"
53 if (_label != label) {
69 if (_right != right) {
84 if (_disabled != disabled) {
99 if (_collapsed != collapsed) {
100 _collapsed = collapsed;
115 if (_lead != identifier) {
131 if (_iconEntity != identifier) {
132 _iconEntity = identifier;
147 if (_labelEntity != identifier) {
148 _labelEntity = identifier;
163 if (_rightEntity != identifier) {
164 _rightEntity = identifier;
179 _onPress = std::move(handler);
State of one destination of a navigation drawer: an icon, a label and an optional text at the trailin...
ecs::Entity::Identifier getLead(void) const noexcept
Get the leading child of the destination.
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.
const PressHandler & getOnPress(void) const noexcept
Get the callback run when the user presses the destination.
NavigationDrawerDestination & setIcon(const std::string &icon)
Set the icon of the destination.
NavigationDrawerDestination & setDisabled(bool disabled)
Disable or enable the destination.
NavigationDrawerDestination(void)=default
Create the configuration of an enabled, regular destination with no icon and no text.
const std::string & getLabel(void) const noexcept
Get 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 & setOnPress(PressHandler handler)
Set the callback run when the user presses the destination while it is enabled.
NavigationDrawerDestination & setRightEntity(ecs::Entity::Identifier identifier)
Record the child that draws the trailing text.
NavigationDrawerDestination & setLabel(const std::string &label)
Set the label of the destination.
NavigationDrawerDestination & setCollapsed(bool collapsed)
Choose between the regular row and the collapsed (rail) rendering.
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.
std::function< void(void)> PressHandler
Callback run when the user presses the destination.
ecs::Entity::Identifier getIconEntity(void) const noexcept
Get the child that draws the icon.
NavigationDrawerDestination & setLead(ecs::Entity::Identifier identifier)
Record the leading child of the destination.
bool isDisabled(void) const noexcept
Tell whether the destination ignores presses.
const std::string & getIcon(void) const noexcept
Get the icon of the destination.
bool isCollapsed(void) const noexcept
Tell which rendering the destination uses.
NavigationDrawerDestination & setRight(const std::string &right)
Set the text shown at the trailing edge of a regular item, such as an unread count.
void setHasChanged(bool hasChanged)
Raise or lower the changed flag.
std::size_t Identifier
The key under which an entity's components are stored. Systems and components refer to entities by th...
State. Every class here is plain data attached to an entity.