fep/aknfep/inc/AknFepKeyCatcher.h
branchRCL_3
changeset 44 ecbabf52600f
equal deleted inserted replaced
43:ebd48d2de13c 44:ecbabf52600f
       
     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 						 public CAknFepKeyCatcherInterface
       
    57 #ifdef RD_SCALABLE_UI_V2
       
    58 						 ,public MCoeMessageMonitorObserver
       
    59 #endif //RD_SCALABLE_UI_V2
       
    60                           
       
    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     TKeyResponse CheckForSpecilacaseHandlingTosetKeyboardtype(const TKeyEvent& aKeyEvent, TEventCode aEventCode);
       
   126 	TBool IsNaviKey(TUint aCode);
       
   127 private:    
       
   128     // Data not owned
       
   129     CAknFepManager& iFepMan;
       
   130 
       
   131     TAknFepManagerState iKeyCatcherState;
       
   132     TUint iFlags;
       
   133     TKeyPressLength     iKeyPressLength;
       
   134     TInt iLongPressedScanCode;
       
   135     TBool iPreviousKeyeventNormal;
       
   136     TBool iPreviousKeyeventSpecial;
       
   137     TBool iRetainKeyBoardtypeFornextkeyevent;
       
   138     };
       
   139 
       
   140 /**
       
   141  *  Sets aFlag bitfield in iFlags
       
   142  */
       
   143 inline void CAknFepKeyCatcher::SetFlag(TInt aFlag)
       
   144     {
       
   145     iFlags|=aFlag;
       
   146     }
       
   147 
       
   148 /**
       
   149  * Clears aFlag bitfield in iFlags
       
   150  */
       
   151 inline void CAknFepKeyCatcher::ClearFlag(TInt aFlag)
       
   152     {
       
   153     iFlags&=~aFlag;
       
   154     }
       
   155 
       
   156 /**
       
   157  * Returns ETrue if the aFlag bitfield in iFlags is set, EFalse if it
       
   158  * is clear
       
   159  */
       
   160 inline TBool CAknFepKeyCatcher::IsFlagSet(TInt aFlag) const
       
   161     {
       
   162     return iFlags&aFlag;
       
   163     }
       
   164 
       
   165 #endif
       
   166 
       
   167 // End of file