webengine/webkitutils/stmgesturefw/inc/edgescrollgesturerecogniser.h
changeset 28 d39add9822e2
equal deleted inserted replaced
27:6297cdf66332 28:d39add9822e2
       
     1 /*
       
     2 * Copyright (c) 2008 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 the License "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:  Edge Scroll Recognizer
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef EDGESCROLLGESTURERECOGNISER_H_
       
    19 #define EDGESCROLLGESTURERECOGNISER_H_
       
    20 
       
    21 #include "rt_gestureengineif.h"
       
    22 #include <rt_gestureif.h>
       
    23 #include <rt_gesturelistener.h>
       
    24 
       
    25 class CCoeControl ;
       
    26 
       
    27 namespace stmGesture
       
    28 {
       
    29 
       
    30 /*!
       
    31  * CEdgeScrollGestureRecogniser handles edge scroll gesture: Hold event near the edges of the window
       
    32  *
       
    33  */
       
    34 NONSHARABLE_CLASS( CEdgeScrollGestureRecogniser ): public CPeriodic, 
       
    35                                                    public MGestureRecogniserIf
       
    36 {
       
    37 public:
       
    38     static const TGestureUid KUid = EGestureUidEdgeScroll;
       
    39 
       
    40     /** Two-phase constructor */
       
    41     static CEdgeScrollGestureRecogniser* NewL(MGestureListener* aListener);
       
    42     virtual ~CEdgeScrollGestureRecogniser();
       
    43 
       
    44     /*!
       
    45      * MGestureRecogniserIf methods
       
    46      */
       
    47     virtual TGestureRecognitionState recognise(int numOfActiveStreams, MGestureEngineIf* ge) ;
       
    48     virtual void release(MGestureEngineIf* ge) ;
       
    49     virtual void enable(bool enabled) ;
       
    50     virtual bool isEnabled() ;
       
    51     virtual void setOwner(CCoeControl* owner) ;
       
    52 
       
    53     virtual TGestureUid gestureUid() const
       
    54         {
       
    55         return KUid;
       
    56         }
       
    57 
       
    58     /*!
       
    59      * Additional methods to set up edge scroll gesture recogniser:
       
    60      * define the rectangle where the edges would be watched.
       
    61      * \param theArea
       
    62      */
       
    63     void setArea(const TRect& theArea)  ;
       
    64 
       
    65     /*!
       
    66      * Additional methods to set up edge scroll gesture recogniser:
       
    67      * Define how close to the border the Hold UI event must be
       
    68      * \param rangeInPixels
       
    69      */
       
    70     void setScrollRange(int rangeInPixels) ;
       
    71     /*!
       
    72      * for testing purposes we need to log the stuff somewhere...
       
    73      */
       
    74 public:
       
    75     virtual void enableLogging(bool loggingOn) ;
       
    76     /*!
       
    77      * The timer function to handle timeout for generating scroll events
       
    78      */
       
    79     virtual void RunL() ;
       
    80 
       
    81 
       
    82 private:
       
    83     CEdgeScrollGestureRecogniser(MGestureListener* aListener) ;
       
    84     bool m_loggingenabled ;
       
    85 private:
       
    86     CCoeControl* m_powner ; // The owning control for this gesture
       
    87     MGestureListener* m_listener ;
       
    88     bool m_waitingforsecondtap ;
       
    89     TRect m_area ;
       
    90     bool m_gestureEnabled ;
       
    91     int  m_rangesizeInPixels ;
       
    92 };
       
    93 
       
    94 } // namespace
       
    95 
       
    96 #endif /* EDGESCROLLGESTURERECOGNISER_H_ */