summaryrefslogtreecommitdiff
path: root/src/gui/widgets/button.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/button.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/button.cpp')
-rw-r--r--src/gui/widgets/button.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index 88d9311b9..15af963b0 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -26,6 +26,8 @@
#include "configuration.h"
#include "graphics.h"
#include "graphicsvertexes.h"
+#include "keydata.h"
+#include "keyevent.h"
#include "logger.h"
#include "gui/palette.h"
@@ -462,9 +464,9 @@ void Button::setCaption(const std::string& caption)
void Button::keyPressed(gcn::KeyEvent& keyEvent)
{
- gcn::Key key = keyEvent.getKey();
+ int action = static_cast<KeyEvent*>(&keyEvent)->getActionId();
- if (key.getValue() == gcn::Key::SPACE)
+ if (action == Input::KEY_GUI_SELECT)
{
mKeyPressed = true;
keyEvent.consume();
@@ -473,9 +475,9 @@ void Button::keyPressed(gcn::KeyEvent& keyEvent)
void Button::keyReleased(gcn::KeyEvent& keyEvent)
{
- gcn::Key key = keyEvent.getKey();
+ int action = static_cast<KeyEvent*>(&keyEvent)->getActionId();
- if (key.getValue() == gcn::Key::SPACE && mKeyPressed)
+ if (action == Input::KEY_GUI_SELECT && mKeyPressed)
{
mKeyPressed = false;
if (mStick)