windowing/windowserverplugins/keyeventrouting/src/keyrouterimpl.h
changeset 116 171fae344dd4
equal deleted inserted replaced
103:2717213c588a 116:171fae344dd4
       
     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 /** Key Capture Translation Table entry */
       
    28 struct TTranslationEntry
       
    29 	{
       
    30 	TUint	iRequestScanCode;
       
    31 	TUint	iCaptureScanCode;
       
    32 	TUint	iRequestKeyCode;
       
    33 	TUint	iCaptureKeyCode;
       
    34 	};
       
    35 
       
    36 /** Restricted Key Table entry */
       
    37 struct TRestrictedKeyEntry
       
    38 	{
       
    39 	TUint			iCode;
       
    40 	TKeyCaptureType	iType;
       
    41 	TInt			iAppUidValue;
       
    42 	};
       
    43 
       
    44 /** Application Priority Table entry */
       
    45 struct TAppPriorityEntry
       
    46 	{
       
    47 	TUint			iCode;
       
    48 	TKeyCaptureType	iType;
       
    49 	TInt			iAppUidValue;
       
    50 	TInt			iAppPriority;
       
    51 	};
       
    52 
       
    53 #ifdef KEYROUTER_TEST
       
    54 /** Blocked Key Table entry */
       
    55 struct TBlockedKeyEntry
       
    56 	{
       
    57 	TUint			iCode;
       
    58 	TKeyCaptureType	iType;
       
    59 	};
       
    60 #endif // KEYROUTER_TEST
       
    61 
       
    62 #define TABLE_SIZE(table) (sizeof(table) / sizeof((table)[0]))
       
    63 
       
    64 /**
       
    65 Key Event Router implementation class
       
    66 */
       
    67 NONSHARABLE_CLASS(CKeyEventRouterImpl) : public CKeyEventRouter
       
    68 	{
       
    69 public:
       
    70 	CKeyEventRouterImpl();
       
    71 	~CKeyEventRouterImpl();
       
    72 
       
    73 	// From CKeyEventRouter
       
    74 	void AddCaptureKeyL(const TKeyCaptureRequest& aRequest);
       
    75 	void UpdateCaptureKeyL(const TKeyCaptureRequest& aRequest);
       
    76 	void CancelCaptureKey(TKeyCaptureType aType, TAny* aHandle);
       
    77 	void RouteKey(const TKeyEventRouterInput& aInput,
       
    78 				  TKeyEventRouterOutput& aOutput);
       
    79 private:
       
    80 	void CheckCaptureKeyL(const TKeyCaptureRequest& aRequest);
       
    81 	void ProcessAppPriorities(TKeyCaptureRequest& aRequest);
       
    82 	void TranslateCaptureKey(TKeyCaptureType aType, TUint& aCode);
       
    83 	TBool IsRestrictedKey(const TKeyCaptureRequest& aRequest);
       
    84 #ifdef KEYROUTER_TEST
       
    85 	TBool IsKeyBlocked(TKeyCaptureType aType, TUint aCode);
       
    86 #endif
       
    87 
       
    88 private:
       
    89 	RArray<TKeyCaptureRequest>	iCaptureKeys;
       
    90 	};
       
    91 
       
    92 #endif // KEYROUTERIMPL_H