diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-04-19 23:48:29 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-04-19 23:48:29 +0300 |
commit | 0b7e752bd177c90a05ca752fa31810f9e34c432c (patch) | |
tree | db1809a48faf051af11c94058e8f126c9e9ef1ab /src/gui/widgets/guitable.cpp | |
parent | 23f87c10db7e6b149e9e1f351e1a82516c545df7 (diff) | |
download | plus-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/guitable.cpp')
-rw-r--r-- | src/gui/widgets/guitable.cpp | 18 |
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); |