summaryrefslogtreecommitdiff
path: root/src/gui/npclistdialog.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2008-11-01 03:36:47 +0000
committerIra Rice <irarice@gmail.com>2008-11-01 03:36:47 +0000
commit81299ca9acc39dec62e1e504781721ad0db0d471 (patch)
tree7732a30d6b3bf57582f3cababceb8d7b4045be0d /src/gui/npclistdialog.cpp
parentd433f836a690199a89781a1c7f694620e7a1ad27 (diff)
downloadmana-client-81299ca9acc39dec62e1e504781721ad0db0d471.tar.gz
mana-client-81299ca9acc39dec62e1e504781721ad0db0d471.tar.bz2
mana-client-81299ca9acc39dec62e1e504781721ad0db0d471.tar.xz
mana-client-81299ca9acc39dec62e1e504781721ad0db0d471.zip
Made NPC dialogues resizeable.
Diffstat (limited to 'src/gui/npclistdialog.cpp')
-rw-r--r--src/gui/npclistdialog.cpp35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp
index e6523583..3203ba84 100644
--- a/src/gui/npclistdialog.cpp
+++ b/src/gui/npclistdialog.cpp
@@ -25,8 +25,6 @@
#include <sstream>
-#include "button.h"
-#include "scrollarea.h"
#include "listbox.h"
#include "../npc.h"
@@ -34,10 +32,15 @@
NpcListDialog::NpcListDialog():
Window("NPC")
{
+ setResizable(true);
+
+ setMinWidth(200);
+ setMinHeight(150);
+
mItemList = new ListBox(this);
- ScrollArea *scrollArea = new ScrollArea(mItemList);
- Button *okButton = new Button("OK", "ok", this);
- Button *cancelButton = new Button("Cancel", "cancel", this);
+ scrollArea = new ScrollArea(mItemList);
+ okButton = new Button("OK", "ok", this);
+ cancelButton = new Button("Cancel", "cancel", this);
setContentSize(260, 175);
scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
@@ -90,6 +93,28 @@ NpcListDialog::reset()
mItems.clear();
}
+void NpcListDialog::widgetResized(const gcn::Event &event)
+{
+ Window::widgetResized(event);
+ draw();
+}
+
+void NpcListDialog::draw()
+{
+ const gcn::Rectangle &area = getChildrenArea();
+ const int width = area.width;
+ const int height = area.height;
+
+ scrollArea->setDimension(gcn::Rectangle(
+ 5, 5, width - 10, height - 15 - okButton->getHeight()));
+ cancelButton->setPosition(
+ width - 5 - cancelButton->getWidth(),
+ height - 5 - cancelButton->getHeight());
+ okButton->setPosition(
+ cancelButton->getX() - 5 - okButton->getWidth(),
+ cancelButton->getY());
+}
+
void
NpcListDialog::action(const gcn::ActionEvent &event)
{