diff options
Diffstat (limited to 'src/gui/itemamount.cpp')
-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; } |