phoneapp/phoneuiview/inc/cphonekeycapturecontroller.h
changeset 0 5f000ab63145
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  PhoneUI Key Capture Controller
       
    15 *
       
    16 */
       
    17 
       
    18 /*
       
    19 */
       
    20 
       
    21 #ifndef __CPHONEKEYCAPTURECONTROLLER_H
       
    22 #define __CPHONEKEYCAPTURECONTROLLER_H
       
    23 
       
    24 
       
    25 //  INCLUDES
       
    26 #include <e32base.h>
       
    27 #include <e32keys.h>
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class TPhoneCommandParam;
       
    31 
       
    32 class CPhoneKeyCaptureController : public CBase
       
    33     {
       
    34     public:  // Constructors and destructor
       
    35 
       
    36         /**
       
    37         * Two-phased constructor.
       
    38         */
       
    39         static CPhoneKeyCaptureController* NewL( CEikonEnv& aEikEnv );
       
    40 
       
    41         /**
       
    42         * Destructor.
       
    43         */
       
    44         virtual ~CPhoneKeyCaptureController();   
       
    45 
       
    46     public: 
       
    47 
       
    48         /**
       
    49         * Set key to be captured 
       
    50         * @param aCommandParam a command param
       
    51         */
       
    52         void StartCapturingKey( TPhoneCommandParam* aCommandParam );
       
    53 
       
    54         /**
       
    55         * Set key not to be captured 
       
    56         * @param aCommandParam a command param
       
    57         */
       
    58         void StopCapturingKey( TPhoneCommandParam* aCommandParam );
       
    59 
       
    60     private:  // Constructors
       
    61         
       
    62         /**
       
    63         * C++ default constructor.
       
    64         */
       
    65         CPhoneKeyCaptureController( CEikonEnv& aEikEnv );
       
    66 
       
    67     private:    // Data types
       
    68 
       
    69         // enumerated type for captured key events
       
    70         enum TPhoneKeyCaptureType
       
    71             {
       
    72             EPhoneKeyCaptureEvent,
       
    73             EPhoneKeyCaptureUpAndDownEvents,
       
    74             EPhoneKeyCaptureAllEvents
       
    75             };
       
    76 
       
    77         // key capture data structure
       
    78         class TPhoneKeyCapture
       
    79             {
       
    80             public:
       
    81                 TStdScanCode            iKey;
       
    82                 TKeyCode                iKeyCode;
       
    83                 TPhoneKeyCaptureType    iType;
       
    84                 TInt32                  iHandle;
       
    85                 TInt32                  iHandleForUpAndDown;
       
    86             };
       
    87 
       
    88     private:  // New functions
       
    89 
       
    90         /**
       
    91         * May be used to ask whether a key has been set to be captured
       
    92         * using StartCapturingKey()
       
    93         * @param aKey is the iScanCode of the key
       
    94         * @return ETrue if the key is currently captured via this mechanism
       
    95         */
       
    96         TBool IsKeyCaptured( TStdScanCode aKey ) const;
       
    97 
       
    98         /**
       
    99         * Set key not to be captured 
       
   100         * @param aKeyCapture is the key not to be captured
       
   101         */
       
   102         void StopKeyCapture( TPhoneKeyCapture aKeyCapture );
       
   103 
       
   104     private:  // Data
       
   105 
       
   106         /**
       
   107         * Array of keycodes currently captured which includes the window
       
   108         * server handles for the captured keys.
       
   109         */
       
   110         RArray<TPhoneKeyCapture> iCapturedKeys;
       
   111         
       
   112         CEikonEnv& iEikEnv;
       
   113 
       
   114     };
       
   115 
       
   116 #endif      // __CPHONEKEYCAPTURECONTROLLER_H   
       
   117             
       
   118 // End of File