summaryrefslogtreecommitdiff
path: root/src/gui/widgets/inttextfield.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-04-19 23:48:29 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-19 23:48:29 +0300
commit0b7e752bd177c90a05ca752fa31810f9e34c432c (patch)
treedb1809a48faf051af11c94058e8f126c9e9ef1ab /src/gui/widgets/inttextfield.cpp
parent23f87c10db7e6b149e9e1f351e1a82516c545df7 (diff)
downloadmanaplus-0b7e752bd177c90a05ca752fa31810f9e34c432c.tar.gz
manaplus-0b7e752bd177c90a05ca752fa31810f9e34c432c.tar.bz2
manaplus-0b7e752bd177c90a05ca752fa31810f9e34c432c.tar.xz
manaplus-0b7e752bd177c90a05ca752fa31810f9e34c432c.zip
Dehardcode keys in gui widgets.
Add new tab with keys settings in input settings tab.
Diffstat (limited to 'src/gui/widgets/inttextfield.cpp')
-rw-r--r--src/gui/widgets/inttextfield.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gui/widgets/inttextfield.cpp b/src/gui/widgets/inttextfield.cpp
index 8a075000b..fbc51ee3d 100644
--- a/src/gui/widgets/inttextfield.cpp
+++ b/src/gui/widgets/inttextfield.cpp
@@ -22,6 +22,9 @@
#include "gui/widgets/inttextfield.h"
+#include "keydata.h"
+#include "keyevent.h"
+
#include "gui/sdlinput.h"
#include "utils/stringutils.h"
@@ -44,10 +47,9 @@ IntTextField::IntTextField(int def, int min, int max,
void IntTextField::keyPressed(gcn::KeyEvent &event)
{
- const gcn::Key &key = event.getKey();
+ int action = static_cast<KeyEvent*>(&event)->getActionId();
- if (key.getValue() == Key::BACKSPACE ||
- key.getValue() == Key::DELETE)
+ if (action == Input::KEY_GUI_DELETE || action == Input::KEY_GUI_BACKSPACE)
{
setText(std::string());
if (mSendAlwaysEvents)
@@ -56,7 +58,7 @@ void IntTextField::keyPressed(gcn::KeyEvent &event)
event.consume();
}
- if (!key.isNumber())
+ if (!event.getKey().isNumber())
return;
TextField::keyPressed(event);