kernel/eka/include/e32ktran.h
branchRCL_3
changeset 257 3e88ff8f41d5
parent 256 c1f20ce4abcf
equal deleted inserted replaced
256:c1f20ce4abcf 257:3e88ff8f41d5
     1 // Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1995-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".
    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 */
       
    45 class TMaskedModifiers
    32 class TMaskedModifiers
    46 	{
    33 	{
    47 public:
    34 public:
    48 	TUint iMask; //!< Mask to be binary anded with some value
    35 	TUint iMask;
    49 	TUint iValue; //!< Must match the masked bitfield
    36 	TUint iValue;
    50 	};
    37 	};
    51 
    38 //
    52 /**
       
    53 Defines different match types to be used
       
    54 in TKeyCodePattern
       
    55 */
       
    56 enum TPattern
    39 enum TPattern
    57 	{
    40 	{
    58 	EAnyKey=0x00, ///< match any key
    41 	EAnyKey=0x00,
    59 	EAnyAlphaNumeric, ///< match any alpha or numeric key
    42 	EAnyAlphaNumeric,
    60 	EAnyAlpha, ///< match any alpha key
    43 	EAnyAlpha,
    61 	EAnyAlphaLowerCase, ///< match any lower-case key
    44 	EAnyAlphaLowerCase,
    62 	EAnyAlphaUpperCase, ///< match any upper-case key
    45 	EAnyAlphaUpperCase,
    63 	EAnyDecimalDigit, ///< match any decimal digit
    46 	EAnyDecimalDigit,
    64 	EAnyDigitGivenRadix,
    47 	EAnyDigitGivenRadix,
    65 	EAnyModifierKey, ///< match any modifier key (e.g. alt, fn, ctrl)
    48 	EAnyModifierKey,
    66 	EMatchKey=0x40, ///< match if equal to keycode value in first field
    49 	EMatchKey=0x40,
    67 	EMatchKeyCaseInsens, ///< like EMatchKey but perform case-insensitive comparison
    50 	EMatchKeyCaseInsens,
    68 	EMatchLeftOrRight ///< match if equal to keycode value or (keycode value + 1)
    51 	EMatchLeftOrRight
    69 	};
    52 	};
    70 
    53 //
    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 */
       
    79 class TKeyCodePattern
    54 class TKeyCodePattern
    80 	{
    55 	{
    81 public:
    56 public:
    82 	TUint16 iKeyCode; ///< Reference scancode, used when iPattern is EMatchKey, EMatchKeyCaseInsens, or EMatchLeftOrRight
    57 	TUint16 iKeyCode;
    83 	TInt8   iPattern; ///< Comparison, of type TPattern
    58 	TInt8   iPattern;
    84 	TInt8   iFiller;
    59 	TInt8   iFiller;
    85 	};
    60 	};
    86 
    61 //
    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 */
       
    93 class TCaptureKey
    62 class TCaptureKey
    94 	{
    63 	{
    95 public:
    64 public:
    96 	TMaskedModifiers iModifiers;
    65 	TMaskedModifiers iModifiers;
    97 	TKeyCodePattern  iKeyCodePattern;
    66 	TKeyCodePattern  iKeyCodePattern;
    98 	TUint iApp;
    67 	TUint iApp;
    99 	TUint iHandle;
    68 	TUint iHandle;
   100 	};
    69 	};
   101 
    70 //
   102 /**
       
   103 Used by CKeyTranslator to return translation results.
       
   104 */
       
   105 class TKeyData
    71 class TKeyData
   106 	{
    72 	{
   107 public:
    73 public:
   108 	TInt  iModifiers;
    74 	TInt  iModifiers;
   109 	TInt  iApp;
    75 	TInt  iApp;
   110 	TInt  iHandle;
    76 	TInt  iHandle;
   111 	TBool iIsCaptureKey;
    77 	TBool iIsCaptureKey;
   112 	TUint iKeyCode;
    78 	TUint iKeyCode;
   113 	};
    79 	};
   114 
    80 //
   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 */
       
   120 class CCaptureKeys: public CBase
    81 class CCaptureKeys: public CBase
   121 	{
    82 	{
   122 public:
    83 public:
   123 	IMPORT_C CCaptureKeys();
    84 	IMPORT_C CCaptureKeys();
   124 	IMPORT_C ~CCaptureKeys();
    85 	IMPORT_C ~CCaptureKeys();
   130 	IMPORT_C void CancelCaptureKey(TUint32 aHandle);
    91 	IMPORT_C void CancelCaptureKey(TUint32 aHandle);
   131 	IMPORT_C void CancelAllCaptureKeys(TUint32 aApp);
    92 	IMPORT_C void CancelAllCaptureKeys(TUint32 aApp);
   132 	IMPORT_C void ProcessCaptureKeys(TKeyData &aKeyData) const;
    93 	IMPORT_C void ProcessCaptureKeys(TKeyData &aKeyData) const;
   133 protected:
    94 protected:
   134 	void CheckCaptureKey(const TCaptureKey &aCaptureKey);
    95 	void CheckCaptureKey(const TCaptureKey &aCaptureKey);
       
    96 	void removeCaptureKey(TUint index);
   135 protected:
    97 protected:
   136 	RArray<TCaptureKey> iCKarray;
    98 	RArray<TCaptureKey> iCKarray;
   137 	};
    99 	};
   138 
   100 //
   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 */
       
   148 class CKeyTranslator: public CBase
   101 class CKeyTranslator: public CBase
   149 	{
   102 	{
   150 public:
   103 public:
   151 	IMPORT_C static CKeyTranslator *New();
   104 	IMPORT_C static CKeyTranslator *New();
   152 	virtual TInt GetModifierState()=0;
   105 	virtual TInt GetModifierState()=0;