0
|
1 |
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// e32\include\k32keys.h
|
|
15 |
//
|
|
16 |
// WARNING: This file contains some APIs which are internal and are subject
|
|
17 |
// to change without notice. Such APIs should therefore not be used
|
|
18 |
// outside the Kernel and Hardware Services package.
|
|
19 |
//
|
|
20 |
|
|
21 |
#ifndef __KEYSTD_H__
|
|
22 |
#define __KEYSTD_H__
|
|
23 |
|
|
24 |
|
|
25 |
////////////////////////////////////////////////////////
|
|
26 |
//
|
|
27 |
// Bits required for keyboard translation software
|
|
28 |
//
|
|
29 |
////////////////////////////////////////////////////////
|
|
30 |
|
|
31 |
#include <e32svr.h>
|
|
32 |
|
|
33 |
/**
|
|
34 |
@internalComponent
|
|
35 |
@released
|
|
36 |
*/
|
|
37 |
const TUint KConvTableSettableModifiers=EModifierAutorepeatable|
|
|
38 |
EModifierKeypad|
|
|
39 |
EModifierPureKeycode;
|
|
40 |
|
|
41 |
/**
|
|
42 |
@internalComponent
|
|
43 |
@released
|
|
44 |
*/
|
|
45 |
const TUint KPersistentModifiers=EModifierLeftAlt|
|
|
46 |
EModifierRightAlt|
|
|
47 |
EModifierAlt|
|
|
48 |
EModifierLeftCtrl|
|
|
49 |
EModifierRightCtrl|
|
|
50 |
EModifierCtrl|
|
|
51 |
EModifierLeftShift|
|
|
52 |
EModifierRightShift|
|
|
53 |
EModifierShift|
|
|
54 |
EModifierLeftFunc|
|
|
55 |
EModifierRightFunc|
|
|
56 |
EModifierFunc|
|
|
57 |
EModifierCapsLock|
|
|
58 |
EModifierNumLock|
|
|
59 |
EModifierScrollLock|
|
|
60 |
EModifierKeyboardExtend;
|
|
61 |
|
|
62 |
|
|
63 |
/**
|
|
64 |
@internalComponent
|
|
65 |
@released
|
|
66 |
*/
|
|
67 |
const TUint KRotationModifiers=EModifierRotateBy90|
|
|
68 |
EModifierRotateBy180|
|
|
69 |
EModifierRotateBy270;
|
|
70 |
|
|
71 |
|
|
72 |
/**
|
|
73 |
@publishedPartner
|
|
74 |
@released
|
|
75 |
*/
|
|
76 |
struct SScanCodeBlock
|
|
77 |
{
|
|
78 |
TUint16 firstScanCode;
|
|
79 |
TUint16 lastScanCode;
|
|
80 |
};
|
|
81 |
|
|
82 |
/**
|
|
83 |
@publishedPartner
|
|
84 |
@released
|
|
85 |
*/
|
|
86 |
struct SScanCodeBlockList
|
|
87 |
{
|
|
88 |
TUint numBlocks;
|
|
89 |
const SScanCodeBlock *pblocks;
|
|
90 |
};
|
|
91 |
|
|
92 |
/**
|
|
93 |
@publishedPartner
|
|
94 |
@released
|
|
95 |
*/
|
|
96 |
struct SConvSubTable
|
|
97 |
{
|
|
98 |
const TUint16 *pkeyCode;
|
|
99 |
SScanCodeBlockList scanCodes;
|
|
100 |
};
|
|
101 |
|
|
102 |
/**
|
|
103 |
@publishedPartner
|
|
104 |
@released
|
|
105 |
*/
|
|
106 |
struct SConvTableNode
|
|
107 |
{
|
|
108 |
TMaskedModifiers maskedModifiers;
|
|
109 |
TUint numSubTables;
|
|
110 |
const SConvSubTable * const *ppsubTables;
|
|
111 |
};
|
|
112 |
|
|
113 |
/**
|
|
114 |
@publishedPartner
|
|
115 |
@released
|
|
116 |
*/
|
|
117 |
struct SConvTable
|
|
118 |
{
|
|
119 |
TUint numNodes;
|
|
120 |
const SConvTableNode *pnodes;
|
|
121 |
};
|
|
122 |
|
|
123 |
/**
|
|
124 |
@publishedPartner
|
|
125 |
@released
|
|
126 |
*/
|
|
127 |
struct SKeyCodeList
|
|
128 |
{
|
|
129 |
TUint numKeyCodes;
|
|
130 |
const TUint16 *pkeyCodes;
|
|
131 |
};
|
|
132 |
|
|
133 |
/**
|
|
134 |
@publishedPartner
|
|
135 |
@released
|
|
136 |
*/
|
|
137 |
struct SFunc
|
|
138 |
{
|
|
139 |
TInt32 funcParam;
|
|
140 |
TUint8 func;
|
|
141 |
TUint8 filler;
|
|
142 |
};
|
|
143 |
|
|
144 |
/**
|
|
145 |
@publishedPartner
|
|
146 |
@released
|
|
147 |
*/
|
|
148 |
struct SFuncAndState
|
|
149 |
{
|
|
150 |
TUint8 state;
|
|
151 |
TUint8 func;
|
|
152 |
TInt32 funcParam;
|
|
153 |
};
|
|
154 |
|
|
155 |
/**
|
|
156 |
@publishedPartner
|
|
157 |
@released
|
|
158 |
*/
|
|
159 |
struct SFuncTableEntry
|
|
160 |
{
|
|
161 |
TMaskedModifiers maskedModifiers;
|
|
162 |
TKeyCodePattern keyCodePattern;
|
|
163 |
SFuncAndState funcAndNewState;
|
|
164 |
};
|
|
165 |
|
|
166 |
/**
|
|
167 |
@publishedPartner
|
|
168 |
@released
|
|
169 |
*/
|
|
170 |
struct SFuncTable
|
|
171 |
{
|
|
172 |
TUint numEntries;
|
|
173 |
const SFuncTableEntry *pentries;
|
|
174 |
};
|
|
175 |
|
|
176 |
/**
|
|
177 |
@publishedPartner
|
|
178 |
@released
|
|
179 |
*/
|
|
180 |
struct SFuncTables
|
|
181 |
{
|
|
182 |
SFuncTable defaultTable;
|
|
183 |
SFuncTable modifierTable;
|
|
184 |
TUint numGenFuncTables;
|
|
185 |
const SFuncTable *pgenFuncTables;
|
|
186 |
};
|
|
187 |
|
|
188 |
/**
|
|
189 |
@internalComponent
|
|
190 |
@released
|
|
191 |
*/
|
|
192 |
class TCharExtended: public TChar
|
|
193 |
{
|
|
194 |
public:
|
|
195 |
inline TCharExtended();
|
|
196 |
inline TCharExtended(TUint aChar);
|
|
197 |
TCharExtended &operator=(TUint aChar);
|
|
198 |
TBool IsDigitGivenRadix(TRadix aRadix) const;
|
|
199 |
TBool IsModifier() const;
|
|
200 |
TInt DigitValue() const;
|
|
201 |
TBool MatchesPattern(const TKeyCodePattern &aKeyCodePattern, TRadix aRadix=EDecimal) const;
|
|
202 |
};
|
|
203 |
|
|
204 |
/**
|
|
205 |
@internalComponent
|
|
206 |
@released
|
|
207 |
*/
|
|
208 |
class TFuncTable
|
|
209 |
{
|
|
210 |
public:
|
|
211 |
TFuncTable();
|
|
212 |
void Update(RLibrary aLibrary);
|
|
213 |
SFunc GetModifierFunc(const TCharExtended &aChar, const TInt &aModifiers) const;
|
|
214 |
SFuncAndState GetGeneralFuncAndState(const TCharExtended &aChar, const TInt &aModifiers,
|
|
215 |
TUint aCurState, TRadix aRadix) const;
|
|
216 |
private:
|
|
217 |
SFuncTables iFuncTables;
|
|
218 |
SFuncTableEntry getDefault(const TCharExtended &aChar, const TInt &aModifiers) const;
|
|
219 |
};
|
|
220 |
|
|
221 |
/**
|
|
222 |
@internalComponent
|
|
223 |
@released
|
|
224 |
*/
|
|
225 |
struct SConvKeyData
|
|
226 |
{
|
|
227 |
TInt modifiers;
|
|
228 |
TUint16 keyCode;
|
|
229 |
TUint16 filler;
|
|
230 |
};
|
|
231 |
|
|
232 |
/**
|
|
233 |
@publishedPartner
|
|
234 |
@released
|
|
235 |
*/
|
|
236 |
enum TCtrlDigitsTermination
|
|
237 |
{
|
|
238 |
ETerminationByCount,
|
|
239 |
ETerminationByCtrlUp
|
|
240 |
};
|
|
241 |
|
|
242 |
/**
|
|
243 |
@internalComponent
|
|
244 |
@released
|
|
245 |
*/
|
|
246 |
class TConvTable
|
|
247 |
{
|
|
248 |
public:
|
|
249 |
TConvTable();
|
|
250 |
void Update(RLibrary aLibrary);
|
|
251 |
SConvKeyData Convert(TUint aScanCode, const TInt &aModifiers) const;
|
|
252 |
SConvKeyData ConvertBaseCase(TUint aScanCode, const TInt &aModifiers) const;
|
|
253 |
inline TUint FirstScanCode() const;
|
|
254 |
inline TUint LastScanCode() const;
|
|
255 |
private:
|
|
256 |
SConvTable iConvTable;
|
|
257 |
TUint iFirstScanCode;
|
|
258 |
TUint iLastScanCode;
|
|
259 |
SScanCodeBlockList iKeypadScanCodes;
|
|
260 |
SKeyCodeList iNonAutorepKeyCodes;
|
|
261 |
TBool onKeypad(TUint aScanCode) const;
|
|
262 |
TBool autorepeatable(TUint aKeyCode) const;
|
|
263 |
};
|
|
264 |
|
|
265 |
/**
|
|
266 |
@internalComponent
|
|
267 |
@released
|
|
268 |
*/
|
|
269 |
class TCtrlDigits
|
|
270 |
{
|
|
271 |
public:
|
|
272 |
TCtrlDigits();
|
|
273 |
void Update(RLibrary aLibrary);
|
|
274 |
void Reset();
|
|
275 |
void AppendDigit(TUint aKeyCode, TUint aModifiers);
|
|
276 |
inline void SetRadix(TRadix aRadix);
|
|
277 |
inline void SetMaxCount(TInt aMaxCount);
|
|
278 |
inline TRadix GetRadix() const;
|
|
279 |
TBool Terminated(TInt aModifiers) const;
|
|
280 |
TUint SetStateToCtrlDigits() const;
|
|
281 |
inline TBool WithinLimits() const;
|
|
282 |
inline TUint GetDigits() const;
|
|
283 |
inline TBool Error() const;
|
|
284 |
private:
|
|
285 |
TInt iCount;
|
|
286 |
TInt iMaxCount;
|
|
287 |
TInt iMaximumCtrlDigitsMaxCount;
|
|
288 |
TUint32 iDigits;
|
|
289 |
TRadix iRadix;
|
|
290 |
TBool iErrorFlag;
|
|
291 |
TCtrlDigitsTermination iTermination;
|
|
292 |
};
|
|
293 |
|
|
294 |
/**
|
|
295 |
@internalComponent
|
|
296 |
@released
|
|
297 |
*/
|
|
298 |
enum TState
|
|
299 |
{
|
|
300 |
// values used as an index to a table
|
|
301 |
EStateNormal =0x0a,
|
|
302 |
EStateCtrlDigitsUntilCount =0x0b,
|
|
303 |
EStateCtrlDigitsUntilCtrlUp =0x0c,
|
|
304 |
// values used as "rules" to be processed in a switch statement
|
|
305 |
EStateUnchanged =0x40,
|
|
306 |
EStateDerivedFromDigitEntered,
|
|
307 |
EStateCtrlDigits
|
|
308 |
};
|
|
309 |
|
|
310 |
/**
|
|
311 |
@internalComponent
|
|
312 |
@released
|
|
313 |
*/
|
|
314 |
enum TFuncGeneral
|
|
315 |
{
|
|
316 |
EDoNothing =0x00,
|
|
317 |
EPassKeyThru,
|
|
318 |
EPassSpecialKeyThru,
|
|
319 |
EPassCtrlDigitsThru,
|
|
320 |
EAddOnCtrlDigit,
|
|
321 |
};
|
|
322 |
|
|
323 |
/**
|
|
324 |
@internalComponent
|
|
325 |
@released
|
|
326 |
*/
|
|
327 |
NONSHARABLE_CLASS(CKeyTranslatorX) : public CKeyTranslator
|
|
328 |
{
|
|
329 |
friend class CKeyTranslator;
|
|
330 |
public:
|
|
331 |
CKeyTranslatorX();
|
|
332 |
virtual TInt GetModifierState();
|
|
333 |
virtual void SetModifierState(TEventModifier aModifier,TModifierState aState);
|
|
334 |
virtual TBool TranslateKey(TUint aScanCode, TBool aKeyUp,
|
|
335 |
const CCaptureKeys &aCaptureKeys, TKeyData &aKeyData);
|
|
336 |
virtual void UpdateModifiers(TInt aModifiers);
|
|
337 |
virtual TInt ChangeKeyData(const TDesC& aLibraryName);
|
|
338 |
TBool currentlyUpperCase(void);
|
|
339 |
TUint executeFunctionsAndSetState(TCharExtended aChar);
|
|
340 |
TInt Initialise();
|
|
341 |
private:
|
|
342 |
TInt iCurModifiers;
|
|
343 |
TMaskedModifiers iTogglingModifiers;
|
|
344 |
TCtrlDigits iCurCtrlDigits;
|
|
345 |
TConvTable iConvTable;
|
|
346 |
TFuncTable iFuncTable;
|
|
347 |
TUint iCurState;
|
|
348 |
TBool iIsdefaultKeyData;
|
|
349 |
RLibrary iKeyDataLib;
|
|
350 |
RLibrary iDefaultKeyDataLib;
|
|
351 |
};
|
|
352 |
|
|
353 |
/**
|
|
354 |
@internalComponent
|
|
355 |
@released
|
|
356 |
*/
|
|
357 |
enum TCP850Char
|
|
358 |
{
|
|
359 |
ECP850LogicNot=0x00aa,
|
|
360 |
ECP850LcAe=0x0091,
|
|
361 |
ECP850LcCcedilla=0x0087,
|
|
362 |
ECP850EsTset=0x00e1,
|
|
363 |
ECP850LcOslash=0x009b,
|
|
364 |
ECP850LcThorn=0x00d0,
|
|
365 |
ECP850LcSoftTh=0x00e7,
|
|
366 |
ECP850LeftChevron=0x00ae,
|
|
367 |
ECP850RightChevron=0x00af,
|
|
368 |
ECP850InvExclam=0x00ad,
|
|
369 |
ECP850InvQuest=0x00a8,
|
|
370 |
ECP850LcAo=0x0086,
|
|
371 |
ECP850Pound=0x009c,
|
|
372 |
ECP850LcAumlaut=0x0084,
|
|
373 |
ECP850LcEumlaut=0x0089,
|
|
374 |
ECP850LcIumlaut=0x008b,
|
|
375 |
ECP850LcOumlaut=0x0094,
|
|
376 |
ECP850LcUumlaut=0x009a,
|
|
377 |
ECP850LcYumlaut=0x0098,
|
|
378 |
ECP850SpaceUmlaut=0x00f9,
|
|
379 |
ECP850LcAgrave=0x0085,
|
|
380 |
ECP850LcEgrave=0x008a,
|
|
381 |
ECP850LcIgrave=0x008d,
|
|
382 |
ECP850LcOgrave=0x0095,
|
|
383 |
ECP850LcUgrave=0x0097,
|
|
384 |
ECP850SpaceGrave=0x0060,
|
|
385 |
ECP850LcAacute=0x00a0,
|
|
386 |
ECP850LcEacute=0x0082,
|
|
387 |
ECP850LcIacute=0x00a1,
|
|
388 |
ECP850LcOacute=0x00a2,
|
|
389 |
ECP850LcUacute=0x00a3,
|
|
390 |
ECP850LcYacute=0x00ec,
|
|
391 |
ECP850LcSpaceAcute=0x0027,
|
|
392 |
ECP850LcAtilde=0x00c6,
|
|
393 |
ECP850LcNtilde=0x00a4,
|
|
394 |
ECP850LcOtilde=0x00e4,
|
|
395 |
ECP850LcSpaceTilde=0x007e,
|
|
396 |
ECP850LcAcirc=0x0083,
|
|
397 |
ECP850LcEcirc=0x0088,
|
|
398 |
ECP850LcIcirc=0x008c,
|
|
399 |
ECP850LcOcirc=0x0093,
|
|
400 |
ECP850LcUcirc=0x0096,
|
|
401 |
ECP850LcSpaceCirc=0x005e
|
|
402 |
};
|
|
403 |
|
|
404 |
/**
|
|
405 |
@internalComponent
|
|
406 |
@released
|
|
407 |
*/
|
|
408 |
enum TLatin1Char
|
|
409 |
{
|
|
410 |
ELatin1LogicNot=0x0090,
|
|
411 |
ELatin1LcAe=0x00e6,
|
|
412 |
ELatin1UcAe=0x00c6,
|
|
413 |
ELatin1LcCcedilla=0x00e7,
|
|
414 |
ELatin1EsTset=0x00df,
|
|
415 |
ELatin1LcOslash=0x00f8,
|
|
416 |
ELatin1UcOslash=0x00d8,
|
|
417 |
ELatin1LcThorn=0x00fe,
|
|
418 |
ELatin1LcSoftTh=0x00f0,
|
|
419 |
ELatin1LeftChevron=0x00ab,
|
|
420 |
ELatin1RightChevron=0x00bb,
|
|
421 |
ELatin1InvExclam=0x00a1,
|
|
422 |
ELatin1InvQuest=0x00bf,
|
|
423 |
ELatin1LcAo=0x00e5,
|
|
424 |
ELatin1Pound=0x00a3,
|
|
425 |
ELatin1LcAumlaut=0x00e4,
|
|
426 |
ELatin1LcEumlaut=0x00eb,
|
|
427 |
ELatin1LcIumlaut=0x00ef,
|
|
428 |
ELatin1LcOumlaut=0x00f6,
|
|
429 |
ELatin1LcUumlaut=0x00fc,
|
|
430 |
ELatin1LcYumlaut=0x00ff,
|
|
431 |
ELatin1SpaceUmlaut=0x00a8,
|
|
432 |
ELatin1LcAgrave=0x00e0,
|
|
433 |
ELatin1LcEgrave=0x00e8,
|
|
434 |
ELatin1LcIgrave=0x00ec,
|
|
435 |
ELatin1LcOgrave=0x00f2,
|
|
436 |
ELatin1LcUgrave=0x00f9,
|
|
437 |
ELatin1SpaceGrave=0x0060,
|
|
438 |
ELatin1LcAacute=0x00e1,
|
|
439 |
ELatin1LcEacute=0x00e9,
|
|
440 |
ELatin1LcIacute=0x00ed,
|
|
441 |
ELatin1LcOacute=0x00f3,
|
|
442 |
ELatin1LcUacute=0x00fa,
|
|
443 |
ELatin1LcYacute=0x00fd,
|
|
444 |
ELatin1LcSpaceAcute=0x00b4,
|
|
445 |
ELatin1LcAtilde=0x00e3,
|
|
446 |
ELatin1LcNtilde=0x00f1,
|
|
447 |
ELatin1LcOtilde=0x00f5,
|
|
448 |
ELatin1LcSpaceTilde=0x0098,
|
|
449 |
ELatin1LcAcirc=0x00e2,
|
|
450 |
ELatin1LcEcirc=0x00ea,
|
|
451 |
ELatin1LcIcirc=0x00ee,
|
|
452 |
ELatin1LcOcirc=0x00f4,
|
|
453 |
ELatin1LcUcirc=0x00fb,
|
|
454 |
ELatin1LcSpaceCirc=0x0088,
|
|
455 |
ELatin1UcEacute=0x00c9,
|
|
456 |
ELatin1Diaresis=0x00a8,
|
|
457 |
ELatin1MicroSign=0x00b5,
|
|
458 |
ELatin1UcAumlaut=0x00c4,
|
|
459 |
ELatin1UcOumlaut=0x00d6,
|
|
460 |
ELatin1UcUumlaut=0x00dc,
|
|
461 |
ELatin1SectionSign=0x00a7,
|
|
462 |
ELatin1MultiplicationSign=0x00d7,
|
|
463 |
ELatin1DivisionSign=0x00f7,
|
|
464 |
ELatin1DegreeSign=0x00b0,
|
|
465 |
ELatin1UcUgrave=0x00d9,
|
|
466 |
ELatin1MasculineOrdinalSign=0x00ba
|
|
467 |
};
|
|
468 |
//
|
|
469 |
#include <k32keys.inl>
|
|
470 |
//
|
|
471 |
#endif
|
|
472 |
|