1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kernel/eka/include/k32keys.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,472 @@
1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// e32\include\k32keys.h
1.18 +//
1.19 +// WARNING: This file contains some APIs which are internal and are subject
1.20 +// to change without notice. Such APIs should therefore not be used
1.21 +// outside the Kernel and Hardware Services package.
1.22 +//
1.23 +
1.24 +#ifndef __KEYSTD_H__
1.25 +#define __KEYSTD_H__
1.26 +
1.27 +
1.28 +////////////////////////////////////////////////////////
1.29 +//
1.30 +// Bits required for keyboard translation software
1.31 +//
1.32 +////////////////////////////////////////////////////////
1.33 +
1.34 +#include <e32svr.h>
1.35 +
1.36 +/**
1.37 +@internalComponent
1.38 +@released
1.39 +*/
1.40 +const TUint KConvTableSettableModifiers=EModifierAutorepeatable|
1.41 + EModifierKeypad|
1.42 + EModifierPureKeycode;
1.43 +
1.44 +/**
1.45 +@internalComponent
1.46 +@released
1.47 +*/
1.48 +const TUint KPersistentModifiers=EModifierLeftAlt|
1.49 + EModifierRightAlt|
1.50 + EModifierAlt|
1.51 + EModifierLeftCtrl|
1.52 + EModifierRightCtrl|
1.53 + EModifierCtrl|
1.54 + EModifierLeftShift|
1.55 + EModifierRightShift|
1.56 + EModifierShift|
1.57 + EModifierLeftFunc|
1.58 + EModifierRightFunc|
1.59 + EModifierFunc|
1.60 + EModifierCapsLock|
1.61 + EModifierNumLock|
1.62 + EModifierScrollLock|
1.63 + EModifierKeyboardExtend;
1.64 +
1.65 +
1.66 +/**
1.67 +@internalComponent
1.68 +@released
1.69 +*/
1.70 +const TUint KRotationModifiers=EModifierRotateBy90|
1.71 + EModifierRotateBy180|
1.72 + EModifierRotateBy270;
1.73 +
1.74 +
1.75 +/**
1.76 +@publishedPartner
1.77 +@released
1.78 +*/
1.79 +struct SScanCodeBlock
1.80 + {
1.81 + TUint16 firstScanCode;
1.82 + TUint16 lastScanCode;
1.83 + };
1.84 +
1.85 +/**
1.86 +@publishedPartner
1.87 +@released
1.88 +*/
1.89 +struct SScanCodeBlockList
1.90 + {
1.91 + TUint numBlocks;
1.92 + const SScanCodeBlock *pblocks;
1.93 + };
1.94 +
1.95 +/**
1.96 +@publishedPartner
1.97 +@released
1.98 +*/
1.99 +struct SConvSubTable
1.100 + {
1.101 + const TUint16 *pkeyCode;
1.102 + SScanCodeBlockList scanCodes;
1.103 + };
1.104 +
1.105 +/**
1.106 +@publishedPartner
1.107 +@released
1.108 +*/
1.109 +struct SConvTableNode
1.110 + {
1.111 + TMaskedModifiers maskedModifiers;
1.112 + TUint numSubTables;
1.113 + const SConvSubTable * const *ppsubTables;
1.114 + };
1.115 +
1.116 +/**
1.117 +@publishedPartner
1.118 +@released
1.119 +*/
1.120 +struct SConvTable
1.121 + {
1.122 + TUint numNodes;
1.123 + const SConvTableNode *pnodes;
1.124 + };
1.125 +
1.126 +/**
1.127 +@publishedPartner
1.128 +@released
1.129 +*/
1.130 +struct SKeyCodeList
1.131 + {
1.132 + TUint numKeyCodes;
1.133 + const TUint16 *pkeyCodes;
1.134 + };
1.135 +
1.136 +/**
1.137 +@publishedPartner
1.138 +@released
1.139 +*/
1.140 +struct SFunc
1.141 + {
1.142 + TInt32 funcParam;
1.143 + TUint8 func;
1.144 + TUint8 filler;
1.145 + };
1.146 +
1.147 +/**
1.148 +@publishedPartner
1.149 +@released
1.150 +*/
1.151 +struct SFuncAndState
1.152 + {
1.153 + TUint8 state;
1.154 + TUint8 func;
1.155 + TInt32 funcParam;
1.156 + };
1.157 +
1.158 +/**
1.159 +@publishedPartner
1.160 +@released
1.161 +*/
1.162 +struct SFuncTableEntry
1.163 + {
1.164 + TMaskedModifiers maskedModifiers;
1.165 + TKeyCodePattern keyCodePattern;
1.166 + SFuncAndState funcAndNewState;
1.167 + };
1.168 +
1.169 +/**
1.170 +@publishedPartner
1.171 +@released
1.172 +*/
1.173 +struct SFuncTable
1.174 + {
1.175 + TUint numEntries;
1.176 + const SFuncTableEntry *pentries;
1.177 + };
1.178 +
1.179 +/**
1.180 +@publishedPartner
1.181 +@released
1.182 +*/
1.183 +struct SFuncTables
1.184 + {
1.185 + SFuncTable defaultTable;
1.186 + SFuncTable modifierTable;
1.187 + TUint numGenFuncTables;
1.188 + const SFuncTable *pgenFuncTables;
1.189 + };
1.190 +
1.191 +/**
1.192 +@internalComponent
1.193 +@released
1.194 +*/
1.195 +class TCharExtended: public TChar
1.196 + {
1.197 +public:
1.198 + inline TCharExtended();
1.199 + inline TCharExtended(TUint aChar);
1.200 + TCharExtended &operator=(TUint aChar);
1.201 + TBool IsDigitGivenRadix(TRadix aRadix) const;
1.202 + TBool IsModifier() const;
1.203 + TInt DigitValue() const;
1.204 + TBool MatchesPattern(const TKeyCodePattern &aKeyCodePattern, TRadix aRadix=EDecimal) const;
1.205 + };
1.206 +
1.207 +/**
1.208 +@internalComponent
1.209 +@released
1.210 +*/
1.211 +class TFuncTable
1.212 + {
1.213 +public:
1.214 + TFuncTable();
1.215 + void Update(RLibrary aLibrary);
1.216 + SFunc GetModifierFunc(const TCharExtended &aChar, const TInt &aModifiers) const;
1.217 + SFuncAndState GetGeneralFuncAndState(const TCharExtended &aChar, const TInt &aModifiers,
1.218 + TUint aCurState, TRadix aRadix) const;
1.219 +private:
1.220 + SFuncTables iFuncTables;
1.221 + SFuncTableEntry getDefault(const TCharExtended &aChar, const TInt &aModifiers) const;
1.222 + };
1.223 +
1.224 +/**
1.225 +@internalComponent
1.226 +@released
1.227 +*/
1.228 +struct SConvKeyData
1.229 + {
1.230 + TInt modifiers;
1.231 + TUint16 keyCode;
1.232 + TUint16 filler;
1.233 + };
1.234 +
1.235 +/**
1.236 +@publishedPartner
1.237 +@released
1.238 +*/
1.239 +enum TCtrlDigitsTermination
1.240 + {
1.241 + ETerminationByCount,
1.242 + ETerminationByCtrlUp
1.243 + };
1.244 +
1.245 +/**
1.246 +@internalComponent
1.247 +@released
1.248 +*/
1.249 +class TConvTable
1.250 + {
1.251 +public:
1.252 + TConvTable();
1.253 + void Update(RLibrary aLibrary);
1.254 + SConvKeyData Convert(TUint aScanCode, const TInt &aModifiers) const;
1.255 + SConvKeyData ConvertBaseCase(TUint aScanCode, const TInt &aModifiers) const;
1.256 + inline TUint FirstScanCode() const;
1.257 + inline TUint LastScanCode() const;
1.258 +private:
1.259 + SConvTable iConvTable;
1.260 + TUint iFirstScanCode;
1.261 + TUint iLastScanCode;
1.262 + SScanCodeBlockList iKeypadScanCodes;
1.263 + SKeyCodeList iNonAutorepKeyCodes;
1.264 + TBool onKeypad(TUint aScanCode) const;
1.265 + TBool autorepeatable(TUint aKeyCode) const;
1.266 + };
1.267 +
1.268 +/**
1.269 +@internalComponent
1.270 +@released
1.271 +*/
1.272 +class TCtrlDigits
1.273 + {
1.274 +public:
1.275 + TCtrlDigits();
1.276 + void Update(RLibrary aLibrary);
1.277 + void Reset();
1.278 + void AppendDigit(TUint aKeyCode, TUint aModifiers);
1.279 + inline void SetRadix(TRadix aRadix);
1.280 + inline void SetMaxCount(TInt aMaxCount);
1.281 + inline TRadix GetRadix() const;
1.282 + TBool Terminated(TInt aModifiers) const;
1.283 + TUint SetStateToCtrlDigits() const;
1.284 + inline TBool WithinLimits() const;
1.285 + inline TUint GetDigits() const;
1.286 + inline TBool Error() const;
1.287 +private:
1.288 + TInt iCount;
1.289 + TInt iMaxCount;
1.290 + TInt iMaximumCtrlDigitsMaxCount;
1.291 + TUint32 iDigits;
1.292 + TRadix iRadix;
1.293 + TBool iErrorFlag;
1.294 + TCtrlDigitsTermination iTermination;
1.295 + };
1.296 +
1.297 +/**
1.298 +@internalComponent
1.299 +@released
1.300 +*/
1.301 +enum TState
1.302 + {
1.303 +// values used as an index to a table
1.304 + EStateNormal =0x0a,
1.305 + EStateCtrlDigitsUntilCount =0x0b,
1.306 + EStateCtrlDigitsUntilCtrlUp =0x0c,
1.307 +// values used as "rules" to be processed in a switch statement
1.308 + EStateUnchanged =0x40,
1.309 + EStateDerivedFromDigitEntered,
1.310 + EStateCtrlDigits
1.311 + };
1.312 +
1.313 +/**
1.314 +@internalComponent
1.315 +@released
1.316 +*/
1.317 +enum TFuncGeneral
1.318 + {
1.319 + EDoNothing =0x00,
1.320 + EPassKeyThru,
1.321 + EPassSpecialKeyThru,
1.322 + EPassCtrlDigitsThru,
1.323 + EAddOnCtrlDigit,
1.324 + };
1.325 +
1.326 +/**
1.327 +@internalComponent
1.328 +@released
1.329 +*/
1.330 +NONSHARABLE_CLASS(CKeyTranslatorX) : public CKeyTranslator
1.331 + {
1.332 + friend class CKeyTranslator;
1.333 +public:
1.334 + CKeyTranslatorX();
1.335 + virtual TInt GetModifierState();
1.336 + virtual void SetModifierState(TEventModifier aModifier,TModifierState aState);
1.337 + virtual TBool TranslateKey(TUint aScanCode, TBool aKeyUp,
1.338 + const CCaptureKeys &aCaptureKeys, TKeyData &aKeyData);
1.339 + virtual void UpdateModifiers(TInt aModifiers);
1.340 + virtual TInt ChangeKeyData(const TDesC& aLibraryName);
1.341 + TBool currentlyUpperCase(void);
1.342 + TUint executeFunctionsAndSetState(TCharExtended aChar);
1.343 + TInt Initialise();
1.344 +private:
1.345 + TInt iCurModifiers;
1.346 + TMaskedModifiers iTogglingModifiers;
1.347 + TCtrlDigits iCurCtrlDigits;
1.348 + TConvTable iConvTable;
1.349 + TFuncTable iFuncTable;
1.350 + TUint iCurState;
1.351 + TBool iIsdefaultKeyData;
1.352 + RLibrary iKeyDataLib;
1.353 + RLibrary iDefaultKeyDataLib;
1.354 + };
1.355 +
1.356 +/**
1.357 +@internalComponent
1.358 +@released
1.359 +*/
1.360 +enum TCP850Char
1.361 + {
1.362 + ECP850LogicNot=0x00aa,
1.363 + ECP850LcAe=0x0091,
1.364 + ECP850LcCcedilla=0x0087,
1.365 + ECP850EsTset=0x00e1,
1.366 + ECP850LcOslash=0x009b,
1.367 + ECP850LcThorn=0x00d0,
1.368 + ECP850LcSoftTh=0x00e7,
1.369 + ECP850LeftChevron=0x00ae,
1.370 + ECP850RightChevron=0x00af,
1.371 + ECP850InvExclam=0x00ad,
1.372 + ECP850InvQuest=0x00a8,
1.373 + ECP850LcAo=0x0086,
1.374 + ECP850Pound=0x009c,
1.375 + ECP850LcAumlaut=0x0084,
1.376 + ECP850LcEumlaut=0x0089,
1.377 + ECP850LcIumlaut=0x008b,
1.378 + ECP850LcOumlaut=0x0094,
1.379 + ECP850LcUumlaut=0x009a,
1.380 + ECP850LcYumlaut=0x0098,
1.381 + ECP850SpaceUmlaut=0x00f9,
1.382 + ECP850LcAgrave=0x0085,
1.383 + ECP850LcEgrave=0x008a,
1.384 + ECP850LcIgrave=0x008d,
1.385 + ECP850LcOgrave=0x0095,
1.386 + ECP850LcUgrave=0x0097,
1.387 + ECP850SpaceGrave=0x0060,
1.388 + ECP850LcAacute=0x00a0,
1.389 + ECP850LcEacute=0x0082,
1.390 + ECP850LcIacute=0x00a1,
1.391 + ECP850LcOacute=0x00a2,
1.392 + ECP850LcUacute=0x00a3,
1.393 + ECP850LcYacute=0x00ec,
1.394 + ECP850LcSpaceAcute=0x0027,
1.395 + ECP850LcAtilde=0x00c6,
1.396 + ECP850LcNtilde=0x00a4,
1.397 + ECP850LcOtilde=0x00e4,
1.398 + ECP850LcSpaceTilde=0x007e,
1.399 + ECP850LcAcirc=0x0083,
1.400 + ECP850LcEcirc=0x0088,
1.401 + ECP850LcIcirc=0x008c,
1.402 + ECP850LcOcirc=0x0093,
1.403 + ECP850LcUcirc=0x0096,
1.404 + ECP850LcSpaceCirc=0x005e
1.405 + };
1.406 +
1.407 +/**
1.408 +@internalComponent
1.409 +@released
1.410 +*/
1.411 +enum TLatin1Char
1.412 + {
1.413 + ELatin1LogicNot=0x0090,
1.414 + ELatin1LcAe=0x00e6,
1.415 + ELatin1UcAe=0x00c6,
1.416 + ELatin1LcCcedilla=0x00e7,
1.417 + ELatin1EsTset=0x00df,
1.418 + ELatin1LcOslash=0x00f8,
1.419 + ELatin1UcOslash=0x00d8,
1.420 + ELatin1LcThorn=0x00fe,
1.421 + ELatin1LcSoftTh=0x00f0,
1.422 + ELatin1LeftChevron=0x00ab,
1.423 + ELatin1RightChevron=0x00bb,
1.424 + ELatin1InvExclam=0x00a1,
1.425 + ELatin1InvQuest=0x00bf,
1.426 + ELatin1LcAo=0x00e5,
1.427 + ELatin1Pound=0x00a3,
1.428 + ELatin1LcAumlaut=0x00e4,
1.429 + ELatin1LcEumlaut=0x00eb,
1.430 + ELatin1LcIumlaut=0x00ef,
1.431 + ELatin1LcOumlaut=0x00f6,
1.432 + ELatin1LcUumlaut=0x00fc,
1.433 + ELatin1LcYumlaut=0x00ff,
1.434 + ELatin1SpaceUmlaut=0x00a8,
1.435 + ELatin1LcAgrave=0x00e0,
1.436 + ELatin1LcEgrave=0x00e8,
1.437 + ELatin1LcIgrave=0x00ec,
1.438 + ELatin1LcOgrave=0x00f2,
1.439 + ELatin1LcUgrave=0x00f9,
1.440 + ELatin1SpaceGrave=0x0060,
1.441 + ELatin1LcAacute=0x00e1,
1.442 + ELatin1LcEacute=0x00e9,
1.443 + ELatin1LcIacute=0x00ed,
1.444 + ELatin1LcOacute=0x00f3,
1.445 + ELatin1LcUacute=0x00fa,
1.446 + ELatin1LcYacute=0x00fd,
1.447 + ELatin1LcSpaceAcute=0x00b4,
1.448 + ELatin1LcAtilde=0x00e3,
1.449 + ELatin1LcNtilde=0x00f1,
1.450 + ELatin1LcOtilde=0x00f5,
1.451 + ELatin1LcSpaceTilde=0x0098,
1.452 + ELatin1LcAcirc=0x00e2,
1.453 + ELatin1LcEcirc=0x00ea,
1.454 + ELatin1LcIcirc=0x00ee,
1.455 + ELatin1LcOcirc=0x00f4,
1.456 + ELatin1LcUcirc=0x00fb,
1.457 + ELatin1LcSpaceCirc=0x0088,
1.458 + ELatin1UcEacute=0x00c9,
1.459 + ELatin1Diaresis=0x00a8,
1.460 + ELatin1MicroSign=0x00b5,
1.461 + ELatin1UcAumlaut=0x00c4,
1.462 + ELatin1UcOumlaut=0x00d6,
1.463 + ELatin1UcUumlaut=0x00dc,
1.464 + ELatin1SectionSign=0x00a7,
1.465 + ELatin1MultiplicationSign=0x00d7,
1.466 + ELatin1DivisionSign=0x00f7,
1.467 + ELatin1DegreeSign=0x00b0,
1.468 + ELatin1UcUgrave=0x00d9,
1.469 + ELatin1MasculineOrdinalSign=0x00ba
1.470 + };
1.471 +//
1.472 +#include <k32keys.inl>
1.473 +//
1.474 +#endif
1.475 +