23#include "guillaume/components/chip.hpp"
36 if (_variant != variant) {
64 if (_label != label) {
78 if (_iconGlyph != iconGlyph) {
79 _iconGlyph = iconGlyph;
92 if (_leadingIcon != identifier) {
93 _leadingIcon = identifier;
101 return _trailingIcon;
106 if (_trailingIcon != identifier) {
107 _trailingIcon = identifier;
120 if (_labelEntity != identifier) {
121 _labelEntity = identifier;
134 if (_checkIcon != identifier) {
135 _checkIcon = identifier;
148 if (_compact != compact) {
162 if (_elevated != elevated) {
163 _elevated = elevated;
171 return _showSelectedOverlay;
176 if (_showSelectedOverlay != show) {
177 _showSelectedOverlay = show;
185 return _showSelectedCheck;
190 if (_showSelectedCheck != show) {
191 _showSelectedCheck = show;
204 _onPress = std::move(handler);
215 _onClose = std::move(handler);
Chip & setCompact(bool compact)
Choose between the regular and the compact padding.
Chip & setShowSelectedOverlay(bool show)
Choose whether a selected chip is darkened by a state layer.
ecs::Entity::Identifier getCheckIcon(void) const noexcept
Get the child entity that draws the selected check.
Chip & setShowSelectedCheck(bool show)
Choose whether a selected chip shows its check.
const std::string & getLabel(void) const noexcept
Get the label text.
ecs::Entity::Identifier getLeadingIcon(void) const noexcept
Get the child entity that draws the leading icon.
Variant getVariant(void) const noexcept
Get the kind of chip.
Chip & setMode(Mode mode)
Choose the container style.
const std::string & getIconGlyph(void) const noexcept
Get the name of the leading icon glyph.
Mode
Container style: Flat is filled with the secondary container color; Outlined is transparent with an o...
bool isShowSelectedCheck(void) const noexcept
Check whether a selected chip shows its check.
Chip & setOnPress(Handler handler)
Set the callback run when the chip is pressed.
ecs::Entity::Identifier getLabelEntity(void) const noexcept
Get the child entity that draws the label.
Chip & setCheckIcon(ecs::Entity::Identifier identifier)
Record which child entity draws the selected check.
Chip & setLeadingIcon(ecs::Entity::Identifier identifier)
Record which child entity draws the leading icon.
bool isElevated(void) const noexcept
Check whether the chip casts a shadow.
Chip & setLabelEntity(ecs::Entity::Identifier identifier)
Record which child entity draws the label.
Chip & setOnClose(Handler handler)
Set the callback run when the close icon is pressed.
Chip & setLabel(const std::string &label)
Set the label text.
const Handler & getOnPress(void) const noexcept
Get the callback run when the chip is pressed.
bool isCompact(void) const noexcept
Check whether the chip uses the compact padding.
Chip & setTrailingIcon(ecs::Entity::Identifier identifier)
Record which child entity draws the trailing close icon.
const Handler & getOnClose(void) const noexcept
Get the callback run when the close icon is pressed.
Mode getMode(void) const noexcept
Get the container style.
Chip & setElevated(bool elevated)
Choose whether the chip casts a shadow.
std::function< void(void)> Handler
Callback run when the chip, or its close icon, is activated.
ecs::Entity::Identifier getTrailingIcon(void) const noexcept
Get the child entity that draws the trailing close icon.
Chip & setVariant(Variant variant)
Choose the kind of chip.
bool isShowSelectedOverlay(void) const noexcept
Check whether a selected chip is darkened by a state layer.
Chip(void)=default
Create the configuration of a flat Assist chip with no label.
Chip & setIconGlyph(const std::string &iconGlyph)
Set the name of the leading icon glyph.
void setHasChanged(bool hasChanged)
Raise or lower the changed flag.
std::size_t Identifier
The key under which an entity's components are stored. Systems and components refer to entities by th...
State. Every class here is plain data attached to an entity.