summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2009-10-29 23:13:06 +0200
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2009-10-29 23:23:34 +0100
commit1c0ee2fc301d88c5c696392d9959e82e2acd0086 (patch)
treed7ad6b099e6978ad88690b73c060ae6869dea4f0 /src
parentf1c60e9a64bedb907bb8172c2927dc04aaeef6f0 (diff)
downloadMana-1c0ee2fc301d88c5c696392d9959e82e2acd0086.tar.gz
Mana-1c0ee2fc301d88c5c696392d9959e82e2acd0086.tar.bz2
Mana-1c0ee2fc301d88c5c696392d9959e82e2acd0086.tar.xz
Mana-1c0ee2fc301d88c5c696392d9959e82e2acd0086.zip
Small refactoring ItemAmountWindow
Diffstat (limited to 'src')
-rw-r--r--src/gui/itemamount.cpp15
-rw-r--r--src/gui/itemamount.h2
2 files changed, 8 insertions, 9 deletions
diff --git a/src/gui/itemamount.cpp b/src/gui/itemamount.cpp
index 71e19e3c..e0162eda 100644
--- a/src/gui/itemamount.cpp
+++ b/src/gui/itemamount.cpp
@@ -148,6 +148,11 @@ ItemAmountWindow::ItemAmountWindow(Usage usage, Window *parent, Item *item,
mItemIcon->addMouseListener(this);
}
+ItemAmountWindow::~ItemAmountWindow()
+{
+ delete mItemPopup;
+}
+
// Show ItemTooltip
void ItemAmountWindow::mouseMoved(gcn::MouseEvent &event)
{
@@ -196,7 +201,7 @@ void ItemAmountWindow::action(const gcn::ActionEvent &event)
else if (event.getId() == "ok")
{
finish(mItem, amount, mUsage);
- scheduleDelete();
+ close();
return;
}
mItemAmountTextField->setValue(amount);
@@ -205,7 +210,7 @@ void ItemAmountWindow::action(const gcn::ActionEvent &event)
void ItemAmountWindow::close()
{
- delete mItemPopup;
+ keyboard.setEnabled(mEnabledKeyboard);
scheduleDelete();
}
@@ -229,9 +234,3 @@ void ItemAmountWindow::showWindow(Usage usage, Window *parent, Item *item,
new ItemAmountWindow(usage, parent, item, maxRange);
}
}
-
-void ItemAmountWindow::scheduleDelete()
-{
- keyboard.setEnabled(mEnabledKeyboard);
- Window::scheduleDelete();
-}
diff --git a/src/gui/itemamount.h b/src/gui/itemamount.h
index 52b72a38..72db3444 100644
--- a/src/gui/itemamount.h
+++ b/src/gui/itemamount.h
@@ -77,7 +77,7 @@ class ItemAmountWindow : public Window,
static void showWindow(Usage usage, Window *parent, Item *item,
int maxRange = 0);
- void scheduleDelete();
+ ~ItemAmountWindow();
private:
static void finish(Item *item, int amount, Usage usage);