1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2012 Matt RAYKOWSKI (sfb) <matt.raykowski@gmail.com>
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "nel/misc/events.h"
23 #include "nel/misc/string_conversion.h"
32 // ***************************************************************************
33 // The conversion table
34 static const CStringConversion
<TKey
>::CPair stringTable
[] =
73 { "KeyLBUTTON", KeyLBUTTON
},
74 { "KeyRBUTTON", KeyRBUTTON
},
75 { "KeyCANCEL", KeyCANCEL
},
76 { "KeyMBUTTON", KeyMBUTTON
},
77 { "KeyBACK", KeyBACK
},
79 { "KeyCLEAR", KeyCLEAR
},
80 { "KeyRETURN", KeyRETURN
},
81 { "KeySHIFT", KeySHIFT
},
82 { "KeyCONTROL", KeyCONTROL
},
83 { "KeyMENU", KeyMENU
},
84 { "KeyPAUSE", KeyPAUSE
},
85 { "KeyCAPITAL", KeyCAPITAL
},
86 { "KeyKANA", KeyKANA
},
87 { "KeyHANGEUL", KeyHANGEUL
},
88 { "KeyHANGUL", KeyHANGUL
},
89 { "KeyJUNJA", KeyJUNJA
},
90 { "KeyFINAL", KeyFINAL
},
91 { "KeyHANJA", KeyHANJA
},
92 { "KeyKANJI", KeyKANJI
},
93 { "KeyESCAPE", KeyESCAPE
},
94 { "KeyCONVERT", KeyCONVERT
},
95 { "KeyNONCONVERT", KeyNONCONVERT
},
96 { "KeyACCEPT", KeyACCEPT
},
97 { "KeyMODECHANGE", KeyMODECHANGE
},
98 { "KeySPACE", KeySPACE
},
99 { "KeyPRIOR", KeyPRIOR
},
100 { "KeyNEXT", KeyNEXT
},
101 { "KeyEND", KeyEND
},
102 { "KeyHOME", KeyHOME
},
103 { "KeyLEFT", KeyLEFT
},
105 { "KeyRIGHT", KeyRIGHT
},
106 { "KeyDOWN", KeyDOWN
},
107 { "KeySELECT", KeySELECT
},
108 { "KeyPRINT", KeyPRINT
},
109 { "KeyEXECUTE", KeyEXECUTE
},
110 { "KeySNAPSHOT", KeySNAPSHOT
},
111 { "KeyINSERT", KeyINSERT
},
112 { "KeyDELETE", KeyDELETE
},
113 { "KeyHELP", KeyHELP
},
114 { "KeyLWIN", KeyLWIN
},
115 { "KeyRWIN", KeyRWIN
},
116 { "KeyAPPS", KeyAPPS
},
117 { "KeyNUMPAD0", KeyNUMPAD0
},
118 { "KeyNUMPAD1", KeyNUMPAD1
},
119 { "KeyNUMPAD2", KeyNUMPAD2
},
120 { "KeyNUMPAD3", KeyNUMPAD3
},
121 { "KeyNUMPAD4", KeyNUMPAD4
},
122 { "KeyNUMPAD5", KeyNUMPAD5
},
123 { "KeyNUMPAD6", KeyNUMPAD6
},
124 { "KeyNUMPAD7", KeyNUMPAD7
},
125 { "KeyNUMPAD8", KeyNUMPAD8
},
126 { "KeyNUMPAD9", KeyNUMPAD9
},
127 { "KeyMULTIPLY", KeyMULTIPLY
},
128 { "KeyADD", KeyADD
},
129 { "KeySEPARATOR", KeySEPARATOR
},
130 { "KeySUBTRACT", KeySUBTRACT
},
131 { "KeyDECIMAL", KeyDECIMAL
},
132 { "KeyDIVIDE", KeyDIVIDE
},
142 { "KeyF10", KeyF10
},
143 { "KeyF11", KeyF11
},
144 { "KeyF12", KeyF12
},
145 { "KeyF13", KeyF13
},
146 { "KeyF14", KeyF14
},
147 { "KeyF15", KeyF15
},
148 { "KeyF16", KeyF16
},
149 { "KeyF17", KeyF17
},
150 { "KeyF18", KeyF18
},
151 { "KeyF19", KeyF19
},
152 { "KeyF20", KeyF20
},
153 { "KeyF21", KeyF21
},
154 { "KeyF22", KeyF22
},
155 { "KeyF23", KeyF23
},
156 { "KeyF24", KeyF24
},
157 { "KeyNUMLOCK", KeyNUMLOCK
},
158 { "KeySCROLL", KeySCROLL
},
159 { "KeyLSHIFT", KeyLSHIFT
},
160 { "KeyRSHIFT", KeyRSHIFT
},
161 { "KeyLCONTROL", KeyLCONTROL
},
162 { "KeyRCONTROL", KeyRCONTROL
},
163 { "KeyLMENU", KeyLMENU
},
164 { "KeyRMENU", KeyRMENU
},
165 { "KeyMUTE", KeyMUTE
},
166 { "KeyPLAYPAUSE", KeyPLAYPAUSE
},
167 { "KeyVOLUMEDOWN", KeyVOLUMEDOWN
},
168 { "KeyVOLUMEUP", KeyVOLUMEUP
},
169 { "KeyCALC", KeyCALC
},
170 { "KeySEMICOLON", KeySEMICOLON
},
171 { "KeyEQUALS", KeyEQUALS
},
172 { "KeyCOMMA", KeyCOMMA
},
173 { "KeyDASH", KeyDASH
},
174 { "KeyPERIOD", KeyPERIOD
},
175 { "KeySLASH", KeySLASH
},
176 { "KeyTILDE", KeyTILDE
},
177 { "KeyLBRACKET", KeyLBRACKET
},
178 { "KeyBACKSLASH", KeyBACKSLASH
},
179 { "KeyRBRACKET", KeyRBRACKET
},
180 { "KeyAPOSTROPHE", KeyAPOSTROPHE
},
181 { "KeyPARAGRAPH", KeyPARAGRAPH
},
182 { "KeyOEM_102", KeyOEM_102
},
183 { "KeyPROCESSKEY", KeyPROCESSKEY
},
184 { "KeyATTN", KeyATTN
},
185 { "KeyCRSEL", KeyCRSEL
},
186 { "KeyEXSEL", KeyEXSEL
},
187 { "KeyEREOF", KeyEREOF
},
188 { "KeyPLAY", KeyPLAY
},
189 { "KeyZOOM", KeyZOOM
},
190 { "KeyNONAME", KeyNONAME
},
191 { "KeyPA1", KeyPA1
},
192 { "KeyOEM_CLEAR", KeyOEM_CLEAR
}
196 static CStringConversion
<TKey
> KeyConversion(stringTable
, sizeof(stringTable
) / sizeof(stringTable
[0]), KeyCount
);
199 // ***************************************************************************
200 TKey
CEventKey::getKeyFromString(const std::string
&str
)
202 return KeyConversion
.fromString(str
);
205 // ***************************************************************************
206 const std::string
&CEventKey::getStringFromKey(TKey k
)
208 return KeyConversion
.toString(k
);