diff options
author | Fate <fate-tmw@googlemail.com> | 2008-12-06 19:50:57 -0700 |
---|---|---|
committer | Fate <fate-tmw@googlemail.com> | 2008-12-06 19:50:57 -0700 |
commit | 483941ef2a4faef54865b3ce2e316cb32ed8cf64 (patch) | |
tree | a542f040a80497eca957c36adbfb490ed419b02b /src/gui/npclistdialog.cpp | |
parent | 617fb41e21710856c1451058481e5df3756fb355 (diff) | |
parent | 416e28057f5a6073a2ef44f296ed1c8bc1280bf6 (diff) | |
download | mana-client-483941ef2a4faef54865b3ce2e316cb32ed8cf64.tar.gz mana-client-483941ef2a4faef54865b3ce2e316cb32ed8cf64.tar.bz2 mana-client-483941ef2a4faef54865b3ce2e316cb32ed8cf64.tar.xz mana-client-483941ef2a4faef54865b3ce2e316cb32ed8cf64.zip |
Merge branch 'master' of git@gitorious.org:tmw/eathena
Diffstat (limited to 'src/gui/npclistdialog.cpp')
-rw-r--r-- | src/gui/npclistdialog.cpp | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp index 90444f1a..cdd38312 100644 --- a/src/gui/npclistdialog.cpp +++ b/src/gui/npclistdialog.cpp @@ -32,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); @@ -59,37 +64,49 @@ NpcListDialog::NpcListDialog(): setLocationRelativeTo(getParent()); } -int -NpcListDialog::getNumberOfElements() +int NpcListDialog::getNumberOfElements() { return mItems.size(); } -std::string -NpcListDialog::getElementAt(int i) +std::string NpcListDialog::getElementAt(int i) { return mItems[i]; } -void -NpcListDialog::parseItems(const std::string &itemString) +void NpcListDialog::parseItems(const std::string &itemString) { std::istringstream iss(itemString); std::string tmp; - while(getline(iss, tmp, ':')) { + while (getline(iss, tmp, ':')) mItems.push_back(tmp); - } } -void -NpcListDialog::reset() +void NpcListDialog::reset() { mItems.clear(); } -void -NpcListDialog::action(const gcn::ActionEvent &event) +void NpcListDialog::widgetResized(const gcn::Event &event) +{ + Window::widgetResized(event); + + 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) { int choice = 0; |