29#include "guillaume/ecs/component.hpp"
30#include "guillaume/ecs/entity.hpp"
64 enum class Variant { Small, CenterAligned, Medium, Large, Bottom };
88 Variant _variant { Variant::Small };
89 std::string _title {};
90 Action _navigation {};
91 std::vector<Action> _actions {};
92 bool _elevated {
false };
135 const std::string &
getTitle(
void)
const noexcept;
168 const std::vector<Action> &
getActions(
void)
const noexcept;
ecs::Entity::Identifier getNavigationButton(void) const noexcept
Get the icon button child built for the navigation action.
Variant getVariant(void) const noexcept
Get the shape of the bar.
AppBar & setTitleEntity(ecs::Entity::Identifier identifier)
Record the text child that displays the title.
AppBar(void)=default
Create the configuration of a small, flat bar with no title and no icon.
AppBar & setVariant(Variant variant)
Set the shape of the bar, which decides its height and the size of its title.
bool isElevated(void) const noexcept
Tell whether the bar is elevated.
AppBar & setElevated(bool elevated)
Raise or flatten the bar.
ecs::Entity::Identifier getTitleEntity(void) const noexcept
Get the text child that displays the title.
~AppBar(void)=default
Default destructor.
const Identifiers & getActionButtons(void) const noexcept
Get the icon button children built for the trailing actions.
std::vector< ecs::Entity::Identifier > Identifiers
Identifiers of child entities, in display order.
AppBar & setNavigationButton(ecs::Entity::Identifier identifier)
Record the icon button child built for the navigation action.
const std::string & getTitle(void) const noexcept
Get the title shown in the bar.
AppBar & setActionButtons(const Identifiers &identifiers)
Record the icon button children built for the trailing actions.
Variant
Shape of the bar. It sets the height and the title size.
AppBar & setTitle(const std::string &title)
Set the title shown in the bar.
AppBar & setNavigation(Action navigation)
Set the leading navigation action.
AppBar & setActions(std::vector< Action > actions)
Replace the trailing actions.
const Action & getNavigation(void) const noexcept
Get the leading navigation action (back arrow, menu icon).
static constexpr float HorizontalPadding
Padding on each side of the bar and gap between its children, in dp.
const std::vector< Action > & getActions(void) const noexcept
Get the trailing actions.
Base class of every component: a piece of state attached to an entity, plus a "changed" flag.
std::size_t Identifier
The key under which an entity's components are stored. Systems and components refer to entities by th...
static constexpr Identifier InvalidIdentifier
"No entity": never the identifier of a real entity
State. Every class here is plain data attached to an entity.
One pressable icon of the bar: the leading navigation icon or a trailing action.
bool disabled
True when the icon ignores input.
std::function< void(void)> onPress
Called on press.
std::string accessibilityLabel
std::string icon
Icon glyph name; empty means no icon.