32#include <utility/graphic/color.hpp>
33#include <utility/graphic/pose.hpp>
35#include "guillaume/ecs/component_registry.hpp"
36#include "guillaume/ecs/entity_builder.hpp"
38#include "guillaume/components/list.hpp"
40#include "guillaume/entities/builder_base.hpp"
41#include "guillaume/entities/icon.hpp"
42#include "guillaume/entities/surface.hpp"
43#include "guillaume/entities/text.hpp"
44#include "guillaume/entities/view.hpp"
116 Variant _variant { Variant::SingleLine };
117 std::vector<Item> _items {};
142 void reset(
void)
override;
185 std::shared_ptr<List>
makeList(std::shared_ptr<ecs::Entity> parent,
187 const std::vector<Item> &items);
220 template<
typename... Arguments>
221 static std::shared_ptr<List>
create(Arguments &&...arguments)
223 std::shared_ptr<List> entity(
224 new List(std::forward<Arguments>(arguments)...));
232 ~List(
void)
override;
339 void buildItems(
void);
353 Variant variant,
const std::vector<Item> &items);
ItemKind
What a list entry is.
Variant
Number of text lines a row is meant for.
Stores every component of a scene, per component type and per entity identifier, and knows which ones...
Owns entities and gives the systems the list of entities to visit.
std::size_t Identifier
The key under which an entity's components are stored. Systems and components refer to entities by th...
EntityBuilderBase(ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
std::shared_ptr< List > buildEntity(void) override
Build a list and its rows from the current configuration, without registering it or setting its paren...
std::shared_ptr< List > makeList(std::shared_ptr< ecs::Entity > parent, Variant variant, const std::vector< Item > &items)
Build a list, register it under parent and reset the builder.
Builder & withPose(const utility::graphic::PoseF &pose)
Set where the list is placed.
Builder & withItems(const std::vector< Item > &items)
Set the entries, replacing the ones set before.
Builder & withFixedWidth(float width)
Set the width of the list and of its rows.
void reset(void) override
Restore the defaults.
Builder(ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
Create a builder set to the defaults of reset().
Builder & withVariant(Variant variant)
Set the variant.
A vertical list of pressable rows, with optional subheaders, dividers and accordions that fold nested...
List & setItems(const std::vector< Item > &items)
Replace the entries.
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.
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::Variant Variant
List variant.
~List(void) override
Default destructor.
List & setVariant(Variant variant)
Change the variant. Restyles at once; the rows are kept.
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.
static std::shared_ptr< List > create(Arguments &&...arguments)
Create a list and its rows, without registering it in an entity registry.
bool isExpanded(std::size_t index) const
Whether a top-level accordion shows its nested rows.
Variant getVariant(void) const
Get the variant.
List & setItemDisabled(std::size_t index, bool disabled)
Enable or disable a top-level entry. Restyles at once.
ecs::Entity::Identifier getChildIdentifier(std::size_t index, std::size_t childIndex) const
Get the root entity of a row nested in an accordion.
std::size_t getItemCount(void) const
Get the number of top-level entries.
components::List::Item Item
List entry.
components::List::ItemKind ItemKind
Kind of an entry.
List & setExpanded(std::size_t index, bool expanded)
Expand or collapse a top-level accordion.
SurfaceBase(ecs::ComponentRegistry ®istry, const SurfaceConfig &config)
Widgets: the classes used to create entities with the right components and children.
Description of one list entry, as given by the user.
Everything needed to set up a surface in one value: where it is, how it looks and how it arranges its...