5#ifndef MALENA_SEGMENTTOGGLE_H
6#define MALENA_SEGMENTTOGGLE_H
26 enum class Flag { ON, DISABLED };
62 float _thumbTarget = 0.f;
64 std::function<void(
bool)> _onToggled;
66 void syncFromSettings();
80 static_assert(std::is_base_of_v<SegmentSettings, S>,
81 "applySettings() requires a type derived from SegmentSettings");
89 static_assert(std::is_base_of_v<SegmentTheme, T>,
90 "applyTheme() requires a type derived from SegmentTheme");
98 static_assert(std::is_base_of_v<SegmentSettings, St> &&
99 std::is_base_of_v<SegmentTheme, St>,
100 "applyStyle() requires a type derived from both SegmentSettings and SegmentTheme");
108 [[nodiscard]]
bool isOn()
const;
119 template<
typename MANIFEST>
Base class for all Malena manifests.
sf::Vector2f getPosition() const override
sf::FloatRect getGlobalBounds() const override
SegmentToggleManifest::State State
void applyTheme(const T &t)
void draw(sf::RenderTarget &target, sf::RenderStates states) const override
void setPosition(const sf::Vector2f &position) override
void onToggled(std::function< void(bool)> callback)
void applySettings(const S &s)
void setEnabled(bool enabled)
SegmentToggleManifest::Flag Flag
void onThemeApplied(const Theme &theme) override
Called by ThemeManager when the active theme changes.
void applyStyle(const St &s)
Component< M, Traits... > ComponentWith
Alias for Component<M, Traits...>.
@ HOVERED
Mouse is currently over this component (set by HoverableDispatcher).
Vector2< float > Vector2f
Layout and behaviour settings for SegmentToggle.
Theme tokens for the SegmentToggle (Hotels/Apartments style).
Universal design token set applied across all Themeable components.