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;
116 bool _confirmed =
false;
119 std::function<void()> _onConfirm;
120 std::function<void()> _onDismiss;
124 bool hasButtons()
const;
125 float contentTop()
const;
126 float contentHeight()
const;
128 void applyAlphaToColor(
sf::Color& c,
float alpha)
const;
174 static_assert(std::is_base_of_v<ModalSettings, S>,
175 "applySettings() requires a type derived from ModalSettings");
183 static_assert(std::is_base_of_v<ModalTheme, T>,
184 "applyTheme() requires a type derived from ModalTheme");
188 template<
typename St>
191 static_assert(std::is_base_of_v<ModalSettings, St> &&
192 std::is_base_of_v<ModalTheme, St>,
193 "applyStyle() requires ModalSettings and ModalTheme");
210 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.