summaryrefslogtreecommitdiff
path: root/src/gui/ok_dialog.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-03-06 10:38:07 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-03-06 10:38:07 +0100
commit7cbdab589491e007adacd7597c769cdb9308a32c (patch)
tree0269c37cccbed49a1cb15db9de816f39ef549189 /src/gui/ok_dialog.cpp
parent616afb27c23def5661b3466d6fc86fd1c65c0082 (diff)
parentaa4229cbb9f2b264ca96c3beedc66b1c79ccc1f5 (diff)
downloadmana-7cbdab589491e007adacd7597c769cdb9308a32c.tar.gz
mana-7cbdab589491e007adacd7597c769cdb9308a32c.tar.bz2
mana-7cbdab589491e007adacd7597c769cdb9308a32c.tar.xz
mana-7cbdab589491e007adacd7597c769cdb9308a32c.zip
Merge branch 'aethyra/master'
Conflicts: src/being.cpp src/being.h src/floor_item.cpp src/floor_item.h src/flooritemmanager.cpp src/gui/inventorywindow.cpp src/gui/inventorywindow.h src/gui/itemcontainer.cpp src/gui/popupmenu.cpp src/net/beinghandler.cpp src/npc.cpp
Diffstat (limited to 'src/gui/ok_dialog.cpp')
-rw-r--r--src/gui/ok_dialog.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/gui/ok_dialog.cpp b/src/gui/ok_dialog.cpp
index 4df3fa07..d73c7d7c 100644
--- a/src/gui/ok_dialog.cpp
+++ b/src/gui/ok_dialog.cpp
@@ -22,6 +22,7 @@
#include <guichan/font.hpp>
#include "button.h"
+#include "gui.h"
#include "ok_dialog.h"
#include "scrollarea.h"
#include "textbox.h"
@@ -46,14 +47,15 @@ OkDialog::OkDialog(const std::string &title, const std::string &msg,
mTextBox->setTextWrapped(msg, 260);
int numRows = mTextBox->getNumberOfRows();
+ const int fontHeight = getFont()->getHeight();
if (numRows > 1)
{
- // 15 == height of each line of text (based on font heights)
// 14 == row top + bottom graphic pixel heights
- setContentSize(mTextBox->getMinWidth() + 15, 15 + (numRows * 15) + okButton->getHeight());
+ setContentSize(mTextBox->getMinWidth() + fontHeight, ((numRows + 1) *
+ fontHeight) + okButton->getHeight());
mTextArea->setDimension(gcn::Rectangle(4, 5, mTextBox->getMinWidth() + 5,
- 3 + (numRows * 14)));
+ 3 + (numRows * fontHeight)));
}
else
{
@@ -62,12 +64,12 @@ OkDialog::OkDialog(const std::string &title, const std::string &msg,
width = getFont()->getWidth(msg);
if (width < okButton->getWidth())
width = okButton->getWidth();
- setContentSize(width + 15, 30 + okButton->getHeight());
+ setContentSize(width + fontHeight, 30 + okButton->getHeight());
mTextArea->setDimension(gcn::Rectangle(4, 5, width + 5, 17));
}
okButton->setPosition((mTextBox->getMinWidth() - okButton->getWidth()) / 2,
- (numRows * 14) + okButton->getHeight() - 8);
+ ((numRows - 1) * fontHeight) + okButton->getHeight() + 2);
add(mTextArea);
add(okButton);
@@ -92,7 +94,6 @@ void OkDialog::action(const gcn::ActionEvent &event)
}
// Can we receive anything else anyway?
- if (event.getId() == "ok") {
+ if (event.getId() == "ok")
scheduleDelete();
- }
}