summaryrefslogtreecommitdiff
path: root/src/gui/item_amount.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-03-18 14:20:14 -0600
committerIra Rice <irarice@gmail.com>2009-03-18 19:55:11 -0600
commit6f0d88e781c8b1a75858c769b3641aa8cd477314 (patch)
tree98891d219272074e437cd58087a7aaafc463c40a /src/gui/item_amount.cpp
parent74fa304602e0e7ad845e606db8868b32f1d10864 (diff)
downloadmana-client-6f0d88e781c8b1a75858c769b3641aa8cd477314.tar.gz
mana-client-6f0d88e781c8b1a75858c769b3641aa8cd477314.tar.bz2
mana-client-6f0d88e781c8b1a75858c769b3641aa8cd477314.tar.xz
mana-client-6f0d88e781c8b1a75858c769b3641aa8cd477314.zip
Fix up the NPC interraction widnows a bit
Diffstat (limited to 'src/gui/item_amount.cpp')
-rw-r--r--src/gui/item_amount.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/gui/item_amount.cpp b/src/gui/item_amount.cpp
index 8208d323..c5b27524 100644
--- a/src/gui/item_amount.cpp
+++ b/src/gui/item_amount.cpp
@@ -36,7 +36,9 @@
ItemAmountWindow::ItemAmountWindow(int usage, Window *parent, Item *item):
Window("", true, parent),
- mItem(item), mUsage(usage), mMax(mItem->getQuantity())
+ mItem(item),
+ mMax(item->getQuantity()),
+ mUsage(usage)
{
// Integer field
mItemAmountTextField = new IntTextField(1);
@@ -53,10 +55,8 @@ ItemAmountWindow::ItemAmountWindow(int usage, Window *parent, Item *item):
// Buttons
Button *minusButton = new Button("-", "Minus", this);
- minusButton->setSize(20, 20);
Button *plusButton = new Button("+", "Plus", this);
- plusButton->setSize(20, 20);
- Button *okButton = new Button(_("Ok"), "Drop", this);
+ Button *okButton = new Button(_("Ok"), "Ok", this);
Button *cancelButton = new Button(_("Cancel"), "Cancel", this);
Button *addAllButton = new Button(_("All"), "All", this);
@@ -64,10 +64,10 @@ ItemAmountWindow::ItemAmountWindow(int usage, Window *parent, Item *item):
place(0, 0, minusButton);
place(1, 0, mItemAmountTextField).setPadding(2);
place(2, 0, plusButton);
- place(4, 0, addAllButton, 2);
+ place(5, 0, addAllButton);
place(0, 1, mItemAmountSlide, 6);
- place(4, 2, okButton);
- place(5, 2, cancelButton);
+ place(4, 2, cancelButton);
+ place(5, 2, okButton);
reflowLayout(250, 0);
resetAmount();
@@ -101,17 +101,17 @@ void ItemAmountWindow::resetAmount()
void ItemAmountWindow::action(const gcn::ActionEvent &event)
{
- int amount = mItemAmountTextField->getValue();
+ int amount = mItemAmountSlide->getValue();
if (event.getId() == "Cancel")
{
scheduleDelete();
}
- else if (event.getId() == "Plus")
+ else if (event.getId() == "Plus" && amount < mMax)
{
amount++;
}
- else if (event.getId() == "Minus")
+ else if (event.getId() == "Minus" && amount > 0)
{
amount--;
}
@@ -121,9 +121,8 @@ void ItemAmountWindow::action(const gcn::ActionEvent &event)
}
else if (event.getId() == "Ok" || event.getId() == "All")
{
- if (event.getId() == "All") {
+ if (event.getId() == "All")
amount = mMax;
- }
switch (mUsage)
{
@@ -145,6 +144,7 @@ void ItemAmountWindow::action(const gcn::ActionEvent &event)
}
scheduleDelete();
+ return;
}
mItemAmountTextField->setValue(amount);