summaryrefslogtreecommitdiff
path: root/src/gui/okdialog.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-18 18:37:10 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-18 18:37:10 +0300
commit2b4110a217110dfe9919fa3cc70e41c6920ac597 (patch)
treec74a6708f184a3866b58d40dd79c00ba327d37ac /src/gui/okdialog.cpp
parentbe7d563ba1e0b20cfe397f2cf4da6f7e3df78d22 (diff)
downloadmanaplus-2b4110a217110dfe9919fa3cc70e41c6920ac597.tar.gz
manaplus-2b4110a217110dfe9919fa3cc70e41c6920ac597.tar.bz2
manaplus-2b4110a217110dfe9919fa3cc70e41c6920ac597.tar.xz
manaplus-2b4110a217110dfe9919fa3cc70e41c6920ac597.zip
Fix ok dialog resize issue.
Also allow set from ouside preferred width.
Diffstat (limited to 'src/gui/okdialog.cpp')
-rw-r--r--src/gui/okdialog.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gui/okdialog.cpp b/src/gui/okdialog.cpp
index 22ae9d41a..5a2e39022 100644
--- a/src/gui/okdialog.cpp
+++ b/src/gui/okdialog.cpp
@@ -37,14 +37,15 @@
OkDialog::OkDialog(const std::string &title, const std::string &msg,
const int soundEvent, const bool modal,
- const bool showCenter, Window *const parent):
+ const bool showCenter, Window *const parent,
+ const int minWidth) :
Window(title, modal, parent, "ok.xml"),
ActionListener(),
mTextBox(new TextBox)
{
mTextBox->setEditable(false);
mTextBox->setOpaque(false);
- mTextBox->setTextWrapped(msg, 260);
+ mTextBox->setTextWrapped(msg, minWidth);
Button *const okButton = new Button(_("OK"), "ok", this);
@@ -58,8 +59,8 @@ OkDialog::OkDialog(const std::string &title, const std::string &msg,
if (width < okButton->getWidth())
width = okButton->getWidth();
- setContentSize(mTextBox->getMinWidth() + fontHeight, height +
- fontHeight + okButton->getHeight());
+ width = mTextBox->getWidth() + fontHeight;
+ setContentSize(width, height + fontHeight + okButton->getHeight());
mTextBox->setPosition(getPadding(), getPadding());
// 8 is the padding that GUIChan adds to button widgets