199
|
1 |
// Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies).
|
0
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// e32\include\e32ktran.h
|
|
15 |
//
|
|
16 |
// WARNING: This file contains some APIs which are internal and are subject
|
|
17 |
// to change without notice. Such APIs should therefore not be used
|
|
18 |
// outside the Kernel and Hardware Services package.
|
|
19 |
//
|
|
20 |
|
|
21 |
/**
|
|
22 |
@file
|
|
23 |
@internalTechnology
|
|
24 |
*/
|
|
25 |
|
|
26 |
#ifndef __E32KTRAN_H__
|
|
27 |
#define __E32KTRAN_H__
|
|
28 |
#include <e32std.h>
|
|
29 |
#include <e32keys.h>
|
|
30 |
#include <e32base.h>
|
199
|
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 |
*/
|
0
|
45 |
class TMaskedModifiers
|
|
46 |
{
|
|
47 |
public:
|
199
|
48 |
TUint iMask; //!< Mask to be binary anded with some value
|
|
49 |
TUint iValue; //!< Must match the masked bitfield
|
0
|
50 |
};
|
199
|
51 |
|
|
52 |
/**
|
|
53 |
Defines different match types to be used
|
|
54 |
in TKeyCodePattern
|
|
55 |
*/
|
0
|
56 |
enum TPattern
|
|
57 |
{
|
199
|
58 |
EAnyKey=0x00, ///< match any key
|
|
59 |
EAnyAlphaNumeric, ///< match any alpha or numeric key
|
|
60 |
EAnyAlpha, ///< match any alpha key
|
|
61 |
EAnyAlphaLowerCase, ///< match any lower-case key
|
|
62 |
EAnyAlphaUpperCase, ///< match any upper-case key
|
|
63 |
EAnyDecimalDigit, ///< match any decimal digit
|
0
|
64 |
EAnyDigitGivenRadix,
|
199
|
65 |
EAnyModifierKey, ///< match any modifier key (e.g. alt, fn, ctrl)
|
|
66 |
EMatchKey=0x40, ///< match if equal to keycode value in first field
|
|
67 |
EMatchKeyCaseInsens, ///< like EMatchKey but perform case-insensitive comparison
|
|
68 |
EMatchLeftOrRight ///< match if equal to keycode value or (keycode value + 1)
|
0
|
69 |
};
|
199
|
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 |
*/
|
0
|
79 |
class TKeyCodePattern
|
|
80 |
{
|
|
81 |
public:
|
199
|
82 |
TUint16 iKeyCode; ///< Reference scancode, used when iPattern is EMatchKey, EMatchKeyCaseInsens, or EMatchLeftOrRight
|
|
83 |
TInt8 iPattern; ///< Comparison, of type TPattern
|
0
|
84 |
TInt8 iFiller;
|
|
85 |
};
|
199
|
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 |
*/
|
0
|
93 |
class TCaptureKey
|
|
94 |
{
|
|
95 |
public:
|
|
96 |
TMaskedModifiers iModifiers;
|
|
97 |
TKeyCodePattern iKeyCodePattern;
|
|
98 |
TUint iApp;
|
|
99 |
TUint iHandle;
|
|
100 |
};
|
199
|
101 |
|
|
102 |
/**
|
|
103 |
Used by CKeyTranslator to return translation results.
|
|
104 |
*/
|
0
|
105 |
class TKeyData
|
|
106 |
{
|
|
107 |
public:
|
|
108 |
TInt iModifiers;
|
|
109 |
TInt iApp;
|
|
110 |
TInt iHandle;
|
|
111 |
TBool iIsCaptureKey;
|
|
112 |
TUint iKeyCode;
|
|
113 |
};
|
199
|
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 |
*/
|
0
|
120 |
class CCaptureKeys: public CBase
|
|
121 |
{
|
|
122 |
public:
|
|
123 |
IMPORT_C CCaptureKeys();
|
|
124 |
IMPORT_C ~CCaptureKeys();
|
|
125 |
IMPORT_C void Construct();
|
|
126 |
IMPORT_C void AddCaptureKeyL(const TCaptureKey &aCaptureKey);
|
|
127 |
IMPORT_C void AddCaptureKeyL(const TCaptureKey &aCaptureKey, TUint8 aPriority);
|
|
128 |
IMPORT_C void SetCaptureKey(TUint32 aHandle, const TCaptureKey &aCaptureKey);
|
|
129 |
IMPORT_C void SetCaptureKey(TUint32 aHandle, const TCaptureKey &aCaptureKey, TUint8 aPriority);
|
|
130 |
IMPORT_C void CancelCaptureKey(TUint32 aHandle);
|
|
131 |
IMPORT_C void CancelAllCaptureKeys(TUint32 aApp);
|
|
132 |
IMPORT_C void ProcessCaptureKeys(TKeyData &aKeyData) const;
|
|
133 |
protected:
|
|
134 |
void CheckCaptureKey(const TCaptureKey &aCaptureKey);
|
|
135 |
protected:
|
|
136 |
RArray<TCaptureKey> iCKarray;
|
|
137 |
};
|
199
|
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 |
*/
|
0
|
148 |
class CKeyTranslator: public CBase
|
|
149 |
{
|
|
150 |
public:
|
|
151 |
IMPORT_C static CKeyTranslator *New();
|
|
152 |
virtual TInt GetModifierState()=0;
|
|
153 |
virtual void SetModifierState(TEventModifier aModifier,TModifierState aState)=0;
|
|
154 |
virtual TBool TranslateKey(TUint aScanCode,TBool aKeyUp,const CCaptureKeys &aCaptureKeys,TKeyData &aKeyData)=0;
|
|
155 |
virtual void UpdateModifiers(TInt aModifiers)=0;
|
|
156 |
virtual TInt ChangeKeyData(const TDesC& aLibraryName)=0;
|
|
157 |
};
|
|
158 |
|
|
159 |
#endif
|
|
160 |
|