31#include "guillaume/ecs/component.hpp"
32#include "guillaume/ecs/entity.hpp"
70 std::vector<std::string> _options {};
71 std::optional<std::size_t> _value {};
72 std::vector<ecs::Entity::Identifier>
92 const std::vector<std::string> &
getOptions(
void)
const noexcept;
109 std::optional<std::size_t>
getValue(
void)
const noexcept;
127 const std::vector<ecs::Entity::Identifier> &
138 setButtons(
const std::vector<ecs::Entity::Identifier> &buttons);
RadioGroup(void)=default
Create the state of a group with no option and no selection.
RadioGroup & setOptions(const std::vector< std::string > &options)
Replace the label of each option.
const std::vector< ecs::Entity::Identifier > & getButtons(void) const noexcept
Get the radio button child of each option.
std::function< void(std::size_t)> ValueChangeHandler
RadioGroup & setButtons(const std::vector< ecs::Entity::Identifier > &buttons)
Record the radio button child of each option.
const ValueChangeHandler & getOnValueChange(void) const noexcept
Get the callback run when the user changes the selection.
static constexpr float RowSpacing
~RadioGroup(void)=default
Default destructor.
std::optional< std::size_t > getValue(void) const noexcept
Get the selected option.
RadioGroup & setValue(std::optional< std::size_t > value)
Store the selected option.
const std::vector< std::string > & getOptions(void) const noexcept
Get the label of each option.
RadioGroup & setOnValueChange(ValueChangeHandler handler)
Set the callback run when the user changes the selection.
Base class of every component: a piece of state attached to an entity, plus a "changed" flag.
State. Every class here is plain data attached to an entity.