23#include "guillaume/components/radio_group.hpp"
36 if (_options != options) {
50 if (_value != value) {
57 const std::vector<ecs::Entity::Identifier> &
64 const std::vector<ecs::Entity::Identifier> &buttons)
66 if (_buttons != buttons) {
76 return _onValueChange;
81 _onValueChange = std::move(handler);
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.
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.
void setHasChanged(bool hasChanged)
Raise or lower the changed flag.
State. Every class here is plain data attached to an entity.