A vertical list of pressable rows, with optional subheaders, dividers and accordions that fold nested rows (Paper List.Section, List.Subheader, List.Item, List.Accordion, List.Icon and List.Image).
More...
|
| | ~List (void) override |
| | Default destructor.
|
| List & | setVariant (Variant variant) |
| | Change the variant. Restyles at once; the rows are kept.
|
| Variant | getVariant (void) const |
| | Get the variant.
|
| List & | setItems (const std::vector< Item > &items) |
| | Replace the entries.
|
| std::size_t | getItemCount (void) const |
| | Get the number of top-level entries.
|
| ecs::Entity::Identifier | getItemIdentifier (std::size_t index) const |
| | Get the root entity of a top-level entry: the row container, the subheader text or the divider.
|
| ecs::Entity::Identifier | getChildIdentifier (std::size_t index, std::size_t childIndex) const |
| | Get the root entity of a row nested in an accordion.
|
| ecs::Entity::Identifier | getContentIdentifier (std::size_t index) const |
| | Get the content column of a top-level row: the container of its headline and supporting text.
|
| List & | setItemDisabled (std::size_t index, bool disabled) |
| | Enable or disable a top-level entry. Restyles at once.
|
| List & | setExpanded (std::size_t index, bool expanded) |
| | Expand or collapse a top-level accordion.
|
| bool | isExpanded (std::size_t index) const |
| | Whether a top-level accordion shows its nested rows.
|
|
| ~SurfaceBase (void) override=default |
| | Default destructor.
|
| SurfaceBase & | setPose (const utility::graphic::PoseF &pose) |
| | Move the surface.
|
| SurfaceBase & | setColor (const utility::graphic::Color32Bit &color) |
| | Set the fill color (Color component).
|
| SurfaceBase & | setBorderRadius (float radius) |
| | Set the radius of the four corners (Borders component).
|
| SurfaceBase & | setSurfaceConfig (const SurfaceConfig &config) |
| | Apply every field of a configuration at once.
|
| SurfaceConfig | getSurfaceConfig (void) const |
| | Read the current configuration back from the components.
|
| SurfaceBase & | setChildren (const Children &children) |
| | Choose the children this surface arranges, in order.
|
| std::vector< ecs::Entity::Identifier > | getChildren (void) const |
| | Get the children this surface arranges.
|
| | ParentEntityFiller (ComponentRegistry &componentRegistry) |
| | Create the entity, its listed components and its components::Hierarchy. It owns no child yet.
|
|
virtual | ~ParentEntityFiller (void)=default |
| | Destroy the entity object and release the children it owns; components stay in the registry (see EntityRegistry::removeEntity).
|
| | Entity (void) |
| | Create an entity with a fresh identifier, an empty signature, no parent and no component.
|
| virtual | ~Entity (void)=default |
| | Destroy the entity object.
|
| Entity::Identifier | getIdentifier (void) const noexcept |
| | Get the identifier of the entity.
|
| Entity::Signature | getSignature (void) const noexcept |
| | Get the set of component types the entity declares.
|
| void | setSignature (const Signature &signature) |
| | Replace the signature of the entity.
|
| std::int32_t | getLayer (void) const noexcept |
| | Get the depth of the entity in the tree.
|
| Entity & | setParent (std::shared_ptr< Entity > parent) |
| | Attach the entity under another one, or detach it.
|
| std::vector< Identifier > | releaseComponents (void) |
| | Drop the entity's place in the tree and all its components.
|
| std::shared_ptr< Entity > | getParent (void) const noexcept |
| | Get the parent entity.
|
|
| EntityRegistry (void)=default |
| | Create a registry.
|
| virtual | ~EntityRegistry (void)=default |
| | Virtual destructor.
|
| void | addEntity (std::shared_ptr< Entity > entity) |
| | Make this registry own an entity, so that it stays alive and systems visit it.
|
| bool | removeEntity (Entity::Identifier identifier) |
| | Remove an entity, with its children and all their components.
|
| void | clearEntities (void) |
| | Remove every entity owned by this registry, with everything they own and all their components.
|
| const std::vector< std::shared_ptr< Entity > > & | getEntities (void) const |
| | Get the entities this registry owns directly.
|
| std::vector< std::shared_ptr< Entity > > | getEntitiesBreadthFirst (void) |
| | List every entity of this registry and of the registries nested in it, level by level.
|
| std::vector< std::shared_ptr< Entity > > | getEntitiesBreadthFirst (void) const |
| | List every entity of this registry and of the registries nested in it, level by level (const overload).
|
| template<InheritFromEntity EntityType> |
| std::shared_ptr< EntityType > | getEntity (Entity::Identifier identifier) |
| | Find an entity owned directly by this registry, by identifier.
|
| template<InheritFromEntity EntityType> |
| std::shared_ptr< const EntityType > | getEntity (Entity::Identifier identifier) const |
| | Find an entity owned directly by this registry, by identifier (const overload).
|
| std::vector< Entity::Identifier > | getEntityWithSignature (Entity::Signature systemSignature) const |
| | List the entities that have every component type of a signature, from the root down.
|
| std::vector< Entity::Identifier > | getEntityWithSignature (Entity::Signature systemSignature, const EntityTreeTraveler &traveler) const |
| | List the entities that have every component type of a signature, in the order chosen by a traveler.
|
A vertical list of pressable rows, with optional subheaders, dividers and accordions that fold nested rows (Paper List.Section, List.Subheader, List.Item, List.Accordion, List.Icon and List.Image).
Its state lives in components::List (variant, entries, identifiers of the rows built for them); systems::List styles the list, sizes and stacks the rows and shows the children of expanded accordions only, each frame, in the Layout phase. The class itself holds no field: it builds the row entities, and its setters write the component and restyle at once.
};
auto list = builder.makeList(parent, List::Variant::TwoLine,
ComponentRegistry & getComponentRegistry(void)
Configures a List, creates it and registers it in an entity registry.
static Item divider(void)
Make a divider entry: a horizontal line as wide as the list.
static Item subheader(const std::string &title)
Make a subheader entry: a section title that is not pressable.
components::List::Item Item
List entry.
std::function< void(void)> onPress
Called on press.
std::string headline
Main text of the row.
List::create(registry, config, variant, items) builds the same widget without registering it in an entity registry.
Things to know:
- A row is an entities::View holding an optional leading image or icon, a column with the headline over the supporting text, and an optional trailing icon. An entry with children is an accordion: its trailing icon is a chevron and a press toggles it before calling its press handler.
- The variant only decides whether the supporting text shows: SingleLine hides it, TwoLine and ThreeLine show it.
- Indexes are positions among the top-level entries, from 0; subheaders and dividers count.
- The width is the fixed width of the surface configuration, in dp (components::List::DefaultWidth, 360 dp, with the Builder defaults); the row heights follow their content. The list's layout, color and corners are overwritten each frame.
- The list is the entity registry that owns its rows. setItems() removes every row and builds new ones: identifiers returned before by getItemIdentifier(), getChildIdentifier() and getContentIdentifier() are then invalid.
- setExpanded() does not call the press handler of the entry.
- See also
- components::List, systems::List, View
Definition at line 101 of file list.hpp.