5#ifndef MALENA_PILLTOGGLE_H
6#define MALENA_PILLTOGGLE_H
27 enum class Flag { ON, DISABLED };
78 float _thumbTarget = 0.f;
82 std::function<void(
bool)> _onToggled;
84 void syncFromSettings();
85 void updateThumbPosition();
102 static_assert(std::is_base_of_v<PillSettings, S>,
103 "applySettings() requires a type derived from PillSettings");
112 static_assert(std::is_base_of_v<PillTheme, T>,
113 "applyTheme() requires a type derived from PillTheme");
119 template<
typename St>
122 static_assert(std::is_base_of_v<PillSettings, St> &&
123 std::is_base_of_v<PillTheme, St>,
124 "applyStyle() requires a type derived from both PillSettings and PillTheme");
134 [[nodiscard]]
bool isOn()
const;
157 template<
typename MANIFEST>
Base class for all Malena manifests.
unsigned int getCharacterSize() const
Alias for getFontSize() — matches SFML naming convention.
PillToggleManifest::Flag Flag
void setPosition(const sf::Vector2f &position) override
void applySettings(const S &s)
Apply layout/behaviour settings. Theme layer is unaffected.
sf::FloatRect getGlobalBounds() const override
void setEnabled(bool enabled)
void onThemeApplied(const Theme &theme) override
Called by ThemeManager when the active theme changes.
void onToggled(std::function< void(bool)> callback)
void draw(sf::RenderTarget &target, sf::RenderStates states) const override
sf::Vector2f getPosition() const override
void applyStyle(const St &s)
Apply settings and theme in one call.
PillToggleManifest::State State
void applyTheme(const T &t)
Apply color/font theme. Settings layer is unaffected.
void setCharacterSize(unsigned int size)
Alias for setFontSize() — matches SFML naming convention.
Component< M, Traits... > ComponentWith
Alias for Component<M, Traits...>.
@ HOVERED
Mouse is currently over this component (set by HoverableDispatcher).
Vector2< float > Vector2f
void setFontSize(unsigned int s)
unsigned int getFontSize() const
Layout and behaviour settings for PillToggle.
Theme tokens for the PillToggle (iOS-style oval switch).
Universal design token set applied across all Themeable components.