ginebra2/WebTouchNavigation.h
changeset 0 1450b09d0cfd
child 3 0954f5dd2cd0
equal deleted inserted replaced
-1:000000000000 0:1450b09d0cfd
       
     1 /*
       
     2 * Copyright (c) 2010 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 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __WEBTOUCHNAVIGATION_H__
       
    20 #define __WEBTOUCHNAVIGATION_H__
       
    21 
       
    22 #include "qstmgestureevent.h"
       
    23 #include "KineticHelper.h"
       
    24 #include <QLineEdit>
       
    25 
       
    26 class QGraphicsWebView;
       
    27 class QWebPage;
       
    28 class QWebFrame;
       
    29 
       
    30 namespace GVA {
       
    31 
       
    32 class WebTouchNavigation;
       
    33 
       
    34 class DecelEdit : public QLineEdit
       
    35 {
       
    36     Q_OBJECT
       
    37 public:
       
    38     DecelEdit(WebTouchNavigation* nav);
       
    39     ~DecelEdit() {};
       
    40 public slots:
       
    41     void setDecel();
       
    42 private:    
       
    43     WebTouchNavigation* m_nav;
       
    44     
       
    45 };
       
    46 
       
    47 
       
    48 
       
    49 class WebTouchNavigation : public QObject, 
       
    50                            public KineticScrollable
       
    51 {
       
    52     Q_OBJECT
       
    53 public:
       
    54     WebTouchNavigation(QGraphicsWebView* view);
       
    55     virtual ~WebTouchNavigation();
       
    56     void handleQStmGesture(QStm_Gesture* gesture);
       
    57     
       
    58     //from KineticScrollable
       
    59     void scrollTo(QPoint& pos);    
       
    60     QPoint getScrollPosition();
       
    61     QPoint getInitialPosition();
       
    62     QPointF getInitialSpeed();
       
    63     
       
    64 private:
       
    65     void doTap(QStm_Gesture* gesture);
       
    66     void doPan(QStm_Gesture* gesture);
       
    67     void doFlick(QStm_Gesture* gesture);
       
    68     void doTouch(QStm_Gesture* gesture);
       
    69     void stopScrolling();
       
    70     
       
    71     QPointF mapFromGlobal(const QPointF& gpos);
       
    72     
       
    73 public slots:
       
    74     void pan();    
       
    75 
       
    76 private:    
       
    77     QTimer* m_scrollTimer;
       
    78 	QPoint  m_scrollDelta;
       
    79 	bool    m_scrolling;
       
    80     QPointF m_kineticSpeed;
       
    81     QGraphicsWebView* m_view;
       
    82     QWebPage*         m_webPage;
       
    83     QWebFrame* m_frame;
       
    84     KineticHelper* m_kinetic;
       
    85     DecelEdit*   m_decelEdit;
       
    86     
       
    87     
       
    88     friend class DecelEdit;
       
    89 };
       
    90 
       
    91 }
       
    92 
       
    93 
       
    94 #endif //__WEBTOUCHNAVIGATION_H__
       
    95