|
1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "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 // Reference implementation of Key Event Routing plug-in |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalTechnology |
|
19 @prototype |
|
20 */ |
|
21 |
|
22 #ifndef KEYROUTERIMPL_H |
|
23 #define KEYROUTERIMPL_H |
|
24 |
|
25 #include <graphics/wskeyrouter.h> |
|
26 |
|
27 #ifdef KEYROUTER_TEST |
|
28 /** Key Capture Translation Table entry */ |
|
29 struct TTranslationEntry |
|
30 { |
|
31 TUint iRequestScanCode; |
|
32 TUint iCaptureScanCode; |
|
33 TUint iRequestKeyCode; |
|
34 TUint iCaptureKeyCode; |
|
35 }; |
|
36 |
|
37 /** Entry for Restricted Key and Priority Application tables */ |
|
38 struct TAppKeyEntry |
|
39 { |
|
40 TUint iCode; |
|
41 TKeyCaptureType iType; |
|
42 TInt iAppUidValue; |
|
43 }; |
|
44 |
|
45 /** Blocked Key Table entry */ |
|
46 struct TBlockedKeyEntry |
|
47 { |
|
48 TUint iCode; |
|
49 TKeyCaptureType iType; |
|
50 }; |
|
51 |
|
52 #define TABLE_SIZE(table) (sizeof(table) / sizeof((table)[0])) |
|
53 |
|
54 #endif // KEYROUTER_TEST |
|
55 |
|
56 /** |
|
57 Key Event Router implementation class |
|
58 */ |
|
59 NONSHARABLE_CLASS(CKeyEventRouterImpl) : public CKeyEventRouter |
|
60 { |
|
61 public: |
|
62 CKeyEventRouterImpl(); |
|
63 ~CKeyEventRouterImpl(); |
|
64 |
|
65 // From CKeyEventRouter |
|
66 void AddCaptureKeyL(const TKeyCaptureRequest& aRequest); |
|
67 void UpdateCaptureKeyL(const TKeyCaptureRequest& aRequest); |
|
68 void CancelCaptureKey(TKeyCaptureType aType, TAny* aHandle); |
|
69 void RouteKey(const TKeyEventRouterInput& aInput, |
|
70 TKeyEventRouterOutput& aOutput); |
|
71 private: |
|
72 void CheckCaptureKeyL(const TKeyCaptureRequest& aRequest); |
|
73 #ifdef KEYROUTER_TEST |
|
74 TBool IsRestrictedKey(const TKeyCaptureRequest& aRequest); |
|
75 TBool IsKeyBlocked(TKeyCaptureType aType, TUint aCode); |
|
76 TInt PriorityAppUid(TKeyCaptureType aType, TUint aCode); |
|
77 void TranslateCaptureKey(TKeyCaptureType aType, TUint& aCode); |
|
78 #endif |
|
79 |
|
80 private: |
|
81 RArray<TKeyCaptureRequest> iCaptureKeys; |
|
82 }; |
|
83 |
|
84 #endif // KEYROUTERIMPL_H |