5#ifndef MALENA_RADIOGROUP_H
6#define MALENA_RADIOGROUP_H
31 enum class Flag { SHOW_BACKGROUND };
52 std::vector<std::unique_ptr<RadioButton>> _owned;
53 std::vector<RadioButton*> _buttons;
59 std::function<void(
const std::string&, std::size_t)> _onSelectionChanged;
81 static_assert(std::is_base_of_v<RadioGroupSettings, S>,
82 "applySettings() requires a type derived from RadioGroupSettings");
84 for (
auto* btn : _buttons) applyStylesToButton(*btn);
91 static_assert(std::is_base_of_v<RadioGroupTheme, T>,
92 "applyTheme() requires a type derived from RadioGroupTheme");
94 for (
auto* btn : _buttons) applyStylesToButton(*btn);
100 static_assert(std::is_base_of_v<RadioGroupSettings, St> &&
101 std::is_base_of_v<RadioGroupTheme, St>,
102 "applyStyle() requires RadioGroupSettings and RadioGroupTheme");
105 for (
auto* btn : _buttons) applyStylesToButton(*btn);
127 std::function<
void(
const std::string&, std::size_t)> callback);
140 template<
typename MANIFEST>
static const sf::Font & getDefault()
Return the built-in Arial font.
Base class for all Malena manifests.
void setPosition(const sf::Vector2f &position) override
void applySettings(const S &s)
std::size_t getSelectedIndex() const
void applyTheme(const T &t)
void addOption(const std::string &label)
std::string getSelectedLabel() const
void add(RadioButton &button)
void applyStyle(const St &s)
RadioGroup & operator=(const RadioGroup &)=delete
sf::Vector2f getPosition() const override
void onThemeApplied(const Theme &theme) override
Called by ThemeManager when the active theme changes.
RadioGroup(const sf::Font &font=FontManager<>::getDefault())
void onSelectionChanged(std::function< void(const std::string &, std::size_t)> callback)
std::size_t optionCount() const
void select(std::size_t index)
void draw(sf::RenderTarget &target, sf::RenderStates states) const override
RadioButton * getSelected() const
sf::FloatRect getGlobalBounds() const override
void setOptionEnabled(std::size_t index, bool enabled)
RadioGroup(const RadioGroup &)=delete
RadioGroupManifest::Flag Flag
RadioGroup(const sf::Font &font=FontManager<>::getDefault())
A framework-integrated rectangle with optional rounded corners.
Component< M, Traits... > ComponentWith
Alias for Component<M, Traits...>.
Vector2< float > Vector2f
Layout and behaviour settings for RadioGroup.
Color tokens for RadioGroup.
Universal design token set applied across all Themeable components.