1 /* |
1 /* |
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
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 * |
4 * |
9 * Initial Contributors: |
5 * This program is free software: you can redistribute it and/or modify |
10 * Nokia Corporation - initial contribution. |
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, version 2.1 of the License. |
11 * |
8 * |
12 * Contributors: |
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU Lesser General Public License for more details. |
13 * |
13 * |
14 * Description: |
14 * You should have received a copy of the GNU Lesser General Public License |
|
15 * along with this program. If not, |
|
16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". |
|
17 * |
|
18 * Description: |
15 * |
19 * |
16 */ |
20 */ |
17 |
|
18 |
21 |
19 #ifndef __WEBTOUCHNAVIGATION_H__ |
22 #ifndef __WEBTOUCHNAVIGATION_H__ |
20 #define __WEBTOUCHNAVIGATION_H__ |
23 #define __WEBTOUCHNAVIGATION_H__ |
21 |
24 |
22 #include "qstmgestureevent.h" |
25 #include "qstmgestureevent.h" |
37 public: |
40 public: |
38 DecelEdit(WebTouchNavigation* nav); |
41 DecelEdit(WebTouchNavigation* nav); |
39 ~DecelEdit() {}; |
42 ~DecelEdit() {}; |
40 public slots: |
43 public slots: |
41 void setDecel(); |
44 void setDecel(); |
42 private: |
45 private: |
43 WebTouchNavigation* m_nav; |
46 WebTouchNavigation* m_nav; |
44 |
47 |
45 }; |
48 }; |
46 |
49 |
47 |
50 |
48 |
51 |
49 class WebTouchNavigation : public QObject, |
52 class WebTouchNavigation : public QObject, |
50 public KineticScrollable |
53 public KineticScrollable |
51 { |
54 { |
52 Q_OBJECT |
55 Q_OBJECT |
53 public: |
56 public: |
54 WebTouchNavigation(QGraphicsWebView* view); |
57 WebTouchNavigation(QGraphicsWebView* view); |
55 virtual ~WebTouchNavigation(); |
58 virtual ~WebTouchNavigation(); |
56 void handleQStmGesture(QStm_Gesture* gesture); |
59 void handleQStmGesture(QStm_Gesture* gesture); |
57 |
60 |
58 //from KineticScrollable |
61 //from KineticScrollable |
59 void scrollTo(QPoint& pos); |
62 void scrollTo(QPoint& pos); |
60 QPoint getScrollPosition(); |
63 QPoint getScrollPosition(); |
61 QPoint getInitialPosition(); |
64 QPoint getInitialPosition(); |
62 QPointF getInitialSpeed(); |
65 QPointF getInitialSpeed(); |
63 |
66 |
64 private: |
67 private: |
65 void doTap(QStm_Gesture* gesture); |
68 void doTap(QStm_Gesture* gesture); |
66 void doPan(QStm_Gesture* gesture); |
69 void doPan(QStm_Gesture* gesture); |
67 void doFlick(QStm_Gesture* gesture); |
70 void doFlick(QStm_Gesture* gesture); |
68 void doTouch(QStm_Gesture* gesture); |
71 void doTouch(QStm_Gesture* gesture); |
69 void stopScrolling(); |
72 void stopScrolling(); |
70 |
73 |
71 QPointF mapFromGlobal(const QPointF& gpos); |
74 QPointF mapFromGlobal(const QPointF& gpos); |
72 |
75 |
73 public slots: |
76 public slots: |
74 void pan(); |
77 void pan(); |
75 |
78 |
76 private: |
79 private: |
77 QTimer* m_scrollTimer; |
80 QTimer* m_scrollTimer; |
78 QPoint m_scrollDelta; |
81 QPoint m_scrollDelta; |
79 bool m_scrolling; |
82 bool m_scrolling; |
80 QPointF m_kineticSpeed; |
83 QPointF m_kineticSpeed; |
81 QGraphicsWebView* m_view; |
84 QGraphicsWebView* m_view; |
82 QWebPage* m_webPage; |
85 QWebPage* m_webPage; |
83 QWebFrame* m_frame; |
86 QWebFrame* m_frame; |
84 KineticHelper* m_kinetic; |
87 KineticHelper* m_kinetic; |
85 DecelEdit* m_decelEdit; |
88 DecelEdit* m_decelEdit; |
86 |
89 |
87 |
90 |
88 friend class DecelEdit; |
91 friend class DecelEdit; |
89 }; |
92 }; |
90 |
93 |
91 } |
94 } |
92 |
95 |