23#include "guillaume/components/dialog.hpp"
37 if (_variant != variant) {
51 if (_title != title) {
65 if (_message != message) {
79 const bool same = std::equal(
80 _actions.begin(), _actions.end(), actions.begin(), actions.end(),
82 return left.label == right.label;
85 _actions = std::move(actions);
108 if (!_icon.empty()) {
111 return _variant == Variant::Confirmation ? std::string(
"info")
122 if (_iconEntity != identifier) {
123 _iconEntity = identifier;
136 if (_titleEntity != identifier) {
137 _titleEntity = identifier;
145 return _messageEntity;
150 if (_messageEntity != identifier) {
151 _messageEntity = identifier;
157 const std::vector<ecs::Entity::Identifier> &
160 return _actionEntities;
164 const std::vector<ecs::Entity::Identifier> &identifiers)
166 if (_actionEntities != identifiers) {
167 _actionEntities = identifiers;
180 if (_actionRow != identifier) {
181 _actionRow = identifier;
194 if (_backdrop != identifier) {
195 _backdrop = identifier;
const std::string & getTitle(void) const noexcept
Get the title (headline) of the dialog.
Dialog & setIcon(const std::string &icon)
Choose the icon shown above the title (the hero icon).
Dialog & setMessageEntity(ecs::Entity::Identifier identifier)
Record the child that draws the message.
Dialog(void)=default
Create the configuration of an empty alert dialog.
Dialog & setTitle(const std::string &title)
Set the title (headline) of the dialog.
const std::vector< ecs::Entity::Identifier > & getActionEntities(void) const noexcept
Get the text buttons built for the actions.
const std::string & getMessage(void) const noexcept
Get the message (supporting text) of the dialog.
ecs::Entity::Identifier getMessageEntity(void) const noexcept
Get the child that draws the message.
Dialog & setVariant(Variant variant)
Set the kind of dialog.
const std::string & getIcon(void) const noexcept
Get the icon chosen for the top of the dialog.
Dialog & setActionRow(ecs::Entity::Identifier identifier)
Record the row that holds the action buttons.
Dialog & setMessage(const std::string &message)
Set the message (supporting text) of the dialog.
Variant getVariant(void) const noexcept
Get the kind of dialog.
Dialog & setActions(std::vector< Action > actions)
Replace the actions of the dialog.
ecs::Entity::Identifier getBackdrop(void) const noexcept
Get the child that dims the content behind the dialog.
ecs::Entity::Identifier getIconEntity(void) const noexcept
Get the child that draws the hero icon.
const std::vector< Action > & getActions(void) const noexcept
Get the actions of the dialog.
Dialog & setTitleEntity(ecs::Entity::Identifier identifier)
Record the child that draws the title.
Dialog & setActionEntities(const std::vector< ecs::Entity::Identifier > &identifiers)
Record the text buttons built for the actions.
Dialog & setIconEntity(ecs::Entity::Identifier identifier)
Record the child that draws the hero icon.
Dialog & setBackdrop(ecs::Entity::Identifier identifier)
Record the child that dims the content behind the dialog.
ecs::Entity::Identifier getTitleEntity(void) const noexcept
Get the child that draws the title.
std::string getEffectiveIcon(void) const
Get the icon the dialog actually shows.
ecs::Entity::Identifier getActionRow(void) const noexcept
Get the row that holds the action buttons, at the bottom of the panel.
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.
One action of the dialog, drawn as a text button in the action row.