1 // Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of the License "Eclipse Public License v1.0" |
4 // under the terms of the License "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
68 EModifierRotateBy180| |
68 EModifierRotateBy180| |
69 EModifierRotateBy270; |
69 EModifierRotateBy270; |
70 |
70 |
71 |
71 |
72 /** |
72 /** |
73 A contiguous range of logical scancodes of type, and ordering, as |
|
74 defined in TStdScanCode. |
|
75 Once aligned with an array of target keycodes, a pairwise |
|
76 association between each scancode and its translation will |
|
77 be defined. |
|
78 |
|
79 @publishedPartner |
73 @publishedPartner |
80 @released |
74 @released |
81 */ |
75 */ |
82 struct SScanCodeBlock |
76 struct SScanCodeBlock |
83 { |
77 { |
84 TUint16 firstScanCode; |
78 TUint16 firstScanCode; |
85 TUint16 lastScanCode; |
79 TUint16 lastScanCode; |
86 }; |
80 }; |
87 |
81 |
88 /** |
82 /** |
89 An array of SScanCodeBlock scancode ranges. This allows |
|
90 a discontiguous set of scancodes to be treated contiguously. |
|
91 |
|
92 @publishedPartner |
83 @publishedPartner |
93 @released |
84 @released |
94 */ |
85 */ |
95 struct SScanCodeBlockList |
86 struct SScanCodeBlockList |
96 { |
87 { |
97 TUint numBlocks; |
88 TUint numBlocks; |
98 const SScanCodeBlock *pblocks; |
89 const SScanCodeBlock *pblocks; |
99 }; |
90 }; |
100 |
91 |
101 /** |
92 /** |
102 Associates an SScanCodeBlockList with |
|
103 a specific set of target keycodes. This defines a concrete |
|
104 translation for the scancodes in the scanCodes block list. |
|
105 |
|
106 @publishedPartner |
93 @publishedPartner |
107 @released |
94 @released |
108 */ |
95 */ |
109 struct SConvSubTable |
96 struct SConvSubTable |
110 { |
97 { |
111 const TUint16 *pkeyCode; //<! An array of target keycodes |
98 const TUint16 *pkeyCode; |
112 SScanCodeBlockList scanCodes; |
99 SScanCodeBlockList scanCodes; |
113 }; |
100 }; |
114 |
101 |
115 /** |
102 /** |
116 Associates a combination of modifier keys with the translation |
|
117 table to be used when the combination is active. |
|
118 |
|
119 @publishedPartner |
103 @publishedPartner |
120 @released |
104 @released |
121 */ |
105 */ |
122 struct SConvTableNode |
106 struct SConvTableNode |
123 { |
107 { |
124 TMaskedModifiers maskedModifiers; |
108 TMaskedModifiers maskedModifiers; |
125 TUint numSubTables; |
109 TUint numSubTables; |
126 const SConvSubTable * const *ppsubTables; |
110 const SConvSubTable * const *ppsubTables; |
127 }; |
111 }; |
128 |
112 |
129 /** |
113 /** |
130 The top level collection of all different translation |
|
131 tables. |
|
132 |
|
133 @publishedPartner |
114 @publishedPartner |
134 @released |
115 @released |
135 */ |
116 */ |
136 struct SConvTable |
117 struct SConvTable |
137 { |
118 { |
169 TUint8 func; |
140 TUint8 func; |
170 TUint8 filler; |
141 TUint8 filler; |
171 }; |
142 }; |
172 |
143 |
173 /** |
144 /** |
174 Defines an action to perform and the next state transition |
|
175 when a given key press occurs. |
|
176 |
|
177 @publishedPartner |
145 @publishedPartner |
178 @released |
146 @released |
179 */ |
147 */ |
180 struct SFuncAndState |
148 struct SFuncAndState |
181 { |
149 { |
182 TUint8 state; ///< The next TState to transition to |
150 TUint8 state; |
183 TUint8 func; ///< A TFuncGeneral action |
151 TUint8 func; |
184 TInt32 funcParam; ///< Parameter for func (key to translate to for EPassSpecialKeyThru) |
152 TInt32 funcParam; |
185 }; |
153 }; |
186 |
154 |
187 /** |
155 /** |
188 Associates a SFuncAndState, which defines an action, with a |
|
189 key press and modifier combination to trigger it. |
|
190 |
|
191 @publishedPartner |
156 @publishedPartner |
192 @released |
157 @released |
193 */ |
158 */ |
194 struct SFuncTableEntry |
159 struct SFuncTableEntry |
195 { |
160 { |
196 TMaskedModifiers maskedModifiers; ///< Required modifier combination |
161 TMaskedModifiers maskedModifiers; |
197 TKeyCodePattern keyCodePattern; ///< Required keypress |
162 TKeyCodePattern keyCodePattern; |
198 SFuncAndState funcAndNewState; ///< Action or translation |
163 SFuncAndState funcAndNewState; |
199 }; |
164 }; |
200 |
165 |
201 /** |
166 /** |
202 A function table corresponds to a particular keyboard |
|
203 mode. When this mode is active this table's entries |
|
204 are used to perform actions or translations |
|
205 for certain keypresses. |
|
206 |
|
207 @see SFuncTableEntry |
|
208 |
|
209 @publishedPartner |
167 @publishedPartner |
210 @released |
168 @released |
211 */ |
169 */ |
212 struct SFuncTable |
170 struct SFuncTable |
213 { |
171 { |
214 TUint numEntries; |
172 TUint numEntries; |
215 const SFuncTableEntry *pentries; |
173 const SFuncTableEntry *pentries; |
216 }; |
174 }; |
217 |
175 |
218 /** |
176 /** |
219 Collection of all keyboard mode function tables |
|
220 |
|
221 @publishedPartner |
177 @publishedPartner |
222 @released |
178 @released |
223 */ |
179 */ |
224 struct SFuncTables |
180 struct SFuncTables |
225 { |
181 { |
226 /** |
|
227 This table is searched for a match if a match has not been |
|
228 found in the current state's table |
|
229 */ |
|
230 SFuncTable defaultTable; |
182 SFuncTable defaultTable; |
231 |
|
232 /** |
|
233 This table controls which keys change which modifiers; |
|
234 the state field in this table is ignored |
|
235 */ |
|
236 SFuncTable modifierTable; |
183 SFuncTable modifierTable; |
237 |
|
238 /** |
|
239 Number of entries in array pgenFuncTables. |
|
240 This must in fact, always be equal to 13. |
|
241 */ |
|
242 TUint numGenFuncTables; |
184 TUint numGenFuncTables; |
243 |
|
244 /** |
|
245 Array of pointers to general state control tables. |
|
246 |
|
247 Indicies 1-12 are possible tables, index 0 |
|
248 should be unused. |
|
249 |
|
250 If a state is not used its SFuncTable array size should be set to |
|
251 zero and the pointer to NULL |
|
252 */ |
|
253 const SFuncTable *pgenFuncTables; |
185 const SFuncTable *pgenFuncTables; |
254 }; |
186 }; |
255 |
187 |
256 /** |
188 /** |
257 Extends TChar with some extra utility functions |
|
258 |
|
259 @internalComponent |
189 @internalComponent |
260 @released |
190 @released |
261 */ |
191 */ |
262 class TCharExtended: public TChar |
192 class TCharExtended: public TChar |
263 { |
193 { |
380 TBool iErrorFlag; |
290 TBool iErrorFlag; |
381 TCtrlDigitsTermination iTermination; |
291 TCtrlDigitsTermination iTermination; |
382 }; |
292 }; |
383 |
293 |
384 /** |
294 /** |
385 Definitions for keyboard states. |
|
386 The first 3 values identify special keyboard states and |
|
387 are used as an index to these states' tables. This is |
|
388 only a partial list of possible states, states 1-9 |
|
389 are also valid, and should be used for translating |
|
390 isolated characters e.g. to apply diacritics to vowels. |
|
391 |
|
392 The next 3 do not specify particular states, but give |
|
393 information to the key translator so that it can |
|
394 decide the next state. |
|
395 |
|
396 @internalComponent |
295 @internalComponent |
397 @released |
296 @released |
398 */ |
297 */ |
399 enum TState |
298 enum TState |
400 { |
299 { |
401 /** |
300 // values used as an index to a table |
402 Normal keyboard state, which defines keys |
|
403 that transition to the other states. |
|
404 */ |
|
405 EStateNormal =0x0a, |
301 EStateNormal =0x0a, |
406 |
|
407 /** |
|
408 Allow characters to be specified |
|
409 by a decimal code. The state will be transitioned |
|
410 back to EStateNormal after a given count. |
|
411 */ |
|
412 EStateCtrlDigitsUntilCount =0x0b, |
302 EStateCtrlDigitsUntilCount =0x0b, |
413 |
|
414 /** |
|
415 Allow characters to be specified |
|
416 by a decimal code. The state will be transitioned |
|
417 back to EStateNormal once Ctrl is released. |
|
418 */ |
|
419 EStateCtrlDigitsUntilCtrlUp =0x0c, |
303 EStateCtrlDigitsUntilCtrlUp =0x0c, |
420 |
|
421 // values used as "rules" to be processed in a switch statement |
304 // values used as "rules" to be processed in a switch statement |
422 EStateUnchanged =0x40, |
305 EStateUnchanged =0x40, |
423 EStateDerivedFromDigitEntered, |
306 EStateDerivedFromDigitEntered, |
424 EStateCtrlDigits |
307 EStateCtrlDigits |
425 }; |
308 }; |
426 |
309 |
427 /** |
310 /** |
428 Defines an action to be performed for a keypress. |
|
429 @see SFuncAndState::func |
|
430 |
|
431 @internalComponent |
311 @internalComponent |
432 @released |
312 @released |
433 */ |
313 */ |
434 enum TFuncGeneral |
314 enum TFuncGeneral |
435 { |
315 { |
436 EDoNothing =0x00, |
316 EDoNothing =0x00, |
437 EPassKeyThru, ///< Pass key through, unchanged |
317 EPassKeyThru, |
438 EPassSpecialKeyThru, ///< Translate to a new character |
318 EPassSpecialKeyThru, |
439 EPassCtrlDigitsThru, ///< End accumulation of character digits |
319 EPassCtrlDigitsThru, |
440 EAddOnCtrlDigit, ///< Allow another control digit to be entered |
320 EAddOnCtrlDigit, |
441 }; |
321 }; |
442 |
322 |
443 /** |
323 /** |
444 Concrete implementation of a CKeyTranslator. |
|
445 |
|
446 @internalComponent |
324 @internalComponent |
447 @released |
325 @released |
448 */ |
326 */ |
449 NONSHARABLE_CLASS(CKeyTranslatorX) : public CKeyTranslator |
327 NONSHARABLE_CLASS(CKeyTranslatorX) : public CKeyTranslator |
450 { |
328 { |