summaryrefslogtreecommitdiff
path: root/src/gui
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
parent4208c8cd889112aa1adffaa2b6492f61734d1105 (diff)
downloadmanaverse-a1cd5307497bfc754f157a3e22bfa98fc126137a.tar.gz
manaverse-a1cd5307497bfc754f157a3e22bfa98fc126137a.tar.bz2
manaverse-a1cd5307497bfc754f157a3e22bfa98fc126137a.tar.xz
manaverse-a1cd5307497bfc754f157a3e22bfa98fc126137a.zip
Split keyboard keys to groups.
Diffstat (limited to 'src/gui')
-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)