1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** All rights reserved.
|
---|
5 | ** Contact: Nokia Corporation ([email protected])
|
---|
6 | **
|
---|
7 | ** This file is part of the QtGui module of the Qt Toolkit.
|
---|
8 | **
|
---|
9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
10 | ** Commercial Usage
|
---|
11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
14 | ** a written agreement between you and Nokia.
|
---|
15 | **
|
---|
16 | ** GNU Lesser General Public License Usage
|
---|
17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
18 | ** General Public License version 2.1 as published by the Free Software
|
---|
19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
20 | ** packaging of this file. Please review the following information to
|
---|
21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
23 | **
|
---|
24 | ** In addition, as a special exception, Nokia gives you certain additional
|
---|
25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
---|
26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
---|
27 | **
|
---|
28 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you have questions regarding the use of this file, please contact
|
---|
37 | ** Nokia at [email protected].
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | #ifndef QGESTURE_H
|
---|
43 | #define QGESTURE_H
|
---|
44 |
|
---|
45 | #include <QtCore/qobject.h>
|
---|
46 | #include <QtCore/qlist.h>
|
---|
47 | #include <QtCore/qdatetime.h>
|
---|
48 | #include <QtCore/qpoint.h>
|
---|
49 | #include <QtCore/qrect.h>
|
---|
50 | #include <QtCore/qmetatype.h>
|
---|
51 |
|
---|
52 | QT_BEGIN_HEADER
|
---|
53 |
|
---|
54 | Q_DECLARE_METATYPE(Qt::GestureState)
|
---|
55 |
|
---|
56 | QT_BEGIN_NAMESPACE
|
---|
57 |
|
---|
58 | QT_MODULE(Gui)
|
---|
59 |
|
---|
60 | class QGesturePrivate;
|
---|
61 | class Q_GUI_EXPORT QGesture : public QObject
|
---|
62 | {
|
---|
63 | Q_OBJECT
|
---|
64 | Q_DECLARE_PRIVATE(QGesture)
|
---|
65 |
|
---|
66 | Q_PROPERTY(Qt::GestureState state READ state)
|
---|
67 | Q_PROPERTY(Qt::GestureType gestureType READ gestureType)
|
---|
68 | Q_PROPERTY(QGesture::GestureCancelPolicy gestureCancelPolicy READ gestureCancelPolicy WRITE setGestureCancelPolicy)
|
---|
69 | Q_PROPERTY(QPointF hotSpot READ hotSpot WRITE setHotSpot RESET unsetHotSpot)
|
---|
70 | Q_PROPERTY(bool hasHotSpot READ hasHotSpot)
|
---|
71 |
|
---|
72 | public:
|
---|
73 | explicit QGesture(QObject *parent = 0);
|
---|
74 | ~QGesture();
|
---|
75 |
|
---|
76 | Qt::GestureType gestureType() const;
|
---|
77 |
|
---|
78 | Qt::GestureState state() const;
|
---|
79 |
|
---|
80 | QPointF hotSpot() const;
|
---|
81 | void setHotSpot(const QPointF &value);
|
---|
82 | bool hasHotSpot() const;
|
---|
83 | void unsetHotSpot();
|
---|
84 |
|
---|
85 | enum GestureCancelPolicy {
|
---|
86 | CancelNone = 0,
|
---|
87 | CancelAllInContext
|
---|
88 | };
|
---|
89 |
|
---|
90 | void setGestureCancelPolicy(GestureCancelPolicy policy);
|
---|
91 | GestureCancelPolicy gestureCancelPolicy() const;
|
---|
92 |
|
---|
93 | protected:
|
---|
94 | QGesture(QGesturePrivate &dd, QObject *parent);
|
---|
95 |
|
---|
96 | private:
|
---|
97 | friend class QGestureEvent;
|
---|
98 | friend class QGestureRecognizer;
|
---|
99 | friend class QGestureManager;
|
---|
100 | friend class QGraphicsScenePrivate;
|
---|
101 | };
|
---|
102 |
|
---|
103 | class QPanGesturePrivate;
|
---|
104 | class Q_GUI_EXPORT QPanGesture : public QGesture
|
---|
105 | {
|
---|
106 | Q_OBJECT
|
---|
107 | Q_DECLARE_PRIVATE(QPanGesture)
|
---|
108 |
|
---|
109 | Q_PROPERTY(QPointF lastOffset READ lastOffset WRITE setLastOffset)
|
---|
110 | Q_PROPERTY(QPointF offset READ offset WRITE setOffset)
|
---|
111 | Q_PROPERTY(QPointF delta READ delta STORED false)
|
---|
112 | Q_PROPERTY(qreal acceleration READ acceleration WRITE setAcceleration)
|
---|
113 |
|
---|
114 | public:
|
---|
115 | QPanGesture(QObject *parent = 0);
|
---|
116 |
|
---|
117 | QPointF lastOffset() const;
|
---|
118 | QPointF offset() const;
|
---|
119 | QPointF delta() const;
|
---|
120 | qreal acceleration() const;
|
---|
121 |
|
---|
122 | void setLastOffset(const QPointF &value);
|
---|
123 | void setOffset(const QPointF &value);
|
---|
124 | void setAcceleration(qreal value);
|
---|
125 |
|
---|
126 | friend class QPanGestureRecognizer;
|
---|
127 | friend class QWinNativePanGestureRecognizer;
|
---|
128 | };
|
---|
129 |
|
---|
130 | class QPinchGesturePrivate;
|
---|
131 | class Q_GUI_EXPORT QPinchGesture : public QGesture
|
---|
132 | {
|
---|
133 | Q_OBJECT
|
---|
134 | Q_DECLARE_PRIVATE(QPinchGesture)
|
---|
135 |
|
---|
136 | public:
|
---|
137 | enum ChangeFlag {
|
---|
138 | ScaleFactorChanged = 0x1,
|
---|
139 | RotationAngleChanged = 0x2,
|
---|
140 | CenterPointChanged = 0x4
|
---|
141 | };
|
---|
142 | Q_DECLARE_FLAGS(ChangeFlags, ChangeFlag)
|
---|
143 |
|
---|
144 | Q_PROPERTY(ChangeFlags totalChangeFlags READ totalChangeFlags WRITE setTotalChangeFlags)
|
---|
145 | Q_PROPERTY(ChangeFlags changeFlags READ changeFlags WRITE setChangeFlags)
|
---|
146 |
|
---|
147 | Q_PROPERTY(qreal totalScaleFactor READ totalScaleFactor WRITE setTotalScaleFactor)
|
---|
148 | Q_PROPERTY(qreal lastScaleFactor READ lastScaleFactor WRITE setLastScaleFactor)
|
---|
149 | Q_PROPERTY(qreal scaleFactor READ scaleFactor WRITE setScaleFactor)
|
---|
150 |
|
---|
151 | Q_PROPERTY(qreal totalRotationAngle READ totalRotationAngle WRITE setTotalRotationAngle)
|
---|
152 | Q_PROPERTY(qreal lastRotationAngle READ lastRotationAngle WRITE setLastRotationAngle)
|
---|
153 | Q_PROPERTY(qreal rotationAngle READ rotationAngle WRITE setRotationAngle)
|
---|
154 |
|
---|
155 | Q_PROPERTY(QPointF startCenterPoint READ startCenterPoint WRITE setStartCenterPoint)
|
---|
156 | Q_PROPERTY(QPointF lastCenterPoint READ lastCenterPoint WRITE setLastCenterPoint)
|
---|
157 | Q_PROPERTY(QPointF centerPoint READ centerPoint WRITE setCenterPoint)
|
---|
158 |
|
---|
159 | public:
|
---|
160 | QPinchGesture(QObject *parent = 0);
|
---|
161 |
|
---|
162 | ChangeFlags totalChangeFlags() const;
|
---|
163 | void setTotalChangeFlags(ChangeFlags value);
|
---|
164 |
|
---|
165 | ChangeFlags changeFlags() const;
|
---|
166 | void setChangeFlags(ChangeFlags value);
|
---|
167 |
|
---|
168 | QPointF startCenterPoint() const;
|
---|
169 | QPointF lastCenterPoint() const;
|
---|
170 | QPointF centerPoint() const;
|
---|
171 | void setStartCenterPoint(const QPointF &value);
|
---|
172 | void setLastCenterPoint(const QPointF &value);
|
---|
173 | void setCenterPoint(const QPointF &value);
|
---|
174 |
|
---|
175 | qreal totalScaleFactor() const;
|
---|
176 | qreal lastScaleFactor() const;
|
---|
177 | qreal scaleFactor() const;
|
---|
178 | void setTotalScaleFactor(qreal value);
|
---|
179 | void setLastScaleFactor(qreal value);
|
---|
180 | void setScaleFactor(qreal value);
|
---|
181 |
|
---|
182 | qreal totalRotationAngle() const;
|
---|
183 | qreal lastRotationAngle() const;
|
---|
184 | qreal rotationAngle() const;
|
---|
185 | void setTotalRotationAngle(qreal value);
|
---|
186 | void setLastRotationAngle(qreal value);
|
---|
187 | void setRotationAngle(qreal value);
|
---|
188 |
|
---|
189 | friend class QPinchGestureRecognizer;
|
---|
190 | };
|
---|
191 |
|
---|
192 | QT_END_NAMESPACE
|
---|
193 |
|
---|
194 | Q_DECLARE_METATYPE(QPinchGesture::ChangeFlags)
|
---|
195 |
|
---|
196 | QT_BEGIN_NAMESPACE
|
---|
197 |
|
---|
198 | class QSwipeGesturePrivate;
|
---|
199 | class Q_GUI_EXPORT QSwipeGesture : public QGesture
|
---|
200 | {
|
---|
201 | Q_OBJECT
|
---|
202 | Q_DECLARE_PRIVATE(QSwipeGesture)
|
---|
203 | Q_ENUMS(SwipeDirection)
|
---|
204 |
|
---|
205 | Q_PROPERTY(SwipeDirection horizontalDirection READ horizontalDirection STORED false)
|
---|
206 | Q_PROPERTY(SwipeDirection verticalDirection READ verticalDirection STORED false)
|
---|
207 | Q_PROPERTY(qreal swipeAngle READ swipeAngle WRITE setSwipeAngle)
|
---|
208 |
|
---|
209 | public:
|
---|
210 | enum SwipeDirection { NoDirection, Left, Right, Up, Down };
|
---|
211 | QSwipeGesture(QObject *parent = 0);
|
---|
212 |
|
---|
213 | SwipeDirection horizontalDirection() const;
|
---|
214 | SwipeDirection verticalDirection() const;
|
---|
215 |
|
---|
216 | qreal swipeAngle() const;
|
---|
217 | void setSwipeAngle(qreal value);
|
---|
218 |
|
---|
219 | friend class QSwipeGestureRecognizer;
|
---|
220 | };
|
---|
221 |
|
---|
222 | class QTapGesturePrivate;
|
---|
223 | class Q_GUI_EXPORT QTapGesture : public QGesture
|
---|
224 | {
|
---|
225 | Q_OBJECT
|
---|
226 | Q_DECLARE_PRIVATE(QTapGesture)
|
---|
227 |
|
---|
228 | Q_PROPERTY(QPointF position READ position WRITE setPosition)
|
---|
229 |
|
---|
230 | public:
|
---|
231 | QTapGesture(QObject *parent = 0);
|
---|
232 |
|
---|
233 | QPointF position() const;
|
---|
234 | void setPosition(const QPointF &pos);
|
---|
235 |
|
---|
236 | friend class QTapGestureRecognizer;
|
---|
237 | };
|
---|
238 |
|
---|
239 | class QTapAndHoldGesturePrivate;
|
---|
240 | class Q_GUI_EXPORT QTapAndHoldGesture : public QGesture
|
---|
241 | {
|
---|
242 | Q_OBJECT
|
---|
243 | Q_DECLARE_PRIVATE(QTapAndHoldGesture)
|
---|
244 |
|
---|
245 | Q_PROPERTY(QPointF position READ position WRITE setPosition)
|
---|
246 |
|
---|
247 | public:
|
---|
248 | QTapAndHoldGesture(QObject *parent = 0);
|
---|
249 |
|
---|
250 | QPointF position() const;
|
---|
251 | void setPosition(const QPointF &pos);
|
---|
252 |
|
---|
253 | friend class QTapAndHoldGestureRecognizer;
|
---|
254 | };
|
---|
255 |
|
---|
256 | QT_END_NAMESPACE
|
---|
257 |
|
---|
258 | Q_DECLARE_METATYPE(QGesture::GestureCancelPolicy)
|
---|
259 | QT_END_HEADER
|
---|
260 |
|
---|
261 | #endif // QGESTURE_H
|
---|