summaryrefslogtreecommitdiff
path: root/src/gui/item_amount.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2005-10-20 11:33:17 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2005-10-20 11:33:17 +0000
commitce2813cb1f4988669422c6af3e8c4442776e45c8 (patch)
tree098177c279f5376bd27d4db30f913f6e61471537 /src/gui/item_amount.cpp
parent5acb9213cc2ee949a252a5c08a9a9a13542b94d5 (diff)
downloadMana-ce2813cb1f4988669422c6af3e8c4442776e45c8.tar.gz
Mana-ce2813cb1f4988669422c6af3e8c4442776e45c8.tar.bz2
Mana-ce2813cb1f4988669422c6af3e8c4442776e45c8.tar.xz
Mana-ce2813cb1f4988669422c6af3e8c4442776e45c8.zip
Added garbage collection to the ScrollArea class. Fixed slider not being updated in the item amount box when the buttons are used.
Diffstat (limited to 'src/gui/item_amount.cpp')
-rw-r--r--src/gui/item_amount.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gui/item_amount.cpp b/src/gui/item_amount.cpp
index f308b7ab..d92f53e1 100644
--- a/src/gui/item_amount.cpp
+++ b/src/gui/item_amount.cpp
@@ -106,6 +106,7 @@ void ItemAmountWindow::resetAmount()
void ItemAmountWindow::action(const std::string& eventId)
{
+ int amount = mItemAmountTextBox->getInt();
if (eventId == "Cancel")
{
@@ -123,15 +124,18 @@ void ItemAmountWindow::action(const std::string& eventId)
}
else if (eventId == "Plus")
{
- mItemAmountTextBox->setInt(mItemAmountTextBox->getInt() + 1);
+ amount++;
}
else if (eventId == "Minus")
{
- mItemAmountTextBox->setInt(mItemAmountTextBox->getInt() - 1);
+ amount--;
}
else if (eventId == "Slide")
{
- mItemAmountTextBox->setInt((int)(mItemAmountSlide->getValue()*mItem->getQuantity()));
+ amount = (int)(mItemAmountSlide->getValue()*(mItem->getQuantity()+1));
}
+ mItemAmountTextBox->setInt(amount);
+ amount = mItemAmountTextBox->getInt(); // The textbox cares about bounds
+ mItemAmountSlide->setValue((amount-1)*1.0f/(mItem->getQuantity()-1));
}