summaryrefslogtreecommitdiff
path: root/src/gui/widgets/slider.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/slider.cpp
parent23f87c10db7e6b149e9e1f351e1a82516c545df7 (diff)
downloadplus-0b7e752bd177c90a05ca752fa31810f9e34c432c.tar.gz
plus-0b7e752bd177c90a05ca752fa31810f9e34c432c.tar.bz2
plus-0b7e752bd177c90a05ca752fa31810f9e34c432c.tar.xz
plus-0b7e752bd177c90a05ca752fa31810f9e34c432c.zip
Dehardcode keys in gui widgets.
Add new tab with keys settings in input settings tab.
Diffstat (limited to 'src/gui/widgets/slider.cpp')
-rw-r--r--src/gui/widgets/slider.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index 24a2a5128..69df4c289 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -25,6 +25,8 @@
#include "client.h"
#include "configuration.h"
#include "graphics.h"
+#include "keyevent.h"
+#include "keydata.h"
#include "gui/theme.h"
@@ -300,17 +302,17 @@ void Slider::mouseExited(gcn::MouseEvent& event A_UNUSED)
void Slider::keyPressed(gcn::KeyEvent& keyEvent)
{
- gcn::Key key = keyEvent.getKey();
+ int action = static_cast<KeyEvent*>(&keyEvent)->getActionId();
if (getOrientation() == HORIZONTAL)
{
- if (key.getValue() == gcn::Key::RIGHT)
+ if (action == Input::KEY_GUI_RIGHT)
{
setValue(getValue() + getStepLength());
distributeActionEvent();
keyEvent.consume();
}
- else if (key.getValue() == gcn::Key::LEFT)
+ else if (action == Input::KEY_GUI_LEFT)
{
setValue(getValue() - getStepLength());
distributeActionEvent();
@@ -319,13 +321,13 @@ void Slider::keyPressed(gcn::KeyEvent& keyEvent)
}
else
{
- if (key.getValue() == gcn::Key::UP)
+ if (action == Input::KEY_GUI_UP)
{
setValue(getValue() + getStepLength());
distributeActionEvent();
keyEvent.consume();
}
- else if (key.getValue() == gcn::Key::DOWN)
+ else if (action == Input::KEY_GUI_DOWN)
{
setValue(getValue() - getStepLength());
distributeActionEvent();