Esempio n. 1
0
    TGUI_API std::shared_ptr<DataIO::Node> saveButton(Button::Ptr button)
    {
        auto node = saveWidget(button);

        if (!button->getText().isEmpty())
            SET_PROPERTY("Text", Serializer::serialize(button->getText()));

        SET_PROPERTY("TextSize", tgui::to_string(button->getTextSize()));
        return node;
    }
Esempio n. 2
0
    MessageBox::MessageBox(const MessageBox& messageBoxToCopy) :
        ChildWindow      {messageBoxToCopy},
        m_loadedThemeFile(messageBoxToCopy.m_loadedThemeFile), // Did not compile in VS2013 when using braces
        m_buttonClassName(messageBoxToCopy.m_buttonClassName), // Did not compile in VS2013 when using braces
        m_textSize       {messageBoxToCopy.m_textSize}
    {
        m_label = Label::copy(messageBoxToCopy.m_label);
        add(m_label, "#TGUI_INTERNAL$MessageBoxText#");

        for (auto it = messageBoxToCopy.m_buttons.begin(); it != messageBoxToCopy.m_buttons.end(); ++it)
        {
            Button::Ptr button = Button::copy(*it);
            button->disconnectAll();
            button->connect("Pressed", [=]() { m_callback.text = button->getText(); sendSignal("ButtonPressed", button->getText()); });

            m_buttons.push_back(button);
        }
    }