diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-03-27 13:25:04 +0100 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-03-27 13:25:24 +0100 |
commit | dd05447445dc1766e532130318af2cb6bb72a994 (patch) | |
tree | c8b2cbac64ccf9545a39c143088b57fe2cb8e678 /src/gui/confirm_dialog.cpp | |
parent | 05e753294c1a603252d2eed4b1731c3f50543a7e (diff) | |
parent | 2aab736bc5d77ffda789d7de56cef100fac207e1 (diff) | |
download | mana-dd05447445dc1766e532130318af2cb6bb72a994.tar.gz mana-dd05447445dc1766e532130318af2cb6bb72a994.tar.bz2 mana-dd05447445dc1766e532130318af2cb6bb72a994.tar.xz mana-dd05447445dc1766e532130318af2cb6bb72a994.zip |
Merge branch 'aethyra/master'
Conflicts:
src/beingmanager.cpp
src/gui/confirm_dialog.cpp
src/gui/inventorywindow.cpp
src/gui/inventorywindow.h
src/gui/label.cpp
src/gui/label.h
src/gui/popup.cpp
src/gui/popup.h
src/gui/scrollarea.cpp
src/gui/skin.cpp
src/gui/skin.h
src/gui/speechbubble.cpp
src/gui/window.cpp
src/gui/window.h
src/localplayer.h
src/main.cpp
src/net/ea/playerhandler.cpp
src/resources/ambientoverlay.h
src/resources/dye.cpp
src/resources/imagewriter.cpp
src/resources/itemdb.cpp
src/shopitem.cpp
Diffstat (limited to 'src/gui/confirm_dialog.cpp')
-rw-r--r-- | src/gui/confirm_dialog.cpp | 47 |
1 files changed, 19 insertions, 28 deletions
diff --git a/src/gui/confirm_dialog.cpp b/src/gui/confirm_dialog.cpp index a40593e3..e1c32759 100644 --- a/src/gui/confirm_dialog.cpp +++ b/src/gui/confirm_dialog.cpp @@ -47,37 +47,28 @@ ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg, mTextBox->setTextWrapped(msg, 260); - int numRows = mTextBox->getNumberOfRows(); - int width = getFont()->getWidth(title); - int inWidth = yesButton->getWidth() + noButton->getWidth() + 5; + const int numRows = mTextBox->getNumberOfRows(); + const int inWidth = yesButton->getWidth() + noButton->getWidth() + + (2 * getPadding()); const int fontHeight = getFont()->getHeight(); + const int height = numRows * fontHeight; + int width = getFont()->getWidth(title); - if (numRows > 1) - { - // fontHeight == height of each line of text (based on font heights) - // 14 == row top + bottom graphic pixel heights - setContentSize(mTextBox->getMinWidth() + fontHeight, ((numRows + 1) * - fontHeight) + noButton->getHeight()); - mTextArea->setDimension(gcn::Rectangle(4, 5, mTextBox->getMinWidth() + 5, - 3 + (numRows * fontHeight))); - } - else - { - if (width < getFont()->getWidth(msg)) - width = getFont()->getWidth(msg); - if (width < inWidth) - width = inWidth; - setContentSize(width + fontHeight, (2 * fontHeight) + - noButton->getHeight()); - mTextArea->setDimension(gcn::Rectangle(4, 5, width + 5, 17)); - } + if (width < mTextBox->getMinWidth()) + width = mTextBox->getMinWidth(); + if (width < inWidth) + width = inWidth; + + setContentSize(mTextBox->getMinWidth() + fontHeight, height + fontHeight + + noButton->getHeight()); + mTextArea->setDimension(gcn::Rectangle(4, 5, width + 2 * getPadding(), + height + getPadding())); - yesButton->setPosition( - (mTextBox->getMinWidth() - inWidth) / 2, - ((numRows - 1) * fontHeight) + noButton->getHeight() + 2); - noButton->setPosition( - yesButton->getX() + yesButton->getWidth() + 5, - ((numRows - 1) * fontHeight) + noButton->getHeight() + 2); + // 8 is the padding that GUIChan adds to button widgets + // (top and bottom combined) + yesButton->setPosition((width - inWidth) / 2, height + 8); + noButton->setPosition(yesButton->getX() + inWidth - noButton->getWidth(), + height + 8); add(mTextArea); add(yesButton); |