23#include "guillaume/components/card.hpp"
36 if (_variant != variant) {
50 if (_interactive != interactive) {
51 _interactive = interactive;
64 if (_pressed != pressed) {
73 return _pressProgress;
78 if (_pressProgress != pressProgress) {
79 _pressProgress = pressProgress;
92 if (_pressFrom != pressFrom) {
93 _pressFrom = pressFrom;
106 if (_coverPath != coverPath) {
107 _coverPath = coverPath;
120 if (_title != title) {
134 if (_subtitle != subtitle) {
135 _subtitle = subtitle;
148 if (_contentText != contentText) {
149 _contentText = contentText;
162 if (_cover != identifier) {
171 return _titleSection;
176 if (_titleSection != identifier) {
177 _titleSection = identifier;
190 if (_titleText != identifier) {
191 _titleText = identifier;
199 return _subtitleText;
204 if (_subtitleText != identifier) {
205 _subtitleText = identifier;
213 return _contentEntity;
218 if (_contentEntity != identifier) {
219 _contentEntity = identifier;
227 return _actionsSection;
232 if (_actionsSection != identifier) {
233 _actionsSection = identifier;
246 _actions.push_back(std::move(action));
253 return _actionButtons;
258 if (_actionButtons != identifiers) {
259 _actionButtons = identifiers;
272 _onPress = std::move(handler);
const std::vector< Action > & getActions(void) const noexcept
Get the actions the card was asked to show.
bool isInteractive(void) const noexcept
Check whether the card reacts to hover and press.
Card & setPressed(bool pressed)
Record the pressed state the press motion heads to.
const std::string & getCoverPath(void) const noexcept
Get the path of the cover texture.
bool isPressed(void) const noexcept
Check whether the press motion is heading to the raised state.
ecs::Entity::Identifier getActionsSection(void) const noexcept
Get the child entity that contains the action buttons.
ecs::Entity::Identifier getCover(void) const noexcept
Get the child entity that draws the cover image.
Card & setInteractive(bool interactive)
Record that the card reacts to hover and press.
ecs::Entity::Identifier getTitleSection(void) const noexcept
Get the child entity that contains the title and the subtitle.
const Identifiers & getActionButtons(void) const noexcept
Get the entities of the action buttons.
Card & setSubtitle(const std::string &subtitle)
Set the subtitle text.
float getPressFrom(void) const noexcept
Get the press progress at which the running motion began.
Card(void)=default
Create the state of an empty, elevated card that cannot be pressed.
Card & setTitleText(ecs::Entity::Identifier identifier)
Record which entity draws the title text.
std::function< void(void)> Handler
Callback run when the card is pressed.
Card & setActionButtons(const Identifiers &identifiers)
Record which entities are the action buttons.
const Handler & getOnPress(void) const noexcept
Get the callback run when the card is pressed.
float getPressProgress(void) const noexcept
Get how far the card is raised by a press.
Card & setContentText(const std::string &contentText)
Set the content text.
Card & setPressProgress(float pressProgress)
Set how far the card is raised by a press.
const std::string & getTitle(void) const noexcept
Get the title text.
Card & setVariant(Variant variant)
Choose the look of the card surface.
const std::string & getContentText(void) const noexcept
Get the content text.
Card & setTitle(const std::string &title)
Set the title text.
Card & setActionsSection(ecs::Entity::Identifier identifier)
Record which child entity contains the action buttons.
Variant
Look of the card surface.
Card & setCover(ecs::Entity::Identifier identifier)
Record which child entity draws the cover image.
Card & setSubtitleText(ecs::Entity::Identifier identifier)
Record which entity draws the subtitle text.
std::vector< ecs::Entity::Identifier > Identifiers
List of child entity identifiers.
ecs::Entity::Identifier getTitleText(void) const noexcept
Get the entity that draws the title text.
const std::string & getSubtitle(void) const noexcept
Get the subtitle text.
Card & setOnPress(Handler handler)
Store the callback run when the card is pressed.
ecs::Entity::Identifier getContentEntity(void) const noexcept
Get the child entity that draws the content text.
Card & setTitleSection(ecs::Entity::Identifier identifier)
Record which child entity contains the title and the subtitle.
Card & setCoverPath(const std::string &coverPath)
Set the path of the cover texture.
ecs::Entity::Identifier getSubtitleText(void) const noexcept
Get the entity that draws the subtitle text.
Card & addAction(Action action)
Append an action to the actions row.
Card & setContentEntity(ecs::Entity::Identifier identifier)
Record which child entity draws the content text.
Card & setPressFrom(float pressFrom)
Record the press progress at which a motion begins.
Variant getVariant(void) const noexcept
Get the look of the card surface.
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 button of the actions row: its label and what it does.