summaryrefslogtreecommitdiff
path: root/src/gui/npc_text.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-01-20 13:31:58 -0700
committerIra Rice <irarice@gmail.com>2009-01-20 13:31:58 -0700
commit81307dac7d573af4c50eca983843a9575e1b3f03 (patch)
tree15e2bdb15584d49cc2ff371d5d173fa9ddfe73c8 /src/gui/npc_text.cpp
parent6498f9a6b140385b1614fe59abc4f5981d050050 (diff)
downloadmana-81307dac7d573af4c50eca983843a9575e1b3f03.tar.gz
mana-81307dac7d573af4c50eca983843a9575e1b3f03.tar.bz2
mana-81307dac7d573af4c50eca983843a9575e1b3f03.tar.xz
mana-81307dac7d573af4c50eca983843a9575e1b3f03.zip
Reflowed NPC text dialog to use the layout code, so that window resizing
isn't broken. Also added a string which should be translated in the Buy class for substitution by gettext. Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui/npc_text.cpp')
-rw-r--r--src/gui/npc_text.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp
index fde5dc9c..2d57f460 100644
--- a/src/gui/npc_text.cpp
+++ b/src/gui/npc_text.cpp
@@ -26,6 +26,8 @@
#include "button.h"
#include "scrollarea.h"
+#include "widgets/layout.h"
+
#include "../npc.h"
#include "../utils/gettext.h"
@@ -38,24 +40,27 @@ NpcTextDialog::NpcTextDialog():
setMinWidth(200);
setMinHeight(150);
+ setDefaultSize(0, 0, 260, 175);
+
mBrowserBox = new BrowserBox(BrowserBox::AUTO_WRAP);
mBrowserBox->setOpaque(true);
scrollArea = new ScrollArea(mBrowserBox);
okButton = new Button(_("OK"), "ok", this);
- setContentSize(260, 175);
scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
scrollArea->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS);
- scrollArea->setDimension(gcn::Rectangle(
- 5, 5, 250, 160 - okButton->getHeight()));
- okButton->setPosition(
- 260 - 5 - okButton->getWidth(),
- 175 - 5 - okButton->getHeight());
add(scrollArea);
add(okButton);
+ place(0, 0, scrollArea, 5).setPadding(3);
+ place(4, 1, okButton);
+
+ Layout &layout = getLayout();
+ layout.setRowHeight(0, Layout::AUTO_SET);
+
+ loadWindowState();
setLocationRelativeTo(getParent());
}