aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/wince/CEgui/PanelKeyboard.cpp
diff options
context:
space:
mode:
authorMax Horn2010-10-31 17:11:43 +0000
committerMax Horn2010-10-31 17:11:43 +0000
commita4bdd3cdec995cc864eeeda41812e6ab093acdbc (patch)
tree0f5737f170b45d7810b4c732932fa959bf87ce36 /backends/platform/wince/CEgui/PanelKeyboard.cpp
parent086fe78af1b0d16d1902c8f9351e1dc7c103241b (diff)
downloadscummvm-rg350-a4bdd3cdec995cc864eeeda41812e6ab093acdbc.tar.gz
scummvm-rg350-a4bdd3cdec995cc864eeeda41812e6ab093acdbc.tar.bz2
scummvm-rg350-a4bdd3cdec995cc864eeeda41812e6ab093acdbc.zip
WINCE: Code formatting
svn-id: r53979
Diffstat (limited to 'backends/platform/wince/CEgui/PanelKeyboard.cpp')
-rw-r--r--backends/platform/wince/CEgui/PanelKeyboard.cpp117
1 files changed, 58 insertions, 59 deletions
diff --git a/backends/platform/wince/CEgui/PanelKeyboard.cpp b/backends/platform/wince/CEgui/PanelKeyboard.cpp
index 1e59760e96..1b2a478746 100644
--- a/backends/platform/wince/CEgui/PanelKeyboard.cpp
+++ b/backends/platform/wince/CEgui/PanelKeyboard.cpp
@@ -32,73 +32,72 @@
namespace CEGUI {
- 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} } };
+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);
- _state = false;
- _lastKey.setKey(0);
- }
-
-
- PanelKeyboard::~PanelKeyboard() {
- }
-
- bool PanelKeyboard::action(int x, int y, bool pushed) {
- Key key;
-
- if (checkInside(x, y)) {
- int keyAscii = 0;
- int keyCode = 0;
- if (x < 185) {
- // Alpha selection
- keyCode = keyAscii = KEYBOARD_MAPPING_ALPHA[y >= _y+20][((x + 10) / 14) - 1];
- } else if (x >= 186 && x <= 255) {
- // Numeric selection
- 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 = 13;
- }
- }
+PanelKeyboard::PanelKeyboard(WORD reference) : Toolbar() {
+ setBackground(reference);
+ _state = false;
+ _lastKey.setKey(0);
+}
+
+
+PanelKeyboard::~PanelKeyboard() {
+}
+
+bool PanelKeyboard::action(int x, int y, bool pushed) {
+ Key key;
- if (keyAscii != 0) {
- if (_state && pushed && keyCode != _lastKey.keycode()) // if cursor is still down and off the current key
- return false;
- else if (_state && !pushed && keyCode != _lastKey.keycode()) { // cursor is up but off the current key
- keyAscii = _lastKey.ascii();
- keyCode = _lastKey.keycode();
- }
- _state = pushed;
- _lastKey.setKey(keyAscii, tolower(keyCode));
-
- key.setKey(keyAscii, tolower(keyCode));
- return EventsBuffer::simulateKey(&key, pushed);
+ if (checkInside(x, y)) {
+ int keyAscii = 0;
+ int keyCode = 0;
+ if (x < 185) {
+ // Alpha selection
+ keyCode = keyAscii = KEYBOARD_MAPPING_ALPHA[y >= _y+20][((x + 10) / 14) - 1];
+ } else if (x >= 186 && x <= 255) {
+ // Numeric selection
+ 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 = 13;
}
- else if (_state && !pushed) { // cursor is in some forbidden region and is up
- _state = false;
- key = _lastKey;
- return EventsBuffer::simulateKey(&key, false);
- } else
- return false;
}
- else if (_state && !pushed) { // cursor left the keyboard area and is up
+
+ if (keyAscii != 0) {
+ if (_state && pushed && keyCode != _lastKey.keycode()) // if cursor is still down and off the current key
+ return false;
+ else if (_state && !pushed && keyCode != _lastKey.keycode()) { // cursor is up but off the current key
+ keyAscii = _lastKey.ascii();
+ keyCode = _lastKey.keycode();
+ }
+ _state = pushed;
+ _lastKey.setKey(keyAscii, tolower(keyCode));
+
+ key.setKey(keyAscii, tolower(keyCode));
+ return EventsBuffer::simulateKey(&key, pushed);
+ } else if (_state && !pushed) { // cursor is in some forbidden region and is up
_state = false;
key = _lastKey;
return EventsBuffer::simulateKey(&key, false);
} else
return false;
- }
+ } else if (_state && !pushed) { // cursor left the keyboard area and is up
+ _state = false;
+ key = _lastKey;
+ return EventsBuffer::simulateKey(&key, false);
+ } else
+ return false;
}
+} // End of namespace CEGUI
+