summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-05-07 23:16:16 -0600
committerJared Adams <jaxad0127@gmail.com>2009-05-07 23:16:16 -0600
commit7bcadd46d12b4c42b1f6e3038f79db7f8d8c6b5a (patch)
treeee1226bbf132de564f877a4967c57fd43b6f06f9
parent02401cfae13ea9d2c836e707f21164729f8ee364 (diff)
downloadmana-7bcadd46d12b4c42b1f6e3038f79db7f8d8c6b5a.tar.gz
mana-7bcadd46d12b4c42b1f6e3038f79db7f8d8c6b5a.tar.bz2
mana-7bcadd46d12b4c42b1f6e3038f79db7f8d8c6b5a.tar.xz
mana-7bcadd46d12b4c42b1f6e3038f79db7f8d8c6b5a.zip
Fix updates in the ItemAmmountWindow
CHanging the IntTextField will now update the Slider.
-rw-r--r--src/gui/itemamount.cpp6
-rw-r--r--src/gui/itemamount.h6
2 files changed, 11 insertions, 1 deletions
diff --git a/src/gui/itemamount.cpp b/src/gui/itemamount.cpp
index 03f1ae5f..e3891d29 100644
--- a/src/gui/itemamount.cpp
+++ b/src/gui/itemamount.cpp
@@ -74,6 +74,7 @@ ItemAmountWindow::ItemAmountWindow(Usage usage, Window *parent, Item *item,
mItemAmountTextField = new IntTextField(1);
mItemAmountTextField->setRange(1, mMax);
mItemAmountTextField->setWidth(35);
+ mItemAmountTextField->addKeyListener(this);
// Slider
mItemAmountSlide = new Slider(1.0, mMax);
@@ -174,6 +175,11 @@ void ItemAmountWindow::close()
scheduleDelete();
}
+void ItemAmountWindow::keyReleased(gcn::KeyEvent &keyEvent)
+{
+ mItemAmountSlide->setValue(mItemAmountTextField->getValue());
+}
+
void ItemAmountWindow::showWindow(Usage usage, Window *parent, Item *item,
int maxRange)
{
diff --git a/src/gui/itemamount.h b/src/gui/itemamount.h
index 1ae3f0d5..312b9fc3 100644
--- a/src/gui/itemamount.h
+++ b/src/gui/itemamount.h
@@ -24,6 +24,7 @@
#include "gui/widgets/window.h"
+#include <guichan/keylistener.hpp>
#include <guichan/actionlistener.hpp>
class IntTextField;
@@ -34,7 +35,8 @@ class Item;
*
* \ingroup Interface
*/
-class ItemAmountWindow : public Window, public gcn::ActionListener
+class ItemAmountWindow : public Window, public gcn::ActionListener,
+ public gcn::KeyListener
{
public:
enum Usage {
@@ -60,6 +62,8 @@ class ItemAmountWindow : public Window, public gcn::ActionListener
*/
void close();
+ void keyReleased(gcn::KeyEvent &keyEvent);
+
/**
* Creates the dialog, or bypass it if there aren't enough items.
*/