summaryrefslogtreecommitdiff
path: root/src/gui/setup_keyboard.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-09-26 17:46:50 +0300
committerAndrei Karas <akaras@inbox.ru>2011-09-26 17:46:50 +0300
commita1cd5307497bfc754f157a3e22bfa98fc126137a (patch)
tree2516d80f0a08fe0004dcdd49efec8d31b0d76214 /src/gui/setup_keyboard.cpp
parent4208c8cd889112aa1adffaa2b6492f61734d1105 (diff)
downloadplus-a1cd5307497bfc754f157a3e22bfa98fc126137a.tar.gz
plus-a1cd5307497bfc754f157a3e22bfa98fc126137a.tar.bz2
plus-a1cd5307497bfc754f157a3e22bfa98fc126137a.tar.xz
plus-a1cd5307497bfc754f157a3e22bfa98fc126137a.zip
Split keyboard keys to groups.
Diffstat (limited to 'src/gui/setup_keyboard.cpp')
-rw-r--r--src/gui/setup_keyboard.cpp33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp
index 5125541cf..922d9797b 100644
--- a/src/gui/setup_keyboard.cpp
+++ b/src/gui/setup_keyboard.cpp
@@ -153,8 +153,17 @@ void Setup_Keyboard::action(const gcn::ActionEvent &event)
{
if (!mKeySetting)
{
- mAssignKeyButton->setEnabled(true);
- mUnassignKeyButton->setEnabled(true);
+ int i(mKeyList->getSelected());
+ if (keyboard.isSeparator(i))
+ {
+ mAssignKeyButton->setEnabled(false);
+ mUnassignKeyButton->setEnabled(false);
+ }
+ else
+ {
+ mAssignKeyButton->setEnabled(true);
+ mUnassignKeyButton->setEnabled(true);
+ }
}
}
else if (event.getId() == "assign")
@@ -183,11 +192,21 @@ void Setup_Keyboard::action(const gcn::ActionEvent &event)
void Setup_Keyboard::refreshAssignedKey(int index)
{
- std::string caption;
- char *temp = SDL_GetKeyName(
- static_cast<SDLKey>(keyboard.getKeyValue(index)));
- caption = keyboard.getKeyCaption(index) + ": " + toString(temp);
- mKeyListModel->setElementAt(index, caption);
+ if (keyboard.isSeparator(index))
+ {
+ const std::string str = " \342\200\225\342\200\225\342\200\225"
+ "\342\200\225\342\200\225 ";
+ mKeyListModel->setElementAt(index, str
+ + keyboard.getKeyCaption(index) + str);
+ }
+ else
+ {
+ std::string caption;
+ char *temp = SDL_GetKeyName(
+ static_cast<SDLKey>(keyboard.getKeyValue(index)));
+ caption = keyboard.getKeyCaption(index) + ": " + toString(temp);
+ mKeyListModel->setElementAt(index, caption);
+ }
}
void Setup_Keyboard::newKeyCallback(int index)