summaryrefslogtreecommitdiff
path: root/src/gui/itemamount.cpp
diff options
context:
space:
mode:
authorFreeyorp <Freeyorp101@NOSPAM@hotmail.com>2009-05-07 16:30:50 +1200
committerJared Adams <jaxad0127@gmail.com>2009-05-07 22:58:19 -0600
commit02401cfae13ea9d2c836e707f21164729f8ee364 (patch)
tree6d77076dd18de5894a3176b5061f5a826e492600 /src/gui/itemamount.cpp
parentaf09f9d13118eaf17fb6cebcf86ee8100003d834 (diff)
downloadmana-02401cfae13ea9d2c836e707f21164729f8ee364.tar.gz
mana-02401cfae13ea9d2c836e707f21164729f8ee364.tar.bz2
mana-02401cfae13ea9d2c836e707f21164729f8ee364.tar.xz
mana-02401cfae13ea9d2c836e707f21164729f8ee364.zip
Put an input field back into the itemamount window.
Diffstat (limited to 'src/gui/itemamount.cpp')
-rw-r--r--src/gui/itemamount.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/gui/itemamount.cpp b/src/gui/itemamount.cpp
index 190290e3..03f1ae5f 100644
--- a/src/gui/itemamount.cpp
+++ b/src/gui/itemamount.cpp
@@ -25,7 +25,7 @@
#include "gui/trade.h"
#include "gui/widgets/button.h"
-#include "gui/widgets/label.h"
+#include "gui/widgets/inttextfield.h"
#include "gui/widgets/layout.h"
#include "gui/widgets/slider.h"
@@ -33,7 +33,6 @@
#include "localplayer.h"
#include "utils/gettext.h"
-#include "utils/stringutils.h"
void ItemAmountWindow::finish(Item *item, int amount, Usage usage)
{
@@ -72,9 +71,9 @@ ItemAmountWindow::ItemAmountWindow(Usage usage, Window *parent, Item *item,
setCloseButton(true);
// Integer field
-
- mItemAmountLabel = new Label(strprintf("%d / %d", 1, mMax));
- mItemAmountLabel->setAlignment(gcn::Graphics::CENTER);
+ mItemAmountTextField = new IntTextField(1);
+ mItemAmountTextField->setRange(1, mMax);
+ mItemAmountTextField->setWidth(35);
// Slider
mItemAmountSlide = new Slider(1.0, mMax);
@@ -95,13 +94,13 @@ ItemAmountWindow::ItemAmountWindow(Usage usage, Window *parent, Item *item,
// Set positions
ContainerPlacer place;
place = getPlacer(0, 0);
-
place(0, 0, minusButton);
- place(1, 0, mItemAmountSlide, 3);
- place(4, 0, plusButton);
- place(5, 0, mItemAmountLabel, 2);
- place(7, 0, addAllButton);
+ place(1, 0, mItemAmountTextField);
+ place(2, 0, plusButton);
+ place(3, 0, addAllButton);
place = getPlacer(0, 1);
+ place(0, 0, mItemAmountSlide, 6);
+ place = getPlacer(0, 2);
place(4, 0, cancelButton);
place(5, 0, okButton);
reflowLayout(225, 0);
@@ -133,12 +132,12 @@ ItemAmountWindow::ItemAmountWindow(Usage usage, Window *parent, Item *item,
void ItemAmountWindow::resetAmount()
{
- mItemAmountLabel->setCaption(strprintf("%d / %d", 1, mMax));
+ mItemAmountTextField->setValue(1);
}
void ItemAmountWindow::action(const gcn::ActionEvent &event)
{
- int amount = mItemAmountSlide->getValue();
+ int amount = mItemAmountTextField->getValue();
if (event.getId() == "Cancel")
{
@@ -166,8 +165,7 @@ void ItemAmountWindow::action(const gcn::ActionEvent &event)
scheduleDelete();
return;
}
-
- mItemAmountLabel->setCaption(strprintf("%d / %d", amount, mMax));
+ mItemAmountTextField->setValue(amount);
mItemAmountSlide->setValue(amount);
}