From 1c0ee2fc301d88c5c696392d9959e82e2acd0086 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 29 Oct 2009 23:13:06 +0200 Subject: Small refactoring ItemAmountWindow --- src/gui/itemamount.cpp | 15 +++++++-------- src/gui/itemamount.h | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) (limited to 'src') 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); -- cgit v1.2.3-70-g09d2