27#include "guillaume/ecs/component.hpp"
28#include "guillaume/ecs/entity.hpp"
60 using Handler = std::function<void(
bool)>;
63 bool _selected {
false };
bool isSelected(void) const
Check whether the entity is selected.
~Selectable(void)=default
Default destructor for the Selectable component.
Selectable & setSelected(bool selected)
Select or deselect the entity.
std::function< void(bool)> Handler
Callback receiving the new state: true when just selected.
Selectable & setOnSelectionChangedHandler(const Handler &handler)
Set the callback run when the selection changes.
Handler getOnSelectionChangedHandler(void) const
Get the callback run when the selection changes.
Selectable(void)=default
Create an unselected flag with no handler.
bool isEmptyAllowed(void) const
Check whether the group may have no selection.
bool hasSelection(void) const
Check whether the group names a selected child.
ecs::Entity::Identifier getSelected(void) const
Get the selected child.
SelectionGroup(void)=default
Create a group with no selection that may stay empty.
SelectionGroup & setAllowEmpty(bool allowEmpty)
Choose whether the group may have no selection.
SelectionGroup & setSelected(ecs::Entity::Identifier selected)
Record which child is selected.
SelectionGroup & clearSelection(void)
Record that no child is selected.
~SelectionGroup(void)=default
Default destructor for the SelectionGroup component.
Base class of every component: a piece of state attached to an entity, plus a "changed" flag.
std::size_t Identifier
The key under which an entity's components are stored. Systems and components refer to entities by th...
static constexpr Identifier InvalidIdentifier
"No entity": never the identifier of a real entity
State. Every class here is plain data attached to an entity.