webengine/osswebengine/webkit/s60/webview/WebPagePinchZoomHandler.h
changeset 65 5bfc169077b2
parent 42 d39add9822e2
child 66 cacf6ee57968
equal deleted inserted replaced
42:d39add9822e2 65:5bfc169077b2
     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:   Implements pinch functionality
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef WEBPAGEPINCHZOOMHANDLER_H
       
    21 #define WEBPAGEPINCHZOOMHANDLER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <coedef.h>
       
    26 #include <w32std.h>
       
    27 #include <stmgestureinterface.h>
       
    28 
       
    29 // MACROS
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class WebView;
       
    33 
       
    34 
       
    35 // CLASS DECLARATION
       
    36 class WebPagePinchZoomHandler: public CBase {
       
    37 public:  // Constructor and destructor
       
    38 
       
    39     /**
       
    40      * Two-phased constructor.
       
    41      **/
       
    42     static WebPagePinchZoomHandler* NewL(WebView* webView);
       
    43 
       
    44     /**
       
    45      * Destructor.
       
    46      **/
       
    47     virtual ~WebPagePinchZoomHandler();
       
    48 
       
    49 private:  // Constructors
       
    50 
       
    51     /**
       
    52      * C++ default constructor.
       
    53      **/
       
    54     WebPagePinchZoomHandler(WebView* webView);
       
    55 
       
    56     /**
       
    57      * By default Symbian 2nd phase constructor is private.
       
    58      **/
       
    59     void constructL();
       
    60   
       
    61 public: // New functions
       
    62     
       
    63     /**
       
    64      * Handler for Pinch event
       
    65      **/
       
    66     void handlePinchGestureEventL(const TStmGestureEvent& aGesture);
       
    67     
       
    68     /**
       
    69      * Handler for PinchEnter event
       
    70      **/
       
    71     void handlePinchGestureL(const TStmGestureEvent& aGesture);
       
    72     
       
    73     /**
       
    74      * Handler for PinchExit event
       
    75      **/
       
    76     void handlePinchGestureExitL(const TStmGestureEvent& aGesture);
       
    77 
       
    78     /**
       
    79      * to set the zoom level for bitmap zooming
       
    80      **/
       
    81     void setZoomLevel(TInt zoomLevel);
       
    82 
       
    83     /**
       
    84      * to update the bitmap
       
    85      **/
       
    86     void updateBitmap();
       
    87     
       
    88     /**
       
    89      * to get the pinch step size corresponding to a pinch gesture
       
    90      **/
       
    91     TInt getPinchZoomStepSize();
       
    92     
       
    93     /**
       
    94      * to query whether pinch is active: 
       
    95      * pinch is active once GestureEnter for pinch is received. And it is active until the pinch expiry timer gets expired 
       
    96      **/
       
    97     TBool isPinchActive();
       
    98     
       
    99     /**
       
   100      * handler for pinch exit timer expiry
       
   101      **/
       
   102     void handlepinchExitWaitTimer();
       
   103     
       
   104     /**
       
   105      * To get the pinch center
       
   106      **/
       
   107     TPoint pinchCenter() {return m_pinchCenter;};
       
   108 
       
   109 private:   
       
   110 
       
   111     WebView*         m_webView;            // <<not owned>>
       
   112     CPeriodic*       m_bitmapUpdateTimer;  // <<owned>> 
       
   113     CPeriodic*       m_pinchExitWaitTimer; // <<owned>> 
       
   114     TInt             m_pinchFactor;
       
   115     int              m_zoomOutBaseLevel;
       
   116     bool             m_pinchCenterSet;
       
   117     TInt             m_zoomStepSize;
       
   118     bool             m_pinchActive;
       
   119     TPoint           m_pinchCenter;
       
   120 
       
   121 };
       
   122 
       
   123 #endif      //WEBPAGEPINCHZOOMHANDLER_H
       
   124 
       
   125 // End of File