26#ifndef TGUI_MESSAGE_BOX_HPP
27#define TGUI_MESSAGE_BOX_HPP
30#include <TGUI/Widgets/Label.hpp>
31#include <TGUI/Widgets/Button.hpp>
32#include <TGUI/Widgets/ChildWindow.hpp>
33#include <TGUI/Renderers/MessageBoxRenderer.hpp>
48 typedef std::shared_ptr<MessageBox>
Ptr;
49 typedef std::shared_ptr<const MessageBox>
ConstPtr;
67 static MessageBox::Ptr create(sf::String title =
"", sf::String text =
"", std::vector<sf::String> buttons = {});
207 std::unique_ptr<DataIO::Node>
save(SavingRenderersMap& renderers)
const override;
213 void load(
const std::unique_ptr<DataIO::Node>& node,
const LoadingRenderersMap& renderers)
override;
221 return std::make_shared<MessageBox>(*
this);
231 void identifyLabelAndButtons();
237 SignalString onButtonPress = {
"ButtonPressed"};
243 std::string m_loadedThemeFile;
244 std::string m_buttonClassName;
246 std::vector<Button::Ptr> m_buttons;
Child window widget.
Definition: ChildWindow.hpp:44
std::shared_ptr< Label > Ptr
Shared widget pointer.
Definition: Label.hpp:47
static Label::Ptr create(sf::String text="")
Creates a new label widget.
Definition: MessageBoxRenderer.hpp:37
Message box widget.
Definition: MessageBox.hpp:45
void load(const std::unique_ptr< DataIO::Node > &node, const LoadingRenderersMap &renderers) override
Loads the widget from a tree of nodes.
std::vector< sf::String > getButtons() const
Returns the caption of the buttons.
const sf::String & getText() const
Returns the text of the message box.
void setTextSize(unsigned int size) override
Changes the character size of the text.
Signal & getSignal(std::string signalName) override
Retrieves a signal based on its name.
std::unique_ptr< DataIO::Node > save(SavingRenderersMap &renderers) const override
Saves the widget as a tree node in order to save it to a file.
MessageBox(MessageBox &©)
Move constructor.
MessageBox(const MessageBox ©)
Copy constructor.
void setText(const sf::String &text)
Changes the text of the message box.
MessageBoxRenderer * getRenderer()
Returns the renderer, which gives access to functions that determine how the widget is displayed.
static MessageBox::Ptr create(sf::String title="", sf::String text="", std::vector< sf::String > buttons={})
Creates a new message box widget.
MessageBoxRenderer * getSharedRenderer()
Returns the renderer, which gives access to functions that determine how the widget is displayed.
std::shared_ptr< MessageBox > Ptr
Shared widget pointer.
Definition: MessageBox.hpp:48
std::shared_ptr< const MessageBox > ConstPtr
Shared constant widget pointer.
Definition: MessageBox.hpp:49
Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
Definition: MessageBox.hpp:219
void addButton(const sf::String &buttonCaption)
Adds a button to the message box.
static MessageBox::Ptr copy(MessageBox::ConstPtr messageBox)
Makes a copy of another message box.
void rendererChanged(const std::string &property) override
Function called when one of the properties of the renderer is changed.
Signal to which the user can subscribe to get callbacks from.
Definition: Signal.hpp:231
Namespace that contains all TGUI functions and classes.
Definition: AbsoluteOrRelativeValue.hpp:37