27#include "guillaume/ecs/system_filler.hpp"
29#include "guillaume/components/navigation_drawer.hpp"
30#include "guillaume/theme.hpp"
Variant
How the drawer is presented.
Stores every component of a scene, per component type and per entity identifier, and knows which ones...
std::size_t Identifier
The key under which an entity's components are stored. Systems and components refer to entities by th...
The base class to derive a system from: a System whose signature is the list of component types given...
static float widthOf(components::NavigationDrawer::Variant variant)
Get the drawer width of a variant, in dp.
static void destinationSelected(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier, std::size_t index)
React to a destination that became selected without going through the drawer.
static constexpr float Spacing
Gap between two stacked entries: 4 dp.
static void apply(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Shape and color the drawer, style its destinations, stack its entries and place its backdrop.
static void select(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier, std::size_t index)
Select a destination from code.
~NavigationDrawer(void) override=default
Default destructor.
NavigationDrawer(void)
Create the system in the Layout phase.
static void hide(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Hide the drawer and its backdrop.
static void press(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier, std::size_t index)
Activate a destination as a press on it would.
static void setDestinationDisabled(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier, std::size_t index, bool disabled)
Enable or disable one destination and restyle it.
void update(const ecs::Entity::Identifier &entityIdentifier) override
Run apply() on one navigation drawer; called by the frame loop.
static void show(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Show the drawer, and its backdrop when it is modal.
static void selectFirstEnabled(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Select the first destination that is not disabled, then restyle.
static void install(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Connect a navigation drawer to its destinations and section headers.
static constexpr float Padding
Space between the edge of the drawer and its entries: 12 dp.
static std::size_t selectedIndex(const ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Get the index of the selected destination.
static constexpr float get(unsigned int steps)
Get a spacing as a number of grid units.
Rules. Every class here runs each frame on the entities that have the components it declares.