fep/aknfep/inc/AknFepKeyCatcher.h
changeset 36 a7632c26d895
parent 35 0f326f2e628e
child 42 b3eaa440ab06
equal deleted inserted replaced
35:0f326f2e628e 36:a7632c26d895
     1 /*
       
     2 * Copyright (c) 2002-2004 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:           
       
    15 *       Provides the CAknFepKeyCatcher definition.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 
       
    30 #ifndef __AKN_INPUT_FEP_KEYCATCHER_H__
       
    31 #define __AKN_INPUT_FEP_KEYCATCHER_H__
       
    32 
       
    33 #include <coecntrl.h>       //CCoeControl
       
    34 #include <coemain.h>
       
    35 #include "AknFepGlobalEnums.h"
       
    36 
       
    37 class CAknFepManager;
       
    38 
       
    39 /**
       
    40  * Interface class to allow ability to switch into a test mode, where a different
       
    41  * key catcher is used, i.e. to print values of keys received on the screen.
       
    42  */
       
    43 class CAknFepKeyCatcherInterface : public CCoeControl
       
    44     {
       
    45 public:
       
    46     virtual void SetState(const TAknFepManagerState aState) = 0;
       
    47     virtual ~CAknFepKeyCatcherInterface();
       
    48     virtual void HandleChangeInFocus();
       
    49     };
       
    50 
       
    51 /**
       
    52  * The Key Catcher sits sits on top of the control stack and does some basic, primary processing 
       
    53  * of all key presses. `
       
    54  */
       
    55 class CAknFepKeyCatcher : 
       
    56 
       
    57 #ifdef RD_SCALABLE_UI_V2
       
    58                           public MCoeMessageMonitorObserver, 
       
    59 #endif //RD_SCALABLE_UI_V2
       
    60                           public CAknFepKeyCatcherInterface
       
    61     {
       
    62 
       
    63 private:
       
    64     /** 
       
    65      * values for the flags required to maintain the internal
       
    66      * state of the Key Catcher during operation
       
    67      */
       
    68     enum
       
    69         {
       
    70         EFlagLongKeyPressHandled            =0x00000001,
       
    71         EFlagBlockAllLongKeyPressEvents     =0x00000002 
       
    72         };
       
    73 
       
    74 public:
       
    75     /**
       
    76      * First phase construction
       
    77      *
       
    78      * @param aFepMan the Fep Manager object which owns this key catcher object. 
       
    79      */
       
    80     static CAknFepKeyCatcher* NewL(CAknFepManager& aFepMan);
       
    81 
       
    82     /**
       
    83      * Destructor
       
    84      */
       
    85     virtual ~CAknFepKeyCatcher();
       
    86     
       
    87 
       
    88     /**
       
    89      * from CCoeControl  
       
    90      * Key Catcher. Ignores keys when Fep is in null mode (no editor focused)
       
    91      * and does first stage filtering
       
    92      */
       
    93     virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aEventCode);
       
    94 
       
    95     /**
       
    96      * interface for FepMan to set the Key Catcher's internal state object
       
    97      */
       
    98     virtual void SetState(const TAknFepManagerState aState);
       
    99 
       
   100 private:    
       
   101     /**
       
   102      * C++ Constructor
       
   103      */
       
   104     CAknFepKeyCatcher(CAknFepManager& aFepMan);
       
   105 
       
   106     /**
       
   107      * Second phase construction
       
   108      */
       
   109     void ConstructL();
       
   110 
       
   111     TKeyResponse HandleHashKeyJapaneseL(const TKeyEvent& aKeyEvent, TEventCode aEventCode);
       
   112     
       
   113     /**
       
   114      * from CCoeControl  
       
   115      * Handles a change to the control's resources.
       
   116      * @param aType A message UID value
       
   117      */
       
   118     void HandleResourceChange(TInt aType);
       
   119 #ifdef RD_SCALABLE_UI_V2
       
   120 	void MonitorWsMessage(const TWsEvent& aEvent);
       
   121 #endif
       
   122     inline void SetFlag(TInt aFlag);
       
   123     inline void ClearFlag(TInt aFlag);
       
   124     inline TBool IsFlagSet(TInt aFlag) const;
       
   125 	TBool IsNaviKey(TUint aCode);
       
   126 private:    
       
   127     // Data not owned
       
   128     CAknFepManager& iFepMan;
       
   129 
       
   130     TAknFepManagerState iKeyCatcherState;
       
   131     TUint iFlags;
       
   132     TKeyPressLength     iKeyPressLength;
       
   133     TInt iLongPressedScanCode;
       
   134     };
       
   135 
       
   136 /**
       
   137  *  Sets aFlag bitfield in iFlags
       
   138  */
       
   139 inline void CAknFepKeyCatcher::SetFlag(TInt aFlag)
       
   140     {
       
   141     iFlags|=aFlag;
       
   142     }
       
   143 
       
   144 /**
       
   145  * Clears aFlag bitfield in iFlags
       
   146  */
       
   147 inline void CAknFepKeyCatcher::ClearFlag(TInt aFlag)
       
   148     {
       
   149     iFlags&=~aFlag;
       
   150     }
       
   151 
       
   152 /**
       
   153  * Returns ETrue if the aFlag bitfield in iFlags is set, EFalse if it
       
   154  * is clear
       
   155  */
       
   156 inline TBool CAknFepKeyCatcher::IsFlagSet(TInt aFlag) const
       
   157     {
       
   158     return iFlags&aFlag;
       
   159     }
       
   160 
       
   161 #endif
       
   162 
       
   163 // End of file