30#include "guillaume/ecs/component.hpp"
31#include "guillaume/ecs/entity.hpp"
108 static constexpr float Width = 320.0f;
118 std::vector<Entry> _entries {};
119 std::vector<ecs::Entity::Identifier>
121 std::vector<ecs::Entity::Identifier>
122 _destinationEntities {};
123 std::vector<ecs::Entity::Identifier>
125 std::vector<ecs::Entity::Identifier>
132 bool _updatingSelection {
false };
165 const std::vector<Entry> &
getEntries(
void)
const noexcept;
202 const std::vector<ecs::Entity::Identifier> &
213 const std::vector<ecs::Entity::Identifier> &identifiers);
219 const std::vector<ecs::Entity::Identifier> &
230 const std::vector<ecs::Entity::Identifier> &identifiers);
237 const std::vector<ecs::Entity::Identifier> &
249 const std::vector<ecs::Entity::Identifier> &identifiers);
255 const std::vector<ecs::Entity::Identifier> &
266 const std::vector<ecs::Entity::Identifier> &identifiers);
State of a divider: a thin horizontal line separating content.
Variant
How the drawer is presented.
@ Modal
that dims the content and closes it on a click.
@ Standard
Sheet docked beside the content, on surface.
const std::vector< ecs::Entity::Identifier > & getSectionEntities(void) const noexcept
Get the section header children.
static constexpr float Width
Width of a standard or modal drawer, in dp.
NavigationDrawer & setBackdrop(ecs::Entity::Identifier identifier)
Record the child that dims the content behind a modal drawer.
NavigationDrawer & setVariant(Variant variant)
Choose how the drawer is presented.
static constexpr float CollapsedWidth
Width of a collapsed drawer (rail), in dp.
NavigationDrawer & setDestinationDisabled(std::size_t index, bool disabled)
Change the disabled flag recorded for one destination.
Variant getVariant(void) const noexcept
Get how the drawer is presented.
const IndexHandler & getOnIndexChange(void) const noexcept
Get the callback run when a press changes the selected destination.
std::function< void(std::size_t)> IndexHandler
Callback that receives a destination index, starting at 0.
NavigationDrawer & setEntries(const std::vector< Entry > &entries)
Replace the description of every entry.
const std::vector< ecs::Entity::Identifier > & getDestinationEntities(void) const noexcept
Get the destination children.
NavigationDrawer & setSectionEntities(const std::vector< ecs::Entity::Identifier > &identifiers)
Record the section header children.
NavigationDrawer(void)=default
Create the configuration of a standard drawer with no entry.
std::size_t getDestinationCount(void) const noexcept
Count the entries that are destinations.
NavigationDrawer & setEntryEntities(const std::vector< ecs::Entity::Identifier > &identifiers)
Record the child built for each entry, whatever its kind.
NavigationDrawer & setUpdatingSelection(bool updating)
Raise or lower the guard that stops a selection change from triggering another one.
const std::vector< ecs::Entity::Identifier > & getDividerEntities(void) const noexcept
Get the divider children.
NavigationDrawer & setOnIndexChange(IndexHandler handler)
Set the callback run when a press changes the selected destination.
static constexpr float Height
Height of the drawer, in dp.
const std::vector< Entry > & getEntries(void) const noexcept
Get the description of every entry.
EntryKind
What a drawer entry is.
@ Destination
Pressable destination.
@ Section
Section header (titleSmall text).
NavigationDrawer & setDestinationEntities(const std::vector< ecs::Entity::Identifier > &identifiers)
Record the destination children.
NavigationDrawer & setDividerEntities(const std::vector< ecs::Entity::Identifier > &identifiers)
Record the divider children.
bool isUpdatingSelection(void) const noexcept
Tell whether systems::NavigationDrawer is changing the selection at this moment.
const std::vector< ecs::Entity::Identifier > & getEntryEntities(void) const noexcept
Get the child built for each entry, whatever its kind.
~NavigationDrawer(void)=default
Default destructor.
ecs::Entity::Identifier getBackdrop(void) const noexcept
Get the child that dims the content behind a modal drawer.
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.
Description of one drawer entry, as given by the user.
std::string label
Destination label or section title.
EntryKind kind
What it is.
bool operator==(const Entry &other) const =default
Compare two entries.
std::string icon
Icon glyph name of a destination.