kernel/eka/include/k32keys.h
branchRCL_3
changeset 257 3e88ff8f41d5
parent 256 c1f20ce4abcf
equal deleted inserted replaced
256:c1f20ce4abcf 257:3e88ff8f41d5
     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 	{
   148 	TUint numKeyCodes;
   129 	TUint numKeyCodes;
   149 	const TUint16 *pkeyCodes;
   130 	const TUint16 *pkeyCodes;
   150 	};
   131 	};
   151 
   132 
   152 /**
   133 /**
   153 Defines an action to perform when a given key press
       
   154 occurs.
       
   155 
       
   156 @note This struct should not be used in a keymap table.
       
   157 It is used within the key translator to represent an
       
   158 SFuncAndState for the modifier table (where the state
       
   159 member is not meaningful).
       
   160 
       
   161 @see SFuncAndState
       
   162 
       
   163 @publishedPartner
   134 @publishedPartner
   164 @released
   135 @released
   165 */
   136 */
   166 struct SFunc
   137 struct SFunc
   167 	{
   138 	{
   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 	{
   270 	TInt DigitValue() const;
   200 	TInt DigitValue() const;
   271 	TBool MatchesPattern(const TKeyCodePattern &aKeyCodePattern, TRadix aRadix=EDecimal) const;
   201 	TBool MatchesPattern(const TKeyCodePattern &aKeyCodePattern, TRadix aRadix=EDecimal) const;
   272 	};
   202 	};
   273 
   203 
   274 /**
   204 /**
   275 Responsible for loading and performing lookups
       
   276 in a keyboard function table.
       
   277 
       
   278 @internalComponent
   205 @internalComponent
   279 @released
   206 @released
   280 */
   207 */
   281 class TFuncTable
   208 class TFuncTable
   282 	{
   209 	{
   301 	TUint16 keyCode;
   228 	TUint16 keyCode;
   302 	TUint16 filler;
   229 	TUint16 filler;
   303 	};
   230 	};
   304 
   231 
   305 /**
   232 /**
   306 Used by a keymap to state what method is used to
       
   307 enter multi digit control codes for special characters.
       
   308 
       
   309 @publishedPartner
   233 @publishedPartner
   310 @released
   234 @released
   311 */
   235 */
   312 enum TCtrlDigitsTermination
   236 enum TCtrlDigitsTermination
   313 	{
   237 	{
   314 	/**
       
   315 	Keyboard will stay in code entry mode for a set number
       
   316 	of key presses.
       
   317 	*/
       
   318 	ETerminationByCount,
   238 	ETerminationByCount,
   319 
       
   320 	/**
       
   321 	Keyboard will stay in code entry mode while Ctrl is held
       
   322 	down.
       
   323 	*/
       
   324 	ETerminationByCtrlUp
   239 	ETerminationByCtrlUp
   325 	};
   240 	};
   326 
   241 
   327 /**
   242 /**
   328 Responsible for loading and walking through a keymap conversion table.
       
   329 
       
   330 @internalComponent
   243 @internalComponent
   331 @released
   244 @released
   332 */
   245 */
   333 class TConvTable
   246 class TConvTable
   334 	{
   247 	{
   348 	TBool onKeypad(TUint aScanCode) const;
   261 	TBool onKeypad(TUint aScanCode) const;
   349 	TBool autorepeatable(TUint aKeyCode) const;
   262 	TBool autorepeatable(TUint aKeyCode) const;
   350 	};
   263 	};
   351 
   264 
   352 /**
   265 /**
   353 Responsible for aggregating a series of digits
       
   354 from separate keypresses into a single character.
       
   355 
       
   356 @internalComponent
   266 @internalComponent
   357 @released
   267 @released
   358 */
   268 */
   359 class TCtrlDigits
   269 class TCtrlDigits
   360 	{
   270 	{
   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 	{