FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
KeyCodesWin.cpp
1 /**********************************************************\
2 Original Author: Dan Groom
3 
4 Created: April 2, 2010
5 License: Dual license model; choose one of two:
6 New BSD License
7 http://www.opensource.org/licenses/bsd-license.php
8 - or -
9 GNU Lesser General Public License, version 2.1
10 http://www.gnu.org/licenses/lgpl-2.1.html
11 
12 Copyright 2010 Dan Groom and the Firebreath development team
13 \**********************************************************/
14 
15 #include "win_common.h"
16 #include "../precompiled_headers.h" // On windows, everything above this line in PCH
17 
18 #include "KeyCodesWin.h"
19 
20 namespace FB {
21 
22  FBKeyCode WinKeyCodeToFBKeyCode( unsigned int wparam )
23  {
24  FBKeyCode retVal = FBKEY_UNKNOWN;
25 
26  switch( wparam )
27  {
28  case VK_ADD : retVal = FBKEY_ADD; break;
29  case VK_MENU : retVal = FBKEY_ALT; break;
30  case VK_CANCEL : retVal = FBKEY_CANCEL; break;
31  case VK_CAPITAL : retVal = FBKEY_CAPSLOCK; break;
32  case VK_CLEAR : retVal = FBKEY_CLEAR; break;
33  case VK_CONTROL : retVal = FBKEY_CONTROL; break;
34  case VK_DECIMAL : retVal = FBKEY_DECIMAL; break;
35  case VK_DELETE : retVal = FBKEY_DELETE; break;
36  case VK_DIVIDE : retVal = FBKEY_DIVIDE; break;
37  case VK_ESCAPE : retVal = FBKEY_ESCAPE; break;
38  case VK_EXECUTE : retVal = FBKEY_EXECUTE; break;
39  case VK_F1 : retVal = FBKEY_F1; break;
40  case VK_F10 : retVal = FBKEY_F10; break;
41  case VK_F11 : retVal = FBKEY_F11; break;
42  case VK_F12 : retVal = FBKEY_F12; break;
43  case VK_F13 : retVal = FBKEY_F13; break;
44  case VK_F14 : retVal = FBKEY_F14; break;
45  case VK_F15 : retVal = FBKEY_F15; break;
46  case VK_F16 : retVal = FBKEY_F16; break;
47  case VK_F17 : retVal = FBKEY_F17; break;
48  case VK_F18 : retVal = FBKEY_F18; break;
49  case VK_F19 : retVal = FBKEY_F19; break;
50  case VK_F2 : retVal = FBKEY_F2; break;
51  case VK_F20 : retVal = FBKEY_F20; break;
52  case VK_F21 : retVal = FBKEY_F21; break;
53  case VK_F22 : retVal = FBKEY_F22; break;
54  case VK_F3 : retVal = FBKEY_F3; break;
55  case VK_F4 : retVal = FBKEY_F4; break;
56  case VK_F5 : retVal = FBKEY_F5; break;
57  case VK_F6 : retVal = FBKEY_F6; break;
58  case VK_F7 : retVal = FBKEY_F7; break;
59  case VK_F8 : retVal = FBKEY_F8; break;
60  case VK_F9 : retVal = FBKEY_F9; break;
61  case VK_HELP : retVal = FBKEY_HELP; break;
62  case VK_INSERT : retVal = FBKEY_INSERT; break;
63  case VK_LBUTTON : retVal = FBKEY_LBUTTON; break;
64  case VK_MBUTTON : retVal = FBKEY_MBUTTON; break;
65  case VK_MULTIPLY : retVal = FBKEY_MULTIPLY; break;
66  case VK_NUMLOCK : retVal = FBKEY_NUMLOCK; break;
67  case VK_NUMPAD0 : retVal = FBKEY_NUMPAD0; break;
68  case VK_NUMPAD1 : retVal = FBKEY_NUMPAD1; break;
69  case VK_NUMPAD2 : retVal = FBKEY_NUMPAD2; break;
70  case VK_NUMPAD3 : retVal = FBKEY_NUMPAD3; break;
71  case VK_NUMPAD4 : retVal = FBKEY_NUMPAD4; break;
72  case VK_NUMPAD5 : retVal = FBKEY_NUMPAD5; break;
73  case VK_NUMPAD6 : retVal = FBKEY_NUMPAD6; break;
74  case VK_NUMPAD7 : retVal = FBKEY_NUMPAD7; break;
75  case VK_NUMPAD8 : retVal = FBKEY_NUMPAD8; break;
76  case VK_NUMPAD9 : retVal = FBKEY_NUMPAD9; break;
77  case VK_NEXT : retVal = FBKEY_PAGEDOWN; break;
78  case VK_PRIOR : retVal = FBKEY_PAGEUP; break;
79  case VK_RBUTTON : retVal = FBKEY_RBUTTON; break;
80  case VK_RETURN : retVal = FBKEY_RETURN; break;
81  case VK_SCROLL : retVal = FBKEY_SCROLL ; break;
82  case VK_SELECT : retVal = FBKEY_SELECT; break;
83  case VK_SEPARATOR : retVal = FBKEY_SEPARATOR; break;
84  case VK_SHIFT : retVal = FBKEY_SHIFT; break;
85  case VK_SNAPSHOT : retVal = FBKEY_PRINTSCREEN; break;
86  case VK_SPACE : retVal = FBKEY_SPACE; break;
87  case VK_SUBTRACT : retVal = FBKEY_SUBTRACT; break;
88  case VK_TAB : retVal = FBKEY_TAB; break;
89  case VK_UP : retVal = FBKEY_UP; break;
90  case VK_DOWN : retVal = FBKEY_DOWN; break;
91  case VK_LEFT : retVal = FBKEY_LEFT; break;
92  case VK_RIGHT : retVal = FBKEY_RIGHT; break;
93  case VK_LWIN : retVal = FBKEY_WINDOWS_LEFT; break;
94  case VK_APPS : retVal = FBKEY_WINDOWS_MENU; break;
95  case VK_RWIN : retVal = FBKEY_WINDOWS_RIGHT; break;
96  case VK_BACK : retVal = FBKEY_BACKSPACE; break;
97  case VK_END : retVal = FBKEY_END; break;
98  case VK_HOME : retVal = FBKEY_HOME; break;
99  case VK_PAUSE : retVal = FBKEY_PAUSE; break;
100  case VK_PRINT : retVal = FBKEY_PRINT; break;
101  }
102 
103  return retVal;
104  }
105 
106 }
107 
FBKeyCode WinKeyCodeToFBKeyCode(unsigned int wparam)
Converts a windows key code to a FireBreath key code.
Definition: KeyCodesWin.cpp:22
FBKeyCode
Values that represent different keys in a platform agnostic way.
Definition: KeyCodes.h:26