summaryrefslogtreecommitdiff
path: root/src/gui/item_amount.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-01-18 19:04:02 -0700
committerIra Rice <irarice@gmail.com>2009-01-18 19:04:02 -0700
commitd2b804c1a817ccdd85b4b1220bf929e9d370d774 (patch)
tree35f82a41b5107802fab3bbca7b2a59f7a3271e18 /src/gui/item_amount.cpp
parentd975741a095ae0dee82ff1dfdaa8e03439d7cf2b (diff)
downloadmana-d2b804c1a817ccdd85b4b1220bf929e9d370d774.tar.gz
mana-d2b804c1a817ccdd85b4b1220bf929e9d370d774.tar.bz2
mana-d2b804c1a817ccdd85b4b1220bf929e9d370d774.tar.xz
mana-d2b804c1a817ccdd85b4b1220bf929e9d370d774.zip
Fixed the NPC Integer input field, as well as cut some bull from the
NPC String class. The Integer input field was rather horribly broken to the point where it could send invalid data, the increment and decrement buttons didn't work, and overall it was tripping over itself. As for the NPC String, "The Mana World" as a string is not needed to set the field to that length, but instead fills the text field with that text for starting. This is completely inappropriate for a text entry field, and a more sensible default would be to leave it empty, so that people can type in what they want without having to delete it. Signed-off-by: Ira Rice <irarice@gmail.com>
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 48b0e601..03b22fa9 100644
--- a/src/gui/item_amount.cpp
+++ b/src/gui/item_amount.cpp
@@ -20,7 +20,7 @@
*/
#include "button.h"
-#include "inttextbox.h"
+#include "inttextfield.h"
#include "item_amount.h"
#include "slider.h"
#include "trade.h"
@@ -39,11 +39,11 @@ ItemAmountWindow::ItemAmountWindow(int usage, Window *parent, Item *item):
const int maxRange = mItem->getQuantity();
// Integer field
- mItemAmountTextBox = new IntTextBox(1);
- mItemAmountTextBox->setRange(1, maxRange);
- mItemAmountTextBox->setWidth(30);
- mItemAmountTextBox->setActionEventId("Dummy");
- mItemAmountTextBox->addActionListener(this);
+ mItemAmountTextField = new IntTextField(1);
+ mItemAmountTextField->setRange(1, maxRange);
+ mItemAmountTextField->setWidth(30);
+ mItemAmountTextField->setActionEventId("Dummy");
+ mItemAmountTextField->addActionListener(this);
// Slider
mItemAmountSlide = new Slider(1.0, maxRange);
@@ -61,7 +61,7 @@ ItemAmountWindow::ItemAmountWindow(int usage, Window *parent, Item *item):
// Set positions
place(0, 0, minusButton);
- place(1, 0, mItemAmountTextBox).setPadding(2);
+ place(1, 0, mItemAmountTextField).setPadding(2);
place(2, 0, plusButton);
place(0, 1, mItemAmountSlide, 6);
place(4, 2, okButton);
@@ -89,12 +89,12 @@ ItemAmountWindow::ItemAmountWindow(int usage, Window *parent, Item *item):
void ItemAmountWindow::resetAmount()
{
- mItemAmountTextBox->setInt(1);
+ mItemAmountTextField->setValue(1);
}
void ItemAmountWindow::action(const gcn::ActionEvent &event)
{
- int amount = mItemAmountTextBox->getInt();
+ int amount = mItemAmountTextField->getValue();
if (event.getId() == "Cancel")
{
@@ -114,14 +114,14 @@ void ItemAmountWindow::action(const gcn::ActionEvent &event)
}
else if (event.getId() == "Drop")
{
- player_node->dropItem(mItem, mItemAmountTextBox->getInt());
+ player_node->dropItem(mItem, mItemAmountTextField->getValue());
scheduleDelete();
}
else if (event.getId() == "AddTrade")
{
- tradeWindow->tradeItem(mItem, mItemAmountTextBox->getInt());
+ tradeWindow->tradeItem(mItem, mItemAmountTextField->getValue());
scheduleDelete();
}
- mItemAmountTextBox->setInt(amount);
+ mItemAmountTextField->setValue(amount);
mItemAmountSlide->setValue(amount);
}