summaryrefslogtreecommitdiff
path: root/src/gui/item_amount.cpp
diff options
context:
space:
mode:
authorCedric Borgese <cedric.borgese@gmail.com>2005-07-22 17:27:59 +0000
committerCedric Borgese <cedric.borgese@gmail.com>2005-07-22 17:27:59 +0000
commit5731ddbf5ef5fa1556a7c5f84c0c71865a15499b (patch)
tree967cfacdf62a8930be9691152746b6f0e6b35a6e /src/gui/item_amount.cpp
parent4333effa0e80c996c91e4014cf449c30a32120b7 (diff)
downloadmana-5731ddbf5ef5fa1556a7c5f84c0c71865a15499b.tar.gz
mana-5731ddbf5ef5fa1556a7c5f84c0c71865a15499b.tar.bz2
mana-5731ddbf5ef5fa1556a7c5f84c0c71865a15499b.tar.xz
mana-5731ddbf5ef5fa1556a7c5f84c0c71865a15499b.zip
Merge between moi1392's branch and head
Diffstat (limited to 'src/gui/item_amount.cpp')
-rw-r--r--src/gui/item_amount.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/gui/item_amount.cpp b/src/gui/item_amount.cpp
index eb3a4c5c..51b67e72 100644
--- a/src/gui/item_amount.cpp
+++ b/src/gui/item_amount.cpp
@@ -25,6 +25,7 @@
#include "inventorywindow.h"
#include "trade.h"
#include "button.h"
+#include "slider.h"
ItemAmountWindow::ItemAmountWindow(int usage, Window *parent):
Window("Select amount of items to drop.", true, parent)
@@ -35,14 +36,17 @@ ItemAmountWindow::ItemAmountWindow(int usage, Window *parent):
// New buttons
itemAmountMinusButton = new Button("-");
itemAmountPlusButton = new Button("+");
+ itemAmountSlide = new Slider(1.0);
itemAmountOkButton = new Button("Okay");
itemAmountCancelButton = new Button("Cancel");
itemAmountTextBox->setRange(1, inventoryWindow->getItem()->getQuantity());
+ itemAmountSlide->setDimension(gcn::Rectangle(5, 120, 180, 10));
// Set button events Id
itemAmountMinusButton->setEventId("Minus");
itemAmountPlusButton->setEventId("Plus");
+ itemAmountSlide->setEventId("Slide");
itemAmountOkButton->setEventId("Drop");
itemAmountCancelButton->setEventId("Cancel");
@@ -51,18 +55,21 @@ ItemAmountWindow::ItemAmountWindow(int usage, Window *parent):
itemAmountTextBox->setSize(24, 16);
itemAmountPlusButton->setPosition(60, 5);
itemAmountMinusButton->setPosition(10, 5);
- itemAmountOkButton->setPosition(10, 40);
- itemAmountCancelButton->setPosition(60, 40);
+ itemAmountSlide->setPosition(10, 35);
+ itemAmountOkButton->setPosition(10, 50);
+ itemAmountCancelButton->setPosition(60, 50);
// Assemble
add(itemAmountTextBox);
add(itemAmountPlusButton);
add(itemAmountMinusButton);
+ add(itemAmountSlide);
add(itemAmountOkButton);
add(itemAmountCancelButton);
itemAmountPlusButton->addActionListener(this);
itemAmountMinusButton->addActionListener(this);
+ itemAmountSlide->addActionListener(this);
itemAmountOkButton->addActionListener(this);
itemAmountCancelButton->addActionListener(this);
@@ -90,6 +97,7 @@ ItemAmountWindow::~ItemAmountWindow()
delete itemAmountTextBox;
delete itemAmountPlusButton;
delete itemAmountMinusButton;
+ delete itemAmountSlide;
delete itemAmountOkButton;
delete itemAmountCancelButton;
}
@@ -124,5 +132,9 @@ void ItemAmountWindow::action(const std::string& eventId)
{
itemAmountTextBox->setInt(itemAmountTextBox->getInt() - 1);
}
+ else if (eventId == "Slide")
+ {
+ itemAmountTextBox->setInt(itemAmountSlide->getValue()*inventoryWindow->getItem()->getQuantity());
+ }
}