00001 // $Id: wxOil/wxkeymap.cpp, 1, 01-Jan-2006, Anonymous $ 00002 00003 #include "camtypes.h" 00004 #include "wxkeymap.h" 00005 #include "vkextra.h" 00006 00007 /******************************************************************************************** 00008 00009 std::map<String_32, UINT32> wxKeyMap::keymap; 00010 Author: Jason_Williams (Xara Group Ltd) <camelotdev@xara.com> M'Sadoques 00011 Created: 5/30/2007 00012 Purpose: Holds the string to enum translations for WXK_* keys. 00013 00014 ********************************************************************************************/ 00015 std::map<String_32, UINT32> wxKeyMap::keymap; 00016 00017 /******************************************************************************************** 00018 00019 UINT32 wxKeyMap::GetKeyVal(String_32 key_str) 00020 Author: Jason_Williams (Xara Group Ltd) <camelotdev@xara.com> M'Sadoques 00021 Created: 5/30/2007 00022 Inputs: The String representation of a WXK_* key, for example "WXK_ADD" 00023 Returns: The enum value. 00024 Purpose: This function ensures that it is unnecessary to hard-code key values into 00025 resource or other configuration files. The enumeration name can be kept 00026 the same, and the actual enumeration value can change without changing this 00027 code. 00028 00029 The first time through, the keymap map is populated with the string to enum 00030 translations. 00031 ********************************************************************************************/ 00032 UINT32 wxKeyMap::GetKeyVal(String_32 key_str) 00033 { 00034 if(wxKeyMap::keymap.empty()) 00035 wxKeyMap::GenerateMap(); 00036 ENSURE(!wxKeyMap::keymap.empty(), "keymap is still empty"); 00037 ENSURE(wxKeyMap::keymap[key_str] != 0, "key_str is invalid"); 00038 return(wxKeyMap::keymap[key_str]); 00039 } 00040 00041 /******************************************************************************************** 00042 00043 void wxKeyMap::GenerateMap() 00044 Author: Jason_Williams (Xara Group Ltd) <camelotdev@xara.com> M'Sadoques 00045 Created: 5/30/2007 00046 Purpose: Generate the string to enum translations in the keymap map. 00047 00048 ********************************************************************************************/ 00049 void wxKeyMap::GenerateMap() 00050 { 00051 /* Defined in vkextra.h */ 00052 wxKeyMap::keymap[TEXT("WXK_0")]=WXK_0; 00053 wxKeyMap::keymap[TEXT("WXK_1")]=WXK_1; 00054 wxKeyMap::keymap[TEXT("WXK_2")]=WXK_2; 00055 wxKeyMap::keymap[TEXT("WXK_3")]=WXK_3; 00056 wxKeyMap::keymap[TEXT("WXK_4")]=WXK_4; 00057 wxKeyMap::keymap[TEXT("WXK_5")]=WXK_5; 00058 wxKeyMap::keymap[TEXT("WXK_6")]=WXK_6; 00059 wxKeyMap::keymap[TEXT("WXK_7")]=WXK_7; 00060 wxKeyMap::keymap[TEXT("WXK_8")]=WXK_8; 00061 wxKeyMap::keymap[TEXT("WXK_9")]=WXK_9; 00062 wxKeyMap::keymap[TEXT("WXK_A")]=WXK_A; 00063 wxKeyMap::keymap[TEXT("WXK_B")]=WXK_B; 00064 wxKeyMap::keymap[TEXT("WXK_C")]=WXK_C; 00065 wxKeyMap::keymap[TEXT("WXK_D")]=WXK_D; 00066 wxKeyMap::keymap[TEXT("WXK_E")]=WXK_E; 00067 wxKeyMap::keymap[TEXT("WXK_F")]=WXK_F; 00068 wxKeyMap::keymap[TEXT("WXK_G")]=WXK_G; 00069 wxKeyMap::keymap[TEXT("WXK_H")]=WXK_H; 00070 wxKeyMap::keymap[TEXT("WXK_I")]=WXK_I; 00071 wxKeyMap::keymap[TEXT("WXK_J")]=WXK_J; 00072 wxKeyMap::keymap[TEXT("WXK_K")]=WXK_K; 00073 wxKeyMap::keymap[TEXT("WXK_L")]=WXK_L; 00074 wxKeyMap::keymap[TEXT("WXK_M")]=WXK_M; 00075 wxKeyMap::keymap[TEXT("WXK_N")]=WXK_N; 00076 wxKeyMap::keymap[TEXT("WXK_O")]=WXK_O; 00077 wxKeyMap::keymap[TEXT("WXK_P")]=WXK_P; 00078 wxKeyMap::keymap[TEXT("WXK_Q")]=WXK_Q; 00079 wxKeyMap::keymap[TEXT("WXK_R")]=WXK_R; 00080 wxKeyMap::keymap[TEXT("WXK_S")]=WXK_S; 00081 wxKeyMap::keymap[TEXT("WXK_T")]=WXK_T; 00082 wxKeyMap::keymap[TEXT("WXK_U")]=WXK_U; 00083 wxKeyMap::keymap[TEXT("WXK_V")]=WXK_V; 00084 wxKeyMap::keymap[TEXT("WXK_W")]=WXK_W; 00085 wxKeyMap::keymap[TEXT("WXK_X")]=WXK_X; 00086 wxKeyMap::keymap[TEXT("WXK_Y")]=WXK_Y; 00087 wxKeyMap::keymap[TEXT("WXK_Z")]=WXK_Z; 00088 wxKeyMap::keymap[TEXT("WXK_LESS")]=WXK_LESS; 00089 wxKeyMap::keymap[TEXT("WXK_GREATER")]=WXK_GREATER; 00090 wxKeyMap::keymap[TEXT("WXK_ADD")]=WXK_ADD; 00091 wxKeyMap::keymap[TEXT("WXK_EQUALS")]=WXK_EQUALS; 00092 wxKeyMap::keymap[TEXT("WXK_COMMA")]=WXK_COMMA; 00093 wxKeyMap::keymap[TEXT("WXK_MINUS")]=WXK_MINUS; 00094 wxKeyMap::keymap[TEXT("WXK_PERIOD")]=WXK_PERIOD; 00095 wxKeyMap::keymap[TEXT("WXK_HASH")]=WXK_HASH; 00096 00097 /* Defined in wx/defs.h */ 00098 wxKeyMap::keymap[TEXT("WXK_BACK")]=WXK_BACK; 00099 wxKeyMap::keymap[TEXT("WXK_TAB")]=WXK_TAB; 00100 wxKeyMap::keymap[TEXT("WXK_RETURN")]=WXK_RETURN; 00101 wxKeyMap::keymap[TEXT("WXK_ESCAPE")]=WXK_ESCAPE; 00102 wxKeyMap::keymap[TEXT("WXK_SPACE")]=WXK_SPACE; 00103 wxKeyMap::keymap[TEXT("WXK_DELETE")]=WXK_DELETE; 00104 wxKeyMap::keymap[TEXT("WXK_START")]=WXK_START; 00105 wxKeyMap::keymap[TEXT("WXK_LBUTTON")]=WXK_LBUTTON; 00106 wxKeyMap::keymap[TEXT("WXK_RBUTTON")]=WXK_RBUTTON; 00107 wxKeyMap::keymap[TEXT("WXK_CANCEL")]=WXK_CANCEL; 00108 wxKeyMap::keymap[TEXT("WXK_MBUTTON")]=WXK_MBUTTON; 00109 wxKeyMap::keymap[TEXT("WXK_CLEAR")]=WXK_CLEAR; 00110 wxKeyMap::keymap[TEXT("WXK_SHIFT")]=WXK_SHIFT; 00111 wxKeyMap::keymap[TEXT("WXK_ALT")]=WXK_ALT; 00112 wxKeyMap::keymap[TEXT("WXK_CONTROL")]=WXK_CONTROL; 00113 wxKeyMap::keymap[TEXT("WXK_MENU")]=WXK_MENU; 00114 wxKeyMap::keymap[TEXT("WXK_PAUSE")]=WXK_PAUSE; 00115 wxKeyMap::keymap[TEXT("WXK_CAPITAL")]=WXK_CAPITAL; 00116 wxKeyMap::keymap[TEXT("WXK_PRIOR")]=WXK_PRIOR; 00117 wxKeyMap::keymap[TEXT("WXK_NEXT")]=WXK_NEXT; 00118 wxKeyMap::keymap[TEXT("WXK_END")]=WXK_END; 00119 wxKeyMap::keymap[TEXT("WXK_HOME")]=WXK_HOME; 00120 wxKeyMap::keymap[TEXT("WXK_LEFT")]=WXK_LEFT; 00121 wxKeyMap::keymap[TEXT("WXK_UP")]=WXK_UP; 00122 wxKeyMap::keymap[TEXT("WXK_RIGHT")]=WXK_RIGHT; 00123 wxKeyMap::keymap[TEXT("WXK_DOWN")]=WXK_DOWN; 00124 wxKeyMap::keymap[TEXT("WXK_SELECT")]=WXK_SELECT; 00125 wxKeyMap::keymap[TEXT("WXK_PRINT")]=WXK_PRINT; 00126 wxKeyMap::keymap[TEXT("WXK_EXECUTE")]=WXK_EXECUTE; 00127 wxKeyMap::keymap[TEXT("WXK_SNAPSHOT")]=WXK_SNAPSHOT; 00128 wxKeyMap::keymap[TEXT("WXK_INSERT")]=WXK_INSERT; 00129 wxKeyMap::keymap[TEXT("WXK_HELP")]=WXK_HELP; 00130 wxKeyMap::keymap[TEXT("WXK_NUMPAD0")]=WXK_NUMPAD0; 00131 wxKeyMap::keymap[TEXT("WXK_NUMPAD1")]=WXK_NUMPAD1; 00132 wxKeyMap::keymap[TEXT("WXK_NUMPAD2")]=WXK_NUMPAD2; 00133 wxKeyMap::keymap[TEXT("WXK_NUMPAD3")]=WXK_NUMPAD3; 00134 wxKeyMap::keymap[TEXT("WXK_NUMPAD4")]=WXK_NUMPAD4; 00135 wxKeyMap::keymap[TEXT("WXK_NUMPAD5")]=WXK_NUMPAD5; 00136 wxKeyMap::keymap[TEXT("WXK_NUMPAD6")]=WXK_NUMPAD6; 00137 wxKeyMap::keymap[TEXT("WXK_NUMPAD7")]=WXK_NUMPAD7; 00138 wxKeyMap::keymap[TEXT("WXK_NUMPAD8")]=WXK_NUMPAD8; 00139 wxKeyMap::keymap[TEXT("WXK_NUMPAD9")]=WXK_NUMPAD9; 00140 wxKeyMap::keymap[TEXT("WXK_MULTIPLY")]=WXK_MULTIPLY; 00141 wxKeyMap::keymap[TEXT("WXK_SEPARATOR")]=WXK_SEPARATOR; 00142 wxKeyMap::keymap[TEXT("WXK_SUBTRACT")]=WXK_SUBTRACT; 00143 wxKeyMap::keymap[TEXT("WXK_DECIMAL")]=WXK_DECIMAL; 00144 wxKeyMap::keymap[TEXT("WXK_F1")]=WXK_F1; 00145 wxKeyMap::keymap[TEXT("WXK_F2")]=WXK_F2; 00146 wxKeyMap::keymap[TEXT("WXK_F3")]=WXK_F3; 00147 wxKeyMap::keymap[TEXT("WXK_F4")]=WXK_F4; 00148 wxKeyMap::keymap[TEXT("WXK_F5")]=WXK_F5; 00149 wxKeyMap::keymap[TEXT("WXK_F6")]=WXK_F6; 00150 wxKeyMap::keymap[TEXT("WXK_F7")]=WXK_F7; 00151 wxKeyMap::keymap[TEXT("WXK_F8")]=WXK_F8; 00152 wxKeyMap::keymap[TEXT("WXK_F9")]=WXK_F9; 00153 wxKeyMap::keymap[TEXT("WXK_F10")]=WXK_F10; 00154 wxKeyMap::keymap[TEXT("WXK_F11")]=WXK_F11; 00155 wxKeyMap::keymap[TEXT("WXK_F12")]=WXK_F12; 00156 wxKeyMap::keymap[TEXT("WXK_F13")]=WXK_F13; 00157 wxKeyMap::keymap[TEXT("WXK_F14")]=WXK_F14; 00158 wxKeyMap::keymap[TEXT("WXK_F15")]=WXK_F15; 00159 wxKeyMap::keymap[TEXT("WXK_F16")]=WXK_F16; 00160 wxKeyMap::keymap[TEXT("WXK_F17")]=WXK_F17; 00161 wxKeyMap::keymap[TEXT("WXK_F18")]=WXK_F18; 00162 wxKeyMap::keymap[TEXT("WXK_F19")]=WXK_F19; 00163 wxKeyMap::keymap[TEXT("WXK_F20")]=WXK_F20; 00164 wxKeyMap::keymap[TEXT("WXK_F21")]=WXK_F21; 00165 wxKeyMap::keymap[TEXT("WXK_F22")]=WXK_F22; 00166 wxKeyMap::keymap[TEXT("WXK_F23")]=WXK_F23; 00167 wxKeyMap::keymap[TEXT("WXK_F24")]=WXK_F24; 00168 wxKeyMap::keymap[TEXT("WXK_NUMLOCK")]=WXK_NUMLOCK; 00169 wxKeyMap::keymap[TEXT("WXK_SCROLL")]=WXK_SCROLL; 00170 wxKeyMap::keymap[TEXT("WXK_PAGEUP")]=WXK_PAGEUP; 00171 wxKeyMap::keymap[TEXT("WXK_PAGEDOWN")]=WXK_PAGEDOWN; 00172 wxKeyMap::keymap[TEXT("WXK_NUMPAD_SPACE")]=WXK_NUMPAD_SPACE; 00173 wxKeyMap::keymap[TEXT("WXK_NUMPAD_TAB")]=WXK_NUMPAD_TAB; 00174 wxKeyMap::keymap[TEXT("WXK_NUMPAD_ENTER")]=WXK_NUMPAD_ENTER; 00175 wxKeyMap::keymap[TEXT("WXK_NUMPAD_F1")]=WXK_NUMPAD_F1; 00176 wxKeyMap::keymap[TEXT("WXK_NUMPAD_F2")]=WXK_NUMPAD_F2; 00177 wxKeyMap::keymap[TEXT("WXK_NUMPAD_F3")]=WXK_NUMPAD_F3; 00178 wxKeyMap::keymap[TEXT("WXK_NUMPAD_F4")]=WXK_NUMPAD_F4; 00179 wxKeyMap::keymap[TEXT("WXK_NUMPAD_HOME")]=WXK_NUMPAD_HOME; 00180 wxKeyMap::keymap[TEXT("WXK_NUMPAD_LEFT")]=WXK_NUMPAD_LEFT; 00181 wxKeyMap::keymap[TEXT("WXK_NUMPAD_UP")]=WXK_NUMPAD_UP; 00182 wxKeyMap::keymap[TEXT("WXK_NUMPAD_RIGHT")]=WXK_NUMPAD_RIGHT; 00183 wxKeyMap::keymap[TEXT("WXK_NUMPAD_DOWN")]=WXK_NUMPAD_DOWN; 00184 wxKeyMap::keymap[TEXT("WXK_NUMPAD_PRIOR")]=WXK_NUMPAD_PRIOR; 00185 wxKeyMap::keymap[TEXT("WXK_NUMPAD_PAGEUP")]=WXK_NUMPAD_PAGEUP; 00186 wxKeyMap::keymap[TEXT("WXK_NUMPAD_NEXT")]=WXK_NUMPAD_NEXT; 00187 wxKeyMap::keymap[TEXT("WXK_NUMPAD_PAGEDOWN")]=WXK_NUMPAD_PAGEDOWN; 00188 wxKeyMap::keymap[TEXT("WXK_NUMPAD_END")]=WXK_NUMPAD_END; 00189 wxKeyMap::keymap[TEXT("WXK_NUMPAD_BEGIN")]=WXK_NUMPAD_BEGIN; 00190 wxKeyMap::keymap[TEXT("WXK_NUMPAD_INSERT")]=WXK_NUMPAD_INSERT; 00191 wxKeyMap::keymap[TEXT("WXK_NUMPAD_DELETE")]=WXK_NUMPAD_DELETE; 00192 wxKeyMap::keymap[TEXT("WXK_NUMPAD_EQUAL")]=WXK_NUMPAD_EQUAL; 00193 wxKeyMap::keymap[TEXT("WXK_NUMPAD_MULTIPLY")]=WXK_NUMPAD_MULTIPLY; 00194 wxKeyMap::keymap[TEXT("WXK_NUMPAD_ADD")]=WXK_NUMPAD_ADD; 00195 wxKeyMap::keymap[TEXT("WXK_NUMPAD_SEPARATOR")]=WXK_NUMPAD_SEPARATOR; 00196 wxKeyMap::keymap[TEXT("WXK_NUMPAD_SUBTRACT")]=WXK_NUMPAD_SUBTRACT; 00197 wxKeyMap::keymap[TEXT("WXK_NUMPAD_DECIMAL")]=WXK_NUMPAD_DECIMAL; 00198 wxKeyMap::keymap[TEXT("WXK_NUMPAD_DIVIDE")]=WXK_NUMPAD_DIVIDE; 00199 wxKeyMap::keymap[TEXT("WXK_WINDOWS_LEFT")]=WXK_WINDOWS_LEFT; 00200 wxKeyMap::keymap[TEXT("WXK_WINDOWS_RIGHT")]=WXK_WINDOWS_RIGHT; 00201 wxKeyMap::keymap[TEXT("WXK_WINDOWS_MENU ")]=WXK_WINDOWS_MENU ; 00202 wxKeyMap::keymap[TEXT("WXK_COMMAND")]=WXK_COMMAND; 00203 wxKeyMap::keymap[TEXT("WXK_SPECIAL1")]=WXK_SPECIAL1; 00204 wxKeyMap::keymap[TEXT("WXK_SPECIAL2")]=WXK_SPECIAL2; 00205 wxKeyMap::keymap[TEXT("WXK_SPECIAL3")]=WXK_SPECIAL3; 00206 wxKeyMap::keymap[TEXT("WXK_SPECIAL4")]=WXK_SPECIAL4; 00207 wxKeyMap::keymap[TEXT("WXK_SPECIAL5")]=WXK_SPECIAL5; 00208 wxKeyMap::keymap[TEXT("WXK_SPECIAL6")]=WXK_SPECIAL6; 00209 wxKeyMap::keymap[TEXT("WXK_SPECIAL7")]=WXK_SPECIAL7; 00210 wxKeyMap::keymap[TEXT("WXK_SPECIAL8")]=WXK_SPECIAL8; 00211 wxKeyMap::keymap[TEXT("WXK_SPECIAL9")]=WXK_SPECIAL9; 00212 wxKeyMap::keymap[TEXT("WXK_SPECIAL10")]=WXK_SPECIAL10; 00213 wxKeyMap::keymap[TEXT("WXK_SPECIAL11")]=WXK_SPECIAL11; 00214 wxKeyMap::keymap[TEXT("WXK_SPECIAL12")]=WXK_SPECIAL12; 00215 wxKeyMap::keymap[TEXT("WXK_SPECIAL13")]=WXK_SPECIAL13; 00216 wxKeyMap::keymap[TEXT("WXK_SPECIAL14")]=WXK_SPECIAL14; 00217 wxKeyMap::keymap[TEXT("WXK_SPECIAL15")]=WXK_SPECIAL15; 00218 wxKeyMap::keymap[TEXT("WXK_SPECIAL16")]=WXK_SPECIAL16; 00219 wxKeyMap::keymap[TEXT("WXK_SPECIAL17")]=WXK_SPECIAL17; 00220 wxKeyMap::keymap[TEXT("WXK_SPECIAL18")]=WXK_SPECIAL18; 00221 wxKeyMap::keymap[TEXT("WXK_SPECIAL19")]=WXK_SPECIAL19; 00222 wxKeyMap::keymap[TEXT("WXK_SPECIAL20")]=WXK_SPECIAL20; 00223 }