kernel/eka/include/e32ktran.h
author hgs
Mon, 12 Jul 2010 14:24:01 +0100
changeset 202 9aca3be14c27
parent 199 189ece41fa29
child 257 3e88ff8f41d5
permissions -rw-r--r--
201027_08
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
199
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
     1
// Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies).
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     2
// All rights reserved.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     3
// This component and the accompanying materials are made available
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     4
// under the terms of the License "Eclipse Public License v1.0"
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     5
// which accompanies this distribution, and is available
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     7
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     8
// Initial Contributors:
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    10
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    11
// Contributors:
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    12
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    13
// Description:
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    14
// e32\include\e32ktran.h
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    15
// 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    16
// WARNING: This file contains some APIs which are internal and are subject
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    17
//          to change without notice. Such APIs should therefore not be used
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    18
//          outside the Kernel and Hardware Services package.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    19
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    20
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    21
/**
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    22
 @file
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    23
 @internalTechnology
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    24
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    25
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    26
#ifndef __E32KTRAN_H__
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    27
#define __E32KTRAN_H__
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    28
#include <e32std.h>
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    29
#include <e32keys.h>
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    30
#include <e32base.h>
199
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    31
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    32
/**
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    33
Represents a specific combination of modifier
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    34
keys.
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    35
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    36
The definition will match a given a key combination
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    37
bitfield, if when anded with the mask iMask, it equals
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    38
iValue. Bitfields are made up of bits defined in TEventModifier.
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    39
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    40
eg. to match Ctrl and Shift and not Fn modifiers
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    41
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    42
iMask = EModifierShift | EModifierCtrl | EModifierFunc
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    43
iValue = EModifierShift | EModifierCtrl
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    44
*/
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    45
class TMaskedModifiers
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    46
	{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    47
public:
199
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    48
	TUint iMask; //!< Mask to be binary anded with some value
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    49
	TUint iValue; //!< Must match the masked bitfield
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    50
	};
199
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    51
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    52
/**
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    53
Defines different match types to be used
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    54
in TKeyCodePattern
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    55
*/
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    56
enum TPattern
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    57
	{
199
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    58
	EAnyKey=0x00, ///< match any key
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    59
	EAnyAlphaNumeric, ///< match any alpha or numeric key
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    60
	EAnyAlpha, ///< match any alpha key
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    61
	EAnyAlphaLowerCase, ///< match any lower-case key
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    62
	EAnyAlphaUpperCase, ///< match any upper-case key
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    63
	EAnyDecimalDigit, ///< match any decimal digit
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    64
	EAnyDigitGivenRadix,
199
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    65
	EAnyModifierKey, ///< match any modifier key (e.g. alt, fn, ctrl)
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    66
	EMatchKey=0x40, ///< match if equal to keycode value in first field
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    67
	EMatchKeyCaseInsens, ///< like EMatchKey but perform case-insensitive comparison
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    68
	EMatchLeftOrRight ///< match if equal to keycode value or (keycode value + 1)
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    69
	};
199
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    70
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    71
/**
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    72
Defines a keypress using one of the match types defined in TPattern
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    73
and possibly a reference scan code. It is possible to specify generic
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    74
or specific keypresses eg. any decimal digit, or a particular
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    75
key, matched case insensitively.
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    76
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    77
@see TPattern
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    78
*/
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    79
class TKeyCodePattern
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    80
	{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    81
public:
199
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    82
	TUint16 iKeyCode; ///< Reference scancode, used when iPattern is EMatchKey, EMatchKeyCaseInsens, or EMatchLeftOrRight
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    83
	TInt8   iPattern; ///< Comparison, of type TPattern
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    84
	TInt8   iFiller;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    85
	};
199
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    86
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    87
/**
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    88
A Capture Key is a special key or key combination which should be
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    89
sent to a specific window-group, instead of the currently
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    90
active window. For example a camera application might request that
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    91
camera button events always be sent to it.
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
    92
*/
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    93
class TCaptureKey
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    94
	{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    95
public:
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    96
	TMaskedModifiers iModifiers;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    97
	TKeyCodePattern  iKeyCodePattern;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    98
	TUint iApp;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    99
	TUint iHandle;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   100
	};
199
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
   101
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
   102
/**
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
   103
Used by CKeyTranslator to return translation results.
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
   104
*/
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   105
class TKeyData
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   106
	{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   107
public:
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   108
	TInt  iModifiers;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   109
	TInt  iApp;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   110
	TInt  iHandle;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   111
	TBool iIsCaptureKey;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   112
	TUint iKeyCode;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   113
	};
199
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
   114
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
   115
/**
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
   116
A set of TCaptureKey objects which is passed to a CKeyTranslator
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
   117
when translating key events. This is so it can indicate if a
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
   118
translated key event should be treated as a special Capture Key.
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
   119
*/
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   120
class CCaptureKeys: public CBase
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   121
	{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   122
public:
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   123
	IMPORT_C CCaptureKeys();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   124
	IMPORT_C ~CCaptureKeys();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   125
	IMPORT_C void Construct();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   126
	IMPORT_C void AddCaptureKeyL(const TCaptureKey &aCaptureKey);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   127
	IMPORT_C void AddCaptureKeyL(const TCaptureKey &aCaptureKey, TUint8 aPriority);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   128
	IMPORT_C void SetCaptureKey(TUint32 aHandle, const TCaptureKey &aCaptureKey);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   129
	IMPORT_C void SetCaptureKey(TUint32 aHandle, const TCaptureKey &aCaptureKey, TUint8 aPriority);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   130
	IMPORT_C void CancelCaptureKey(TUint32 aHandle);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   131
	IMPORT_C void CancelAllCaptureKeys(TUint32 aApp);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   132
	IMPORT_C void ProcessCaptureKeys(TKeyData &aKeyData) const;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   133
protected:
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   134
	void CheckCaptureKey(const TCaptureKey &aCaptureKey);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   135
protected:
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   136
	RArray<TCaptureKey> iCKarray;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   137
	};
199
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
   138
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
   139
/**
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
   140
A CKeyTranslator derived object will be created by the window server
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
   141
in order to translate key scancode data, contained in a TRawEvent, in to
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
   142
generic logical key press, as defined in TKeyCode. Essentially, these
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
   143
translations
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
   144
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
   145
The translator object will perform the actual lookups using data from
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
   146
a platform specific keymap DLL, conventionally named ekdata.dll.
189ece41fa29 201027_05
hgs
parents: 0
diff changeset
   147
*/
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   148
class CKeyTranslator: public CBase
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   149
	{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   150
public:
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   151
	IMPORT_C static CKeyTranslator *New();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   152
	virtual TInt GetModifierState()=0;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   153
	virtual void SetModifierState(TEventModifier aModifier,TModifierState aState)=0;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   154
	virtual TBool TranslateKey(TUint aScanCode,TBool aKeyUp,const CCaptureKeys &aCaptureKeys,TKeyData &aKeyData)=0;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   155
    virtual void UpdateModifiers(TInt aModifiers)=0;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   156
    virtual TInt ChangeKeyData(const TDesC& aLibraryName)=0;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   157
	};
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   158
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   159
#endif
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   160