summaryrefslogtreecommitdiff
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
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>
-rw-r--r--src/gui/buy.cpp2
-rw-r--r--src/gui/npc_text.cpp17
2 files changed, 12 insertions, 7 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index 0717efa6..496c8cd7 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -42,7 +42,7 @@ BuyDialog::BuyDialog(Network *network):
Window(_("Buy")), mNetwork(network),
mMoney(0), mAmountItems(0), mMaxItems(0)
{
- setWindowName("Buy");
+ setWindowName(_("Buy"));
setResizable(true);
setMinWidth(260);
setMinHeight(230);
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());
}