kernel/eka/include/k32keys.h
changeset 247 d8d70de2bd36
parent 0 a41df078684a
child 257 3e88ff8f41d5
equal deleted inserted replaced
201:43365a9b78a3 247:d8d70de2bd36
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1997-2010 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 
    73 @publishedPartner
    79 @publishedPartner
    74 @released
    80 @released
    75 */
    81 */
    76 struct SScanCodeBlock
    82 struct SScanCodeBlock
    77 	{
    83 	{
    78 	TUint16 firstScanCode;
    84 	TUint16 firstScanCode;
    79 	TUint16 lastScanCode;
    85 	TUint16 lastScanCode;
    80 	};
    86 	};
    81 
    87 
    82 /**
    88 /**
       
    89 An array of SScanCodeBlock scancode ranges. This allows
       
    90 a discontiguous set of scancodes to be treated contiguously.
       
    91 
    83 @publishedPartner
    92 @publishedPartner
    84 @released
    93 @released
    85 */
    94 */
    86 struct SScanCodeBlockList
    95 struct SScanCodeBlockList
    87 	{
    96 	{
    88 	TUint numBlocks;
    97 	TUint numBlocks;
    89 	const SScanCodeBlock *pblocks;
    98 	const SScanCodeBlock *pblocks;
    90 	};
    99 	};
    91 
   100 
    92 /**
   101 /**
       
   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 
    93 @publishedPartner
   106 @publishedPartner
    94 @released
   107 @released
    95 */
   108 */
    96 struct SConvSubTable
   109 struct SConvSubTable
    97 	{
   110 	{
    98 	const TUint16 *pkeyCode;
   111 	const TUint16 *pkeyCode; //<! An array of target keycodes
    99 	SScanCodeBlockList scanCodes;
   112 	SScanCodeBlockList scanCodes;
   100 	};
   113 	};
   101 
   114 
   102 /**
   115 /**
       
   116 Associates a combination of modifier keys with the translation
       
   117 table to be used when the combination is active.
       
   118 
   103 @publishedPartner
   119 @publishedPartner
   104 @released
   120 @released
   105 */
   121 */
   106 struct SConvTableNode
   122 struct SConvTableNode
   107 	{
   123 	{
   108    TMaskedModifiers maskedModifiers;
   124 	TMaskedModifiers maskedModifiers;
   109 	TUint numSubTables;
   125 	TUint numSubTables;
   110 	const SConvSubTable * const *ppsubTables;
   126 	const SConvSubTable * const *ppsubTables;
   111 	};
   127 	};
   112 
   128 
   113 /**
   129 /**
       
   130 The top level collection of all different translation
       
   131 tables.
       
   132 
   114 @publishedPartner
   133 @publishedPartner
   115 @released
   134 @released
   116 */
   135 */
   117 struct SConvTable
   136 struct SConvTable
   118 	{
   137 	{
   129 	TUint numKeyCodes;
   148 	TUint numKeyCodes;
   130 	const TUint16 *pkeyCodes;
   149 	const TUint16 *pkeyCodes;
   131 	};
   150 	};
   132 
   151 
   133 /**
   152 /**
       
   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 
   134 @publishedPartner
   163 @publishedPartner
   135 @released
   164 @released
   136 */
   165 */
   137 struct SFunc
   166 struct SFunc
   138 	{
   167 	{
   140 	TUint8 func;
   169 	TUint8 func;
   141 	TUint8 filler;
   170 	TUint8 filler;
   142 	};
   171 	};
   143 
   172 
   144 /**
   173 /**
       
   174 Defines an action to perform and the next state transition
       
   175 when a given key press occurs.
       
   176 
   145 @publishedPartner
   177 @publishedPartner
   146 @released
   178 @released
   147 */
   179 */
   148 struct SFuncAndState
   180 struct SFuncAndState
   149 	{
   181 	{
   150 	TUint8 state;
   182 	TUint8 state; ///< The next TState to transition to
   151 	TUint8 func;
   183 	TUint8 func; ///< A TFuncGeneral action
   152 	TInt32 funcParam;
   184 	TInt32 funcParam; ///< Parameter for func (key to translate to for EPassSpecialKeyThru)
   153 	};
   185 	};
   154 
   186 
   155 /**
   187 /**
       
   188 Associates a SFuncAndState, which defines an action, with a
       
   189 key press and modifier combination to trigger it.
       
   190 
   156 @publishedPartner
   191 @publishedPartner
   157 @released
   192 @released
   158 */
   193 */
   159 struct SFuncTableEntry
   194 struct SFuncTableEntry
   160 	{
   195 	{
   161 	TMaskedModifiers maskedModifiers;
   196 	TMaskedModifiers maskedModifiers; ///< Required modifier combination
   162 	TKeyCodePattern keyCodePattern;
   197 	TKeyCodePattern keyCodePattern; ///< Required keypress
   163 	SFuncAndState funcAndNewState;
   198 	SFuncAndState funcAndNewState; ///< Action or translation
   164 	};
   199 	};
   165 
   200 
   166 /**
   201 /**
       
   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 
   167 @publishedPartner
   209 @publishedPartner
   168 @released
   210 @released
   169 */
   211 */
   170 struct SFuncTable
   212 struct SFuncTable
   171 	{
   213 	{
   172 	TUint numEntries;
   214 	TUint numEntries;
   173 	const SFuncTableEntry *pentries;
   215 	const SFuncTableEntry *pentries;
   174 	};
   216 	};
   175 
   217 
   176 /**
   218 /**
       
   219 Collection of all keyboard mode function tables
       
   220 
   177 @publishedPartner
   221 @publishedPartner
   178 @released
   222 @released
   179 */
   223 */
   180 struct SFuncTables
   224 struct SFuncTables
   181 	{
   225 	{
       
   226 	/**
       
   227 	This table is searched for a match if a match has not been
       
   228 	found in the current state's table
       
   229 	*/
   182 	SFuncTable defaultTable;
   230 	SFuncTable defaultTable;
       
   231 
       
   232 	/**
       
   233 	This table controls which keys change which modifiers;
       
   234 	the state field in this table is ignored
       
   235 	*/
   183 	SFuncTable modifierTable;
   236 	SFuncTable modifierTable;
       
   237 
       
   238 	/**
       
   239 	Number of entries in array pgenFuncTables.
       
   240 	This must in fact, always be equal to 13.
       
   241 	*/
   184 	TUint numGenFuncTables;
   242 	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 	*/
   185 	const SFuncTable *pgenFuncTables;
   253 	const SFuncTable *pgenFuncTables;
   186 	};
   254 	};
   187 
   255 
   188 /**
   256 /**
       
   257 Extends TChar with some extra utility functions
       
   258 
   189 @internalComponent
   259 @internalComponent
   190 @released
   260 @released
   191 */
   261 */
   192 class TCharExtended: public TChar
   262 class TCharExtended: public TChar
   193 	{
   263 	{
   200 	TInt DigitValue() const;
   270 	TInt DigitValue() const;
   201 	TBool MatchesPattern(const TKeyCodePattern &aKeyCodePattern, TRadix aRadix=EDecimal) const;
   271 	TBool MatchesPattern(const TKeyCodePattern &aKeyCodePattern, TRadix aRadix=EDecimal) const;
   202 	};
   272 	};
   203 
   273 
   204 /**
   274 /**
       
   275 Responsible for loading and performing lookups
       
   276 in a keyboard function table.
       
   277 
   205 @internalComponent
   278 @internalComponent
   206 @released
   279 @released
   207 */
   280 */
   208 class TFuncTable
   281 class TFuncTable
   209 	{
   282 	{
   228 	TUint16 keyCode;
   301 	TUint16 keyCode;
   229 	TUint16 filler;
   302 	TUint16 filler;
   230 	};
   303 	};
   231 
   304 
   232 /**
   305 /**
       
   306 Used by a keymap to state what method is used to
       
   307 enter multi digit control codes for special characters.
       
   308 
   233 @publishedPartner
   309 @publishedPartner
   234 @released
   310 @released
   235 */
   311 */
   236 enum TCtrlDigitsTermination
   312 enum TCtrlDigitsTermination
   237 	{
   313 	{
       
   314 	/**
       
   315 	Keyboard will stay in code entry mode for a set number
       
   316 	of key presses.
       
   317 	*/
   238 	ETerminationByCount,
   318 	ETerminationByCount,
       
   319 
       
   320 	/**
       
   321 	Keyboard will stay in code entry mode while Ctrl is held
       
   322 	down.
       
   323 	*/
   239 	ETerminationByCtrlUp
   324 	ETerminationByCtrlUp
   240 	};
   325 	};
   241 
   326 
   242 /**
   327 /**
       
   328 Responsible for loading and walking through a keymap conversion table.
       
   329 
   243 @internalComponent
   330 @internalComponent
   244 @released
   331 @released
   245 */
   332 */
   246 class TConvTable
   333 class TConvTable
   247 	{
   334 	{
   261 	TBool onKeypad(TUint aScanCode) const;
   348 	TBool onKeypad(TUint aScanCode) const;
   262 	TBool autorepeatable(TUint aKeyCode) const;
   349 	TBool autorepeatable(TUint aKeyCode) const;
   263 	};
   350 	};
   264 
   351 
   265 /**
   352 /**
       
   353 Responsible for aggregating a series of digits
       
   354 from separate keypresses into a single character.
       
   355 
   266 @internalComponent
   356 @internalComponent
   267 @released
   357 @released
   268 */
   358 */
   269 class TCtrlDigits
   359 class TCtrlDigits
   270 	{
   360 	{
   290 	TBool iErrorFlag;
   380 	TBool iErrorFlag;
   291 	TCtrlDigitsTermination iTermination;
   381 	TCtrlDigitsTermination iTermination;
   292 	};
   382 	};
   293 
   383 
   294 /**
   384 /**
       
   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 
   295 @internalComponent
   396 @internalComponent
   296 @released
   397 @released
   297 */
   398 */
   298 enum TState
   399 enum TState
   299 	{
   400 	{
   300 // values used as an index to a table
   401 	/**
       
   402 	Normal keyboard state, which defines keys
       
   403 	that transition	to the other states.
       
   404 	*/
   301 	EStateNormal						=0x0a,
   405 	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 	*/
   302 	EStateCtrlDigitsUntilCount			=0x0b,
   412 	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 	*/
   303 	EStateCtrlDigitsUntilCtrlUp			=0x0c,
   419 	EStateCtrlDigitsUntilCtrlUp			=0x0c,
       
   420 
   304 // values used as "rules" to be processed in a switch statement
   421 // values used as "rules" to be processed in a switch statement
   305 	EStateUnchanged						=0x40,
   422 	EStateUnchanged						=0x40,
   306 	EStateDerivedFromDigitEntered,
   423 	EStateDerivedFromDigitEntered,
   307 	EStateCtrlDigits
   424 	EStateCtrlDigits
   308 	};
   425 	};
   309 
   426 
   310 /**
   427 /**
       
   428 Defines an action to be performed for a keypress.
       
   429 @see SFuncAndState::func
       
   430 
   311 @internalComponent
   431 @internalComponent
   312 @released
   432 @released
   313 */
   433 */
   314 enum TFuncGeneral
   434 enum TFuncGeneral
   315 	{
   435 	{
   316 	EDoNothing							=0x00,
   436 	EDoNothing							=0x00,
   317 	EPassKeyThru,
   437 	EPassKeyThru, ///< Pass key through, unchanged
   318 	EPassSpecialKeyThru,
   438 	EPassSpecialKeyThru, ///< Translate to a new character
   319 	EPassCtrlDigitsThru,
   439 	EPassCtrlDigitsThru, ///< End accumulation of character digits
   320 	EAddOnCtrlDigit,
   440 	EAddOnCtrlDigit, ///< Allow another control digit to be entered
   321 	};
   441 	};
   322 
   442 
   323 /**
   443 /**
       
   444 Concrete implementation of a CKeyTranslator.
       
   445 
   324 @internalComponent
   446 @internalComponent
   325 @released
   447 @released
   326 */
   448 */
   327 NONSHARABLE_CLASS(CKeyTranslatorX) : public CKeyTranslator
   449 NONSHARABLE_CLASS(CKeyTranslatorX) : public CKeyTranslator
   328 	{
   450 	{