diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-08 10:58:18 +0200 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-08 11:02:40 +0200 |
commit | 0452ce8e5ada7ddc20d7ec8aa3bdd1e8a93b0687 (patch) | |
tree | a9e9e39bfe925c27612d08bfa018d610cb0eea6f | |
parent | 24d218f216b57f28d428c88279d9f098f7a0acb0 (diff) | |
download | mana-0452ce8e5ada7ddc20d7ec8aa3bdd1e8a93b0687.tar.gz mana-0452ce8e5ada7ddc20d7ec8aa3bdd1e8a93b0687.tar.bz2 mana-0452ce8e5ada7ddc20d7ec8aa3bdd1e8a93b0687.tar.xz mana-0452ce8e5ada7ddc20d7ec8aa3bdd1e8a93b0687.zip |
Reintroduced the cancel button of ItemAmountWindow
Removed the close button instead. Also, the "All" button now only puts
the slider at the maximum and won't also finish the dialog, since that
is quite unexpected.
This reverts commit ec4656af8e2d1946ea2b1d036457c885a9e420dd.
-rw-r--r-- | src/gui/itemamount.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/gui/itemamount.cpp b/src/gui/itemamount.cpp index 32ad4706..a8389913 100644 --- a/src/gui/itemamount.cpp +++ b/src/gui/itemamount.cpp @@ -68,8 +68,6 @@ ItemAmountWindow::ItemAmountWindow(Usage usage, Window *parent, Item *item, if (!mMax) mMax = mItem->getQuantity(); - setCloseButton(true); - // Integer field mItemAmountTextField = new IntTextField(1); mItemAmountTextField->setRange(1, mMax); @@ -86,6 +84,7 @@ ItemAmountWindow::ItemAmountWindow(Usage usage, Window *parent, Item *item, Button *minusButton = new Button("-", "Minus", this); Button *plusButton = new Button("+", "Plus", this); Button *okButton = new Button(_("Ok"), "Ok", this); + Button *cancelButton = new Button(_("Cancel"), "Cancel", this); Button *addAllButton = new Button(_("All"), "All", this); minusButton->adjustSize(); @@ -101,6 +100,7 @@ ItemAmountWindow::ItemAmountWindow(Usage usage, Window *parent, Item *item, place = getPlacer(0, 1); place(0, 0, mItemAmountSlide, 6); place = getPlacer(0, 2); + place(4, 0, cancelButton); place(5, 0, okButton); reflowLayout(225, 0); @@ -138,7 +138,11 @@ void ItemAmountWindow::action(const gcn::ActionEvent &event) { int amount = mItemAmountTextField->getValue(); - if (event.getId() == "Plus" && amount < mMax) + if (event.getId() == "Cancel") + { + close(); + } + else if (event.getId() == "Plus" && amount < mMax) { amount++; } @@ -146,17 +150,17 @@ void ItemAmountWindow::action(const gcn::ActionEvent &event) { amount--; } + else if (event.getId() == "All") + { + amount = mMax; + } else if (event.getId() == "Slide") { amount = static_cast<int>(mItemAmountSlide->getValue()); } - else if (event.getId() == "Ok" || event.getId() == "All") + else if (event.getId() == "Ok") { - if (event.getId() == "All") - amount = mMax; - finish(mItem, amount, mUsage); - scheduleDelete(); return; } |