summaryrefslogtreecommitdiff
path: root/src/gui/setup_keyboard.cpp
diff options
context:
space:
mode:
authorAngelo Castellani <udp.castellani@gmail.com>2011-05-12 01:25:29 -0400
committerStefan Dombrowski <stefan@uni-bonn.de>2011-05-13 11:06:00 +0200
commit9641f4c6c24656a73ee759f7c176ba682ae01acf (patch)
tree27836da80454d51c35c9b16b8e6191e3827406c7 /src/gui/setup_keyboard.cpp
parent1d6311a5ffde800ece8d3085fb5fe7c2c9c50a58 (diff)
downloadmana-9641f4c6c24656a73ee759f7c176ba682ae01acf.tar.gz
mana-9641f4c6c24656a73ee759f7c176ba682ae01acf.tar.bz2
mana-9641f4c6c24656a73ee759f7c176ba682ae01acf.tar.xz
mana-9641f4c6c24656a73ee759f7c176ba682ae01acf.zip
Made the setup keyboard tab prettier.
Incidentally I added support for a monospaced font (which may come in handy).
Diffstat (limited to 'src/gui/setup_keyboard.cpp')
-rw-r--r--src/gui/setup_keyboard.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp
index 57a21270..31fd6e39 100644
--- a/src/gui/setup_keyboard.cpp
+++ b/src/gui/setup_keyboard.cpp
@@ -24,6 +24,7 @@
#include "keyboardconfig.h"
+#include "gui/gui.h"
#include "gui/okdialog.h"
#include "gui/widgets/button.h"
@@ -79,6 +80,7 @@ Setup_Keyboard::Setup_Keyboard():
refreshKeys();
mKeyList->addActionListener(this);
+ mKeyList->setFont(monoFont);
ScrollArea *scrollArea = new ScrollArea(mKeyList);
scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
@@ -176,9 +178,17 @@ void Setup_Keyboard::action(const gcn::ActionEvent &event)
void Setup_Keyboard::refreshAssignedKey(int index)
{
std::string caption;
- char *temp = SDL_GetKeyName(
- (SDLKey) keyboard.getKeyValue(index));
- caption = keyboard.getKeyCaption(index) + ": " + toString(temp);
+ if (keyboard.getKeyValue(index) == keyboard.KEY_NO_VALUE)
+ caption = keyboard.getKeyCaption(index) + ": ";
+ else
+ {
+ char *temp = SDL_GetKeyName(
+ (SDLKey) keyboard.getKeyValue(index));
+
+ caption = strprintf("%-25s",
+ (keyboard.getKeyCaption(index) + ": ").c_str()) + toString(temp);
+
+ }
mKeyListModel->setElementAt(index, caption);
}