27 enum class Flag { VISIBLE };
94 std::string _titleStr;
95 std::string _confirmStr;
96 std::string _cancelStr;
109 bool _animating =
false;
110 bool _fadingIn =
false;
111 bool _prevDown =
false;
114 std::function<void()> _onConfirm;
115 std::function<void()> _onDismiss;
119 bool hasButtons()
const;
120 float contentTop()
const;
121 float contentHeight()
const;
123 void applyAlphaToColor(
sf::Color& c,
float alpha)
const;
169 static_assert(std::is_base_of_v<ModalSettings, S>,
170 "applySettings() requires a type derived from ModalSettings");
178 static_assert(std::is_base_of_v<ModalTheme, T>,
179 "applyTheme() requires a type derived from ModalTheme");
183 template<
typename St>
186 static_assert(std::is_base_of_v<ModalSettings, St> &&
187 std::is_base_of_v<ModalTheme, St>,
188 "applyStyle() requires ModalSettings and ModalTheme");
205 template<
typename MANIFEST>
Virtual base class for all Malena framework objects.
static const sf::Font & getDefault()
Return the built-in Arial font.
Base class for all Malena manifests.
void setConfirmLabel(const std::string &label)
Label for the confirm button. Pass empty to hide the button bar.
sf::Vector2f getPosition() const override
void draw(sf::RenderTarget &target, sf::RenderStates states) const override
void onThemeApplied(const Theme &theme) override
Called by ThemeManager when the active theme changes.
Modal(const sf::Font &font=FontManager<>::getDefault())
void setCancelLabel(const std::string &label)
Label for the cancel button. Pass empty to show only the confirm button.
void setPosition(const sf::Vector2f &pos) override
void applyStyle(const St &s)
sf::FloatRect getGlobalBounds() const override
void applyTheme(const T &t)
void setTitle(const std::string &title)
Text displayed in the title bar. Pass an empty string to hide it.
void onConfirm(std::function< void()> cb)
Fired when the confirm button is clicked.
void applySettings(const S &s)
ModalManifest::State State
void onDismiss(std::function< void()> cb)
Fired when dismissed — cancel button, close button, or backdrop tap.
void setContent(ml::Core &content)
Component drawn in the content area. The Modal positions it.
Modal with an attached manifest.
Modal(const sf::Font &font=FontManager<>::getDefault())
A framework-integrated text object with word-wrap support.
Component< M, Traits... > ComponentWith
Alias for Component<M, Traits...>.
@ HIDDEN
Component should not be drawn.
Vector2< float > Vector2f
Universal design token set applied across all Themeable components.