23#include "guillaume/components/navigation_bar_destination.hpp"
53 if (_focusedIcon != icon) {
68 if (_label != label) {
83 if (_badge != badge) {
97 if (_showLabel != show) {
113 if (_indicator != identifier) {
114 _indicator = identifier;
129 if (_iconEntity != identifier) {
130 _iconEntity = identifier;
145 if (_labelEntity != identifier) {
146 _labelEntity = identifier;
161 if (_badgeEntity != identifier) {
162 _badgeEntity = identifier;
177 _onPress = std::move(handler);
State of one destination of a navigation bar: an icon in a pill, a label under it and an optional bad...
NavigationBarDestination & setLabelEntity(ecs::Entity::Identifier identifier)
Record the child that draws the label.
NavigationBarDestination & setBadge(const std::string &badge)
Set the text of the badge.
ecs::Entity::Identifier getIndicator(void) const noexcept
Get the pill drawn behind the icon of the selected destination.
NavigationBarDestination & setOnPress(PressHandler handler)
Set the callback run when the user presses the destination.
const PressHandler & getOnPress(void) const noexcept
Get the callback run when the user presses the destination.
NavigationBarDestination & setLabel(const std::string &label)
Set the text shown under the icon.
NavigationBarDestination(void)=default
Create the configuration of a destination with no icon, no text and a visible label.
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.
NavigationBarDestination & setIconEntity(ecs::Entity::Identifier identifier)
Record the child that draws the icon.
NavigationBarDestination & setIcon(const std::string &icon)
Set the icon shown while the destination is not selected.
const std::string & getLabel(void) const noexcept
Get the text shown under the icon.
NavigationBarDestination & setBadgeEntity(ecs::Entity::Identifier identifier)
Record the child that draws the badge.
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 ...
ecs::Entity::Identifier getBadgeEntity(void) const noexcept
Get the child that draws the badge.
NavigationBarDestination & setShowLabel(bool show)
Show or hide the label.
NavigationBarDestination & setIndicator(ecs::Entity::Identifier identifier)
Record the active indicator pill child.
const std::string & getIcon(void) const noexcept
Get the icon shown while the destination is not selected.
ecs::Entity::Identifier getLabelEntity(void) const noexcept
Get the child that draws the label.
const std::string & getBadge(void) const noexcept
Get the text of the badge.
bool isLabelShown(void) const noexcept
Tell whether the label is visible.
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.