summaryrefslogtreecommitdiff
path: root/src/gui/widgets/guitable.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/guitable.cpp
parent23f87c10db7e6b149e9e1f351e1a82516c545df7 (diff)
downloadmv-0b7e752bd177c90a05ca752fa31810f9e34c432c.tar.gz
mv-0b7e752bd177c90a05ca752fa31810f9e34c432c.tar.bz2
mv-0b7e752bd177c90a05ca752fa31810f9e34c432c.tar.xz
mv-0b7e752bd177c90a05ca752fa31810f9e34c432c.zip
Dehardcode keys in gui widgets.
Add new tab with keys settings in input settings tab.
Diffstat (limited to 'src/gui/widgets/guitable.cpp')
-rw-r--r--src/gui/widgets/guitable.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp
index 6434f5453..910ee1910 100644
--- a/src/gui/widgets/guitable.cpp
+++ b/src/gui/widgets/guitable.cpp
@@ -24,6 +24,8 @@
#include "client.h"
#include "configuration.h"
+#include "keyevent.h"
+#include "keydata.h"
#include "gui/sdlinput.h"
#include "gui/theme.h"
@@ -403,40 +405,40 @@ gcn::Rectangle GuiTable::getChildrenArea()
// -- KeyListener notifications
void GuiTable::keyPressed(gcn::KeyEvent& keyEvent)
{
- gcn::Key key = keyEvent.getKey();
+ int action = static_cast<KeyEvent*>(&keyEvent)->getActionId();
- if (key.getValue() == Key::ENTER || key.getValue() == Key::SPACE)
+ if (action == Input::KEY_GUI_SELECT)
{
distributeActionEvent();
keyEvent.consume();
}
- else if (key.getValue() == Key::UP)
+ else if (action == Input::KEY_GUI_UP)
{
setSelectedRow(mSelectedRow - 1);
keyEvent.consume();
}
- else if (key.getValue() == Key::DOWN)
+ else if (action == Input::KEY_GUI_DOWN)
{
setSelectedRow(mSelectedRow + 1);
keyEvent.consume();
}
- else if (key.getValue() == Key::LEFT)
+ else if (action == Input::KEY_GUI_LEFT)
{
setSelectedColumn(mSelectedColumn - 1);
keyEvent.consume();
}
- else if (key.getValue() == Key::RIGHT)
+ else if (action == Input::KEY_GUI_RIGHT)
{
setSelectedColumn(mSelectedColumn + 1);
keyEvent.consume();
}
- else if (key.getValue() == Key::HOME)
+ else if (action == Input::KEY_GUI_HOME)
{
setSelectedRow(0);
setSelectedColumn(0);
keyEvent.consume();
}
- else if (key.getValue() == Key::END && mModel)
+ else if (action == Input::KEY_GUI_END && mModel)
{
setSelectedRow(mModel->getRows() - 1);
setSelectedColumn(mModel->getColumns() - 1);