kernel/eka/include/e32ktran.h
changeset 199 189ece41fa29
parent 0 a41df078684a
child 257 3e88ff8f41d5
equal deleted inserted replaced
189:a5496987b1da 199:189ece41fa29
     1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1995-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".
    26 #ifndef __E32KTRAN_H__
    26 #ifndef __E32KTRAN_H__
    27 #define __E32KTRAN_H__
    27 #define __E32KTRAN_H__
    28 #include <e32std.h>
    28 #include <e32std.h>
    29 #include <e32keys.h>
    29 #include <e32keys.h>
    30 #include <e32base.h>
    30 #include <e32base.h>
    31 //
    31 
       
    32 /**
       
    33 Represents a specific combination of modifier
       
    34 keys.
       
    35 
       
    36 The definition will match a given a key combination
       
    37 bitfield, if when anded with the mask iMask, it equals
       
    38 iValue. Bitfields are made up of bits defined in TEventModifier.
       
    39 
       
    40 eg. to match Ctrl and Shift and not Fn modifiers
       
    41 
       
    42 iMask = EModifierShift | EModifierCtrl | EModifierFunc
       
    43 iValue = EModifierShift | EModifierCtrl
       
    44 */
    32 class TMaskedModifiers
    45 class TMaskedModifiers
    33 	{
    46 	{
    34 public:
    47 public:
    35 	TUint iMask;
    48 	TUint iMask; //!< Mask to be binary anded with some value
    36 	TUint iValue;
    49 	TUint iValue; //!< Must match the masked bitfield
    37 	};
    50 	};
    38 //
    51 
       
    52 /**
       
    53 Defines different match types to be used
       
    54 in TKeyCodePattern
       
    55 */
    39 enum TPattern
    56 enum TPattern
    40 	{
    57 	{
    41 	EAnyKey=0x00,
    58 	EAnyKey=0x00, ///< match any key
    42 	EAnyAlphaNumeric,
    59 	EAnyAlphaNumeric, ///< match any alpha or numeric key
    43 	EAnyAlpha,
    60 	EAnyAlpha, ///< match any alpha key
    44 	EAnyAlphaLowerCase,
    61 	EAnyAlphaLowerCase, ///< match any lower-case key
    45 	EAnyAlphaUpperCase,
    62 	EAnyAlphaUpperCase, ///< match any upper-case key
    46 	EAnyDecimalDigit,
    63 	EAnyDecimalDigit, ///< match any decimal digit
    47 	EAnyDigitGivenRadix,
    64 	EAnyDigitGivenRadix,
    48 	EAnyModifierKey,
    65 	EAnyModifierKey, ///< match any modifier key (e.g. alt, fn, ctrl)
    49 	EMatchKey=0x40,
    66 	EMatchKey=0x40, ///< match if equal to keycode value in first field
    50 	EMatchKeyCaseInsens,
    67 	EMatchKeyCaseInsens, ///< like EMatchKey but perform case-insensitive comparison
    51 	EMatchLeftOrRight
    68 	EMatchLeftOrRight ///< match if equal to keycode value or (keycode value + 1)
    52 	};
    69 	};
    53 //
    70 
       
    71 /**
       
    72 Defines a keypress using one of the match types defined in TPattern
       
    73 and possibly a reference scan code. It is possible to specify generic
       
    74 or specific keypresses eg. any decimal digit, or a particular
       
    75 key, matched case insensitively.
       
    76 
       
    77 @see TPattern
       
    78 */
    54 class TKeyCodePattern
    79 class TKeyCodePattern
    55 	{
    80 	{
    56 public:
    81 public:
    57 	TUint16 iKeyCode;
    82 	TUint16 iKeyCode; ///< Reference scancode, used when iPattern is EMatchKey, EMatchKeyCaseInsens, or EMatchLeftOrRight
    58 	TInt8   iPattern;
    83 	TInt8   iPattern; ///< Comparison, of type TPattern
    59 	TInt8   iFiller;
    84 	TInt8   iFiller;
    60 	};
    85 	};
    61 //
    86 
       
    87 /**
       
    88 A Capture Key is a special key or key combination which should be
       
    89 sent to a specific window-group, instead of the currently
       
    90 active window. For example a camera application might request that
       
    91 camera button events always be sent to it.
       
    92 */
    62 class TCaptureKey
    93 class TCaptureKey
    63 	{
    94 	{
    64 public:
    95 public:
    65 	TMaskedModifiers iModifiers;
    96 	TMaskedModifiers iModifiers;
    66 	TKeyCodePattern  iKeyCodePattern;
    97 	TKeyCodePattern  iKeyCodePattern;
    67 	TUint iApp;
    98 	TUint iApp;
    68 	TUint iHandle;
    99 	TUint iHandle;
    69 	};
   100 	};
    70 //
   101 
       
   102 /**
       
   103 Used by CKeyTranslator to return translation results.
       
   104 */
    71 class TKeyData
   105 class TKeyData
    72 	{
   106 	{
    73 public:
   107 public:
    74 	TInt  iModifiers;
   108 	TInt  iModifiers;
    75 	TInt  iApp;
   109 	TInt  iApp;
    76 	TInt  iHandle;
   110 	TInt  iHandle;
    77 	TBool iIsCaptureKey;
   111 	TBool iIsCaptureKey;
    78 	TUint iKeyCode;
   112 	TUint iKeyCode;
    79 	};
   113 	};
    80 //
   114 
       
   115 /**
       
   116 A set of TCaptureKey objects which is passed to a CKeyTranslator
       
   117 when translating key events. This is so it can indicate if a
       
   118 translated key event should be treated as a special Capture Key.
       
   119 */
    81 class CCaptureKeys: public CBase
   120 class CCaptureKeys: public CBase
    82 	{
   121 	{
    83 public:
   122 public:
    84 	IMPORT_C CCaptureKeys();
   123 	IMPORT_C CCaptureKeys();
    85 	IMPORT_C ~CCaptureKeys();
   124 	IMPORT_C ~CCaptureKeys();
    91 	IMPORT_C void CancelCaptureKey(TUint32 aHandle);
   130 	IMPORT_C void CancelCaptureKey(TUint32 aHandle);
    92 	IMPORT_C void CancelAllCaptureKeys(TUint32 aApp);
   131 	IMPORT_C void CancelAllCaptureKeys(TUint32 aApp);
    93 	IMPORT_C void ProcessCaptureKeys(TKeyData &aKeyData) const;
   132 	IMPORT_C void ProcessCaptureKeys(TKeyData &aKeyData) const;
    94 protected:
   133 protected:
    95 	void CheckCaptureKey(const TCaptureKey &aCaptureKey);
   134 	void CheckCaptureKey(const TCaptureKey &aCaptureKey);
    96 	void removeCaptureKey(TUint index);
       
    97 protected:
   135 protected:
    98 	RArray<TCaptureKey> iCKarray;
   136 	RArray<TCaptureKey> iCKarray;
    99 	};
   137 	};
   100 //
   138 
       
   139 /**
       
   140 A CKeyTranslator derived object will be created by the window server
       
   141 in order to translate key scancode data, contained in a TRawEvent, in to
       
   142 generic logical key press, as defined in TKeyCode. Essentially, these
       
   143 translations
       
   144 
       
   145 The translator object will perform the actual lookups using data from
       
   146 a platform specific keymap DLL, conventionally named ekdata.dll.
       
   147 */
   101 class CKeyTranslator: public CBase
   148 class CKeyTranslator: public CBase
   102 	{
   149 	{
   103 public:
   150 public:
   104 	IMPORT_C static CKeyTranslator *New();
   151 	IMPORT_C static CKeyTranslator *New();
   105 	virtual TInt GetModifierState()=0;
   152 	virtual TInt GetModifierState()=0;