aknlongtapdetector.h

Go to the documentation of this file.
00001 /*
00002 * ============================================================================
00003 *  Name        : aknlongtapdetector.h
00004 *  Part of     : UI Framework Core / Avkon
00005 *  Interface   : UI Framework APIs
00006 *  Description : Long Tap Detector with animation informing of long tap functionality
00007 *  Version     : %version: tr1s60#6 %
00008 *
00009 *  Copyright © 2005-2009 Nokia.  All rights reserved.
00010 *  This material, including documentation and any related computer
00011 *  programs, is protected by copyright controlled by Nokia.  All
00012 *  rights are reserved.  Copying, including reproducing, storing,
00013 *  adapting or translating, any or all of this material requires the
00014 *  prior written consent of Nokia.  This material also contains
00015 *  confidential information which may not be disclosed to others
00016 *  without the prior written consent of Nokia.
00017 * ============================================================================
00018 * Template version: 4.0
00019 */
00020 
00021 
00022 #ifndef CAKNLONGTAPDETECTORCONTROLLER_H
00023 #define CAKNLONGTAPDETECTORCONTROLLER_H
00024 
00025 #include <w32std.h>
00026 #include <e32base.h>
00027 #include <coemain.h>
00028 
00038 class MAknLongTapDetectorCallBack
00039     {
00040 public:
00046     virtual void HandleLongTapEventL( const TPoint& aPenEventLocation, 
00047                                       const TPoint& aPenEventScreenLocation ) = 0;
00048     };
00049 
00050 
00062 NONSHARABLE_CLASS( CAknLongTapDetector ) : public CTimer, MCoeMessageMonitorObserver
00063     {
00064 public: // Constructors and destructor  
00065 
00070     IMPORT_C static CAknLongTapDetector* NewL( MAknLongTapDetectorCallBack* aOwner );
00071 
00076     IMPORT_C static CAknLongTapDetector* NewLC( MAknLongTapDetectorCallBack* aOwner );
00077 
00081     virtual ~CAknLongTapDetector();
00082 
00083 public: // New functions
00084 
00090     IMPORT_C void PointerEventL( const TPointerEvent& aEvent );
00091 
00096     IMPORT_C void SetTimeDelayBeforeAnimation( const TInt aMicroSeconds );
00097 
00102     IMPORT_C void SetLongTapDelay( const TInt aMicroSeconds );
00103 
00108     IMPORT_C void EnableLongTapAnimation( const TBool aAnimation );
00109 
00114     IMPORT_C TBool IsAnimationRunning() const;
00115     
00119     IMPORT_C void CancelAnimationL();
00120 
00125     void MonitorWsMessage( const TWsEvent& aEvent );
00126                 
00127 private: // From CActive
00128 
00132     void RunL();
00133 
00134 private: // Constructors
00135 
00140     CAknLongTapDetector( MAknLongTapDetectorCallBack* aOwner );
00141 
00145     void ConstructL();
00146 
00147 private: // New functions
00148 
00149     void StartAnimationL();
00150     void StopAnimationL();      
00151 
00152 private: // Data
00153 
00154     enum TLongTapDetectorState
00155         {
00156         EWaiting,                               // normal state
00157         EWaitingForAnimation,   // Only "Pen down" event received, CTimer started
00158         EShowingAnimation               // Long tap animation started
00159         };
00160 
00164     TLongTapDetectorState iState;
00165     
00170     MAknLongTapDetectorCallBack* iOwner;
00171 
00175     TInt iTimeDelayBeforeAnimation;
00176 
00180     TInt iLongTapDelay; 
00181 
00185     TPointerEvent iPointerEvent;
00186 
00190     TBool iShowAnimation;
00191     
00192     };
00193 
00194 #endif // CAKNLONGTAPDETECTOR_H
00195 
00196 
00197 // End of File

Copyright © Nokia Corporation 2001-2007
Back to top