5#ifndef MALENA_CHECKBOXGROUP_H
6#define MALENA_CHECKBOXGROUP_H
31 enum class Flag { SHOW_BACKGROUND };
54 std::vector<std::unique_ptr<Checkbox>> _owned;
55 std::vector<Checkbox*> _checkboxes;
60 std::function<void(
const std::vector<std::string>&)> _onSelectionChanged;
63 void applyStylesToCheckbox(
Checkbox& cb);
81 static_assert(std::is_base_of_v<CheckboxGroupSettings, S>,
82 "applySettings() requires a type derived from CheckboxGroupSettings");
84 for (
auto* cb : _checkboxes) applyStylesToCheckbox(*cb);
91 static_assert(std::is_base_of_v<CheckboxGroupTheme, T>,
92 "applyTheme() requires a type derived from CheckboxGroupTheme");
94 for (
auto* cb : _checkboxes) applyStylesToCheckbox(*cb);
100 static_assert(std::is_base_of_v<CheckboxGroupSettings, St> &&
101 std::is_base_of_v<CheckboxGroupTheme, St>,
102 "applyStyle() requires CheckboxGroupSettings and CheckboxGroupTheme");
105 for (
auto* cb : _checkboxes) applyStylesToCheckbox(*cb);
111 void addOption(
const std::string& label,
bool checked =
false);
130 std::function<
void(
const std::vector<std::string>&)> callback);
143 template<
typename MANIFEST>
bool isChecked(std::size_t index) const
void uncheck(std::size_t index)
void onThemeApplied(const Theme &theme) override
Called by ThemeManager when the active theme changes.
std::vector< std::size_t > getCheckedIndices() const
CheckboxGroup(const CheckboxGroup &)=delete
void applyStyle(const St &s)
CheckboxGroup(const sf::Font &font=FontManager<>::getDefault())
void setOptionEnabled(std::size_t index, bool enabled)
void applyTheme(const T &t)
std::vector< std::string > getCheckedLabels() const
void setPosition(const sf::Vector2f &position) override
CheckboxGroupManifest::Flag Flag
void check(std::size_t index)
void onSelectionChanged(std::function< void(const std::vector< std::string > &)> callback)
void addOption(const std::string &label, bool checked=false)
void draw(sf::RenderTarget &target, sf::RenderStates states) const override
sf::FloatRect getGlobalBounds() const override
sf::Vector2f getPosition() const override
CheckboxGroup & operator=(const CheckboxGroup &)=delete
void add(Checkbox &checkbox)
void applySettings(const S &s)
std::size_t optionCount() const
CheckboxGroup(const sf::Font &font=FontManager<>::getDefault())
A toggleable checkbox with a square indicator and text label.
static const sf::Font & getDefault()
Return the built-in Arial font.
Base class for all Malena manifests.
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 CheckboxGroup.
Color tokens for CheckboxGroup.
Universal design token set applied across all Themeable components.