From 80ab56a4a548cf4a6b340feee4ea48449bafbafd Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 1 Nov 2012 00:45:22 +0300 Subject: Fix ok dialog size with small messages. --- src/gui/okdialog.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/gui/okdialog.cpp') diff --git a/src/gui/okdialog.cpp b/src/gui/okdialog.cpp index 0a0c32baa..5d0f2a01f 100644 --- a/src/gui/okdialog.cpp +++ b/src/gui/okdialog.cpp @@ -56,11 +56,13 @@ OkDialog::OkDialog(const std::string &title, const std::string &msg, if (width < okButton->getWidth()) width = okButton->getWidth(); - width = mTextBox->getWidth(); + if (mTextBox->getWidth() > width) + width = mTextBox->getWidth(); + if (okButton->getWidth() > width) + width = okButton->getWidth(); setContentSize(width, mTextBox->getHeight() + okButton->getHeight() + getOption("buttonPadding", 8)); - mTextBox->setPosition(0, 0); - + mTextBox->setPosition((width - mTextBox->getWidth()) / 2, 0); okButton->setPosition((width - okButton->getWidth()) / 2, mTextBox->getHeight() + getOption("buttonPadding", 8)); -- cgit v1.2.3-70-g09d2