30#include <utility/graphic/color.hpp>
31#include <utility/graphic/pose.hpp>
33#include "guillaume/ecs/component_registry.hpp"
34#include "guillaume/ecs/entity_builder.hpp"
36#include "guillaume/components/chip.hpp"
37#include "guillaume/components/elevation.hpp"
38#include "guillaume/components/selection.hpp"
40#include "guillaume/entities/icon.hpp"
41#include "guillaume/entities/builder_base.hpp"
42#include "guillaume/entities/surface.hpp"
43#include "guillaume/entities/text.hpp"
95 public SurfaceBase<components::Selectable, components::Elevation,
116 Variant _variant { Variant::Assist };
117 std::string _label {};
120 bool _selected {
false };
152 void reset(
void)
override;
207 std::shared_ptr<Chip>
makeChip(std::shared_ptr<ecs::Entity> parent,
209 const std::string &label,
210 const std::string &iconGlyph,
226 template<
typename... Arguments>
227 static std::shared_ptr<Chip>
create(Arguments &&...arguments)
229 std::shared_ptr<Chip> entity(
230 new Chip(std::forward<Arguments>(arguments)...));
238 ~Chip(
void)
override;
395 Variant variant,
const std::string &label,
396 const std::string &iconGlyph,
bool selected);
Mode
Container style: Flat is filled with the secondary container color; Outlined is transparent with an o...
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...
Builder & withLabel(const std::string &label)
Set the label text.
Builder & withIcon(const std::string &iconGlyph)
Set the leading icon.
Builder & withVariant(Variant variant)
Set the variant, which decides the children built and whether a press toggles the selection.
std::shared_ptr< Chip > makeChip(std::shared_ptr< ecs::Entity > parent, Variant variant, const std::string &label, const std::string &iconGlyph, bool selected)
Build a chip, register it under parent and reset the builder.
Builder & withSelected(bool selected)
Choose whether the chip starts selected.
void reset(void) override
Restore the default configuration.
Builder & withPose(const utility::graphic::PoseF &pose)
Set the position and orientation of the chip.
Builder(ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
Construct a builder with the default configuration (see reset()).
std::shared_ptr< Chip > buildEntity(void) override
Build a Chip, with its icon and label children, from the current configuration, without registering i...
A compact, 32 dp high pill with a label and optional icons, used as an action, a filter,...
Chip & setSelected(bool selected)
Select or deselect the chip, whatever its variant. Restyles at once.
bool isSelected(void) const
Check whether the chip is selected.
Mode getMode(void) const
Get the mode.
Chip & setOnClose(std::function< void(void)> onClose)
Set the handler called when the user presses the trailing close icon (Paper onClose).
Variant getVariant(void) const
Get the variant.
Chip & setMode(Mode mode)
Set the mode. Restyles at once.
Chip & setShowSelectedCheck(bool show)
Show the check icon while the chip is selected (Paper showSelectedCheck). Restyles at once.
Chip & setCompact(bool compact)
Use the compact padding (Paper compact). Restyles at once.
~Chip(void) override
Destructor.
Chip & setShowSelectedOverlay(bool show)
Darken the chip with a pressed state layer while it is selected (Paper showSelectedOverlay)....
bool isDisabled(void) const
Check whether the chip is disabled.
Chip & setVariant(Variant variant)
Set the variant. Restyles at once.
Chip & setElevated(bool elevated)
Paint a level 1 shadow under the chip (Paper elevated). Restyles at once.
Chip & setOnPress(std::function< void(void)> onPress)
Set the handler called when the user presses the chip (Paper onPress).
ecs::Entity::Identifier getCloseIconIdentifier(void) const
Get the identifier of the trailing close icon child.
Chip & setLabel(const std::string &label)
Set the label text. Restyles at once.
components::Chip::Variant Variant
Chip & setDisabled(bool disabled)
Enable or disable the chip. Restyles at once.
static std::shared_ptr< Chip > create(Arguments &&...arguments)
Create a chip and its icon and label children, without registering it in an entity registry.
components::Chip::Mode Mode
Paper chip mode: Flat (tonal fill, the default) or Outlined.
EntityBuilderBase(ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
SurfaceBase(ecs::ComponentRegistry ®istry, const SurfaceConfig &config)
Widgets: the classes used to create entities with the right components and children.
Everything needed to set up a surface in one value: where it is, how it looks and how it arranges its...