1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserverplugins/keyeventrouting/src/keyrouterimpl.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,92 @@
1.4 +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Reference implementation of Key Event Routing plug-in
1.18 +
1.19 +/**
1.20 +@file
1.21 +@internalTechnology
1.22 +@prototype
1.23 +*/
1.24 +
1.25 +#ifndef KEYROUTERIMPL_H
1.26 +#define KEYROUTERIMPL_H
1.27 +
1.28 +#include <graphics/wskeyrouter.h>
1.29 +
1.30 +/** Key Capture Translation Table entry */
1.31 +struct TTranslationEntry
1.32 + {
1.33 + TUint iRequestScanCode;
1.34 + TUint iCaptureScanCode;
1.35 + TUint iRequestKeyCode;
1.36 + TUint iCaptureKeyCode;
1.37 + };
1.38 +
1.39 +/** Restricted Key Table entry */
1.40 +struct TRestrictedKeyEntry
1.41 + {
1.42 + TUint iCode;
1.43 + TKeyCaptureType iType;
1.44 + TInt iAppUidValue;
1.45 + };
1.46 +
1.47 +/** Application Priority Table entry */
1.48 +struct TAppPriorityEntry
1.49 + {
1.50 + TUint iCode;
1.51 + TKeyCaptureType iType;
1.52 + TInt iAppUidValue;
1.53 + TInt iAppPriority;
1.54 + };
1.55 +
1.56 +#ifdef KEYROUTER_TEST
1.57 +/** Blocked Key Table entry */
1.58 +struct TBlockedKeyEntry
1.59 + {
1.60 + TUint iCode;
1.61 + TKeyCaptureType iType;
1.62 + };
1.63 +#endif // KEYROUTER_TEST
1.64 +
1.65 +#define TABLE_SIZE(table) (sizeof(table) / sizeof((table)[0]))
1.66 +
1.67 +/**
1.68 +Key Event Router implementation class
1.69 +*/
1.70 +NONSHARABLE_CLASS(CKeyEventRouterImpl) : public CKeyEventRouter
1.71 + {
1.72 +public:
1.73 + CKeyEventRouterImpl();
1.74 + ~CKeyEventRouterImpl();
1.75 +
1.76 + // From CKeyEventRouter
1.77 + void AddCaptureKeyL(const TKeyCaptureRequest& aRequest);
1.78 + void UpdateCaptureKeyL(const TKeyCaptureRequest& aRequest);
1.79 + void CancelCaptureKey(TKeyCaptureType aType, TAny* aHandle);
1.80 + void RouteKey(const TKeyEventRouterInput& aInput,
1.81 + TKeyEventRouterOutput& aOutput);
1.82 +private:
1.83 + void CheckCaptureKeyL(const TKeyCaptureRequest& aRequest);
1.84 + void ProcessAppPriorities(TKeyCaptureRequest& aRequest);
1.85 + void TranslateCaptureKey(TKeyCaptureType aType, TUint& aCode);
1.86 + TBool IsRestrictedKey(const TKeyCaptureRequest& aRequest);
1.87 +#ifdef KEYROUTER_TEST
1.88 + TBool IsKeyBlocked(TKeyCaptureType aType, TUint aCode);
1.89 +#endif
1.90 +
1.91 +private:
1.92 + RArray<TKeyCaptureRequest> iCaptureKeys;
1.93 + };
1.94 +
1.95 +#endif // KEYROUTERIMPL_H