From 9f9b7d96a7770c127c88fc50770797c188bfcf0c Mon Sep 17 00:00:00 2001 From: Kostas Nakos Date: Mon, 26 Feb 2007 17:48:04 +0000 Subject: added gfx and code to support spacebar and escape keys in the virtual keyboard (remember, Jubanka couldn't draw if his life depended on it :-) ). fixed (essentially added) support for the directional keys of the virtual keyboard (no idea why these were not implemented). svn-id: r25879 --- backends/platform/wince/CEgui/PanelKeyboard.cpp | 54 ++++++++++-------------- backends/platform/wince/images/keyboard.bmp | Bin 38454 -> 38454 bytes 2 files changed, 22 insertions(+), 32 deletions(-) (limited to 'backends') diff --git a/backends/platform/wince/CEgui/PanelKeyboard.cpp b/backends/platform/wince/CEgui/PanelKeyboard.cpp index b554fb3b71..ca7074a7fe 100644 --- a/backends/platform/wince/CEgui/PanelKeyboard.cpp +++ b/backends/platform/wince/CEgui/PanelKeyboard.cpp @@ -25,10 +25,10 @@ namespace CEGUI { - const char KEYBOARD_MAPPING_ALPHA_HIGH[] = {"abcdefghijklm"}; - const char KEYBOARD_MAPPING_NUMERIC_HIGH[] = {"12345"}; - const char KEYBOARD_MAPPING_ALPHA_LOW[] = {"nopqrstuvwxyz"}; - const char KEYBOARD_MAPPING_NUMERIC_LOW[] = {"67890"}; + const char KEYBOARD_MAPPING_ALPHA[][14] = { {"abcdefghijklm"}, {"nopqrstuvwxyz"} }; + const char KEYBOARD_MAPPING_NUMERIC[][6] = { {"12345"}, {"67890"} }; + const int KEYBOARD_MAPPING_SPECIAL[][3][2] = { { {1,SDLK_ESCAPE}, {224,SDLK_UP}, {32,SDLK_SPACE} }, + { {224,SDLK_LEFT}, {224,SDLK_DOWN}, {224,SDLK_RIGHT} } }; PanelKeyboard::PanelKeyboard(WORD reference) : Toolbar() { setBackground(reference); @@ -41,41 +41,31 @@ namespace CEGUI { bool PanelKeyboard::action(int x, int y, bool pushed) { if (checkInside(x, y)) { - char keyAscii = 0; - char keyCode = 0; + int keyAscii = 0; + int keyCode = 0; if (x < 185) { // Alpha selection - if (y <= _y + 20) - keyAscii = KEYBOARD_MAPPING_ALPHA_HIGH[((x + 10) / 14) - 1]; - else - keyAscii = KEYBOARD_MAPPING_ALPHA_LOW[((x + 10) / 14) - 1]; - keyCode = tolower(keyAscii); - } - else - if (x >= 186 && x <= 255) { + keyCode = keyAscii = KEYBOARD_MAPPING_ALPHA[y >= _y+20][((x + 10) / 14) - 1]; + } else if (x >= 186 && x <= 255) { // Numeric selection - if (y <= _y + 20) - keyAscii = KEYBOARD_MAPPING_NUMERIC_HIGH[((x - 187 + 10) / 14) - 1]; - else - keyAscii = KEYBOARD_MAPPING_NUMERIC_LOW[((x - 187 + 10) / 14) - 1]; - keyCode = keyAscii; - } - else - if (x >= 302 && x <= 316 && y < _y + 20) { - // Backspace - keyAscii = VK_BACK; - keyCode = keyAscii; - } - else - if (x >= 302 && x <= 316 && y >= _y + 20) { - // Enter - keyAscii = 13; - keyCode = 10; + keyCode = keyAscii = KEYBOARD_MAPPING_NUMERIC[y >= _y+20][((x - 187 + 10) / 14) - 1]; + } else if (x >= 258 && x <= 300) { + // Special keys + keyAscii = KEYBOARD_MAPPING_SPECIAL[y >= _y+20][((x - 259 + 10) / 14) - 1][0]; + keyCode = KEYBOARD_MAPPING_SPECIAL[y >= _y+20][((x - 259 + 10) / 14) - 1][1]; + } else if (x >= 302 && x <= 316) { + if (y < _y +20) { + // Backspace + keyAscii = VK_BACK; keyCode = keyAscii; + } else { + // Enter + keyAscii = 13; keyCode = 10; + } } if (keyAscii != 0) { _key.setAscii(keyAscii); - _key.setKeycode(tolower(keyAscii)); + _key.setKeycode(tolower(keyCode)); return EventsBuffer::simulateKey(&_key, pushed); } else diff --git a/backends/platform/wince/images/keyboard.bmp b/backends/platform/wince/images/keyboard.bmp index aac79d00e5..14217e1eac 100644 Binary files a/backends/platform/wince/images/keyboard.bmp and b/backends/platform/wince/images/keyboard.bmp differ -- cgit v1.2.3