|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
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. |
|
8 * |
|
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 * |
|
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: |
|
19 * |
|
20 */ |
|
21 |
|
22 /* |
|
23 W A R N I N G |
|
24 ------------- |
|
25 THIS IS A TEMPORARY GESTURE CODE. WOULD BE REPLACED WHEN BROWSER HAS ITS OWN GESTURE FRAMEWORK |
|
26 */ |
|
27 |
|
28 #ifndef GestureRecognizer_h |
|
29 #define GestureRecognizer_h |
|
30 |
|
31 #include "GestureEvent.h" |
|
32 |
|
33 class QGraphicsSceneMouseEvent; |
|
34 |
|
35 namespace GVA { |
|
36 |
|
37 class GestureListener; |
|
38 class GestureRecognizerPrivate; |
|
39 |
|
40 class GestureRecognizer : public QObject { |
|
41 Q_OBJECT |
|
42 Q_PROPERTY(qreal dragInertia READ dragInertia WRITE setDragInertia) |
|
43 Q_PROPERTY(int directionErrorMargin READ directionErrorMargin WRITE setDirectionErrorMargin) |
|
44 Q_PROPERTY(qreal axisLockThreshold READ axisLockThreshold WRITE setAxisLockThreshold) |
|
45 Q_PROPERTY(qreal maximumVelocity READ maximumVelocity WRITE setMaximumVelocity) |
|
46 Q_PROPERTY(qreal minimumVelocity READ minimumVelocity WRITE setMinimumVelocity) |
|
47 Q_PROPERTY(qreal panningThreshold READ panningThreshold WRITE setPanningThreshold) |
|
48 Q_PROPERTY(qreal fastVelocityFactor READ fastVelocityFactor WRITE setFastVelocityFactor) |
|
49 Q_PROPERTY(qreal scrollsPerSecond READ scrollsPerSecond WRITE setScrollsPerSecond) |
|
50 |
|
51 public: |
|
52 GestureRecognizer(GestureListener*); |
|
53 ~GestureRecognizer(); |
|
54 |
|
55 bool mouseEventFilter(QGraphicsSceneMouseEvent *); |
|
56 |
|
57 qreal dragInertia() const; |
|
58 void setDragInertia(qreal inertia); |
|
59 |
|
60 int directionErrorMargin() const; |
|
61 void setDirectionErrorMargin(int errorMargin); |
|
62 |
|
63 qreal axisLockThreshold() const; |
|
64 void setAxisLockThreshold(qreal threshold); |
|
65 |
|
66 qreal maximumVelocity() const; |
|
67 void setMaximumVelocity(qreal v); |
|
68 |
|
69 qreal minimumVelocity() const; |
|
70 void setMinimumVelocity(qreal v); |
|
71 |
|
72 int panningThreshold() const; |
|
73 void setPanningThreshold(int threshold); |
|
74 |
|
75 qreal fastVelocityFactor() const; |
|
76 void setFastVelocityFactor(qreal f); |
|
77 |
|
78 int scrollsPerSecond() const; |
|
79 void setScrollsPerSecond(int sps); |
|
80 |
|
81 QScopedPointer<GestureRecognizerPrivate> d_ptr; |
|
82 |
|
83 private: |
|
84 Q_DECLARE_PRIVATE(GestureRecognizer) |
|
85 }; |
|
86 |
|
87 } //namespace GVA |
|
88 #endif //GestureRecognizer_h |