0
|
1 |
/****************************************************************************
|
|
2 |
**
|
|
3 |
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
4 |
** All rights reserved.
|
|
5 |
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
6 |
**
|
|
7 |
** This file is part of the QtGui module of the Qt Toolkit.
|
|
8 |
**
|
|
9 |
** $QT_BEGIN_LICENSE:LGPL$
|
|
10 |
** No Commercial Usage
|
|
11 |
** This file contains pre-release code and may not be distributed.
|
|
12 |
** You may use this file in accordance with the terms and conditions
|
|
13 |
** contained in the Technology Preview License Agreement accompanying
|
|
14 |
** this package.
|
|
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 |
** If you have questions regarding the use of this file, please contact
|
|
29 |
** Nokia at qt-info@nokia.com.
|
|
30 |
**
|
|
31 |
**
|
|
32 |
**
|
|
33 |
**
|
|
34 |
**
|
|
35 |
**
|
|
36 |
**
|
|
37 |
**
|
|
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(QPointF hotSpot READ hotSpot WRITE setHotSpot RESET unsetHotSpot)
|
|
69 |
Q_PROPERTY(bool hasHotSpot READ hasHotSpot)
|
|
70 |
|
|
71 |
public:
|
|
72 |
explicit QGesture(QObject *parent = 0);
|
|
73 |
~QGesture();
|
|
74 |
|
|
75 |
Qt::GestureType gestureType() const;
|
|
76 |
|
|
77 |
Qt::GestureState state() const;
|
|
78 |
|
|
79 |
QPointF hotSpot() const;
|
|
80 |
void setHotSpot(const QPointF &value);
|
|
81 |
bool hasHotSpot() const;
|
|
82 |
void unsetHotSpot();
|
|
83 |
|
|
84 |
protected:
|
|
85 |
QGesture(QGesturePrivate &dd, QObject *parent);
|
|
86 |
|
|
87 |
private:
|
|
88 |
friend class QGestureEvent;
|
|
89 |
friend class QGestureRecognizer;
|
|
90 |
friend class QGestureManager;
|
|
91 |
};
|
|
92 |
|
|
93 |
class QPanGesturePrivate;
|
|
94 |
class Q_GUI_EXPORT QPanGesture : public QGesture
|
|
95 |
{
|
|
96 |
Q_OBJECT
|
|
97 |
Q_DECLARE_PRIVATE(QPanGesture)
|
|
98 |
|
|
99 |
Q_PROPERTY(QPointF totalOffset READ totalOffset WRITE setTotalOffset)
|
|
100 |
Q_PROPERTY(QPointF lastOffset READ lastOffset WRITE setLastOffset)
|
|
101 |
Q_PROPERTY(QPointF offset READ offset WRITE setOffset)
|
|
102 |
Q_PROPERTY(qreal acceleration READ acceleration WRITE setAcceleration)
|
|
103 |
|
|
104 |
public:
|
|
105 |
QPanGesture(QObject *parent = 0);
|
|
106 |
|
|
107 |
QPointF totalOffset() const;
|
|
108 |
QPointF lastOffset() const;
|
|
109 |
QPointF offset() const;
|
|
110 |
qreal acceleration() const;
|
|
111 |
|
|
112 |
void setTotalOffset(const QPointF &value);
|
|
113 |
void setLastOffset(const QPointF &value);
|
|
114 |
void setOffset(const QPointF &value);
|
|
115 |
void setAcceleration(qreal value);
|
|
116 |
|
|
117 |
friend class QPanGestureRecognizer;
|
|
118 |
friend class QWinNativePanGestureRecognizer;
|
|
119 |
};
|
|
120 |
|
|
121 |
class QPinchGesturePrivate;
|
|
122 |
class Q_GUI_EXPORT QPinchGesture : public QGesture
|
|
123 |
{
|
|
124 |
Q_OBJECT
|
|
125 |
Q_DECLARE_PRIVATE(QPinchGesture)
|
|
126 |
|
|
127 |
public:
|
|
128 |
enum WhatChange {
|
|
129 |
ScaleFactorChanged = 0x1,
|
|
130 |
RotationAngleChanged = 0x2,
|
|
131 |
CenterPointChanged = 0x4
|
|
132 |
};
|
|
133 |
Q_DECLARE_FLAGS(WhatChanged, WhatChange)
|
|
134 |
|
|
135 |
Q_PROPERTY(WhatChanged whatChanged READ whatChanged WRITE setWhatChanged)
|
|
136 |
|
|
137 |
Q_PROPERTY(qreal totalScaleFactor READ totalScaleFactor WRITE setTotalScaleFactor)
|
|
138 |
Q_PROPERTY(qreal lastScaleFactor READ lastScaleFactor WRITE setLastScaleFactor)
|
|
139 |
Q_PROPERTY(qreal scaleFactor READ scaleFactor WRITE setScaleFactor)
|
|
140 |
|
|
141 |
Q_PROPERTY(qreal totalRotationAngle READ totalRotationAngle WRITE setTotalRotationAngle)
|
|
142 |
Q_PROPERTY(qreal lastRotationAngle READ lastRotationAngle WRITE setLastRotationAngle)
|
|
143 |
Q_PROPERTY(qreal rotationAngle READ rotationAngle WRITE setRotationAngle)
|
|
144 |
|
|
145 |
Q_PROPERTY(QPointF startCenterPoint READ startCenterPoint WRITE setStartCenterPoint)
|
|
146 |
Q_PROPERTY(QPointF lastCenterPoint READ lastCenterPoint WRITE setLastCenterPoint)
|
|
147 |
Q_PROPERTY(QPointF centerPoint READ centerPoint WRITE setCenterPoint)
|
|
148 |
|
|
149 |
public:
|
|
150 |
QPinchGesture(QObject *parent = 0);
|
|
151 |
|
|
152 |
WhatChanged whatChanged() const;
|
|
153 |
void setWhatChanged(WhatChanged value);
|
|
154 |
|
|
155 |
QPointF startCenterPoint() const;
|
|
156 |
QPointF lastCenterPoint() const;
|
|
157 |
QPointF centerPoint() const;
|
|
158 |
void setStartCenterPoint(const QPointF &value);
|
|
159 |
void setLastCenterPoint(const QPointF &value);
|
|
160 |
void setCenterPoint(const QPointF &value);
|
|
161 |
|
|
162 |
qreal totalScaleFactor() const;
|
|
163 |
qreal lastScaleFactor() const;
|
|
164 |
qreal scaleFactor() const;
|
|
165 |
void setTotalScaleFactor(qreal value);
|
|
166 |
void setLastScaleFactor(qreal value);
|
|
167 |
void setScaleFactor(qreal value);
|
|
168 |
|
|
169 |
qreal totalRotationAngle() const;
|
|
170 |
qreal lastRotationAngle() const;
|
|
171 |
qreal rotationAngle() const;
|
|
172 |
void setTotalRotationAngle(qreal value);
|
|
173 |
void setLastRotationAngle(qreal value);
|
|
174 |
void setRotationAngle(qreal value);
|
|
175 |
|
|
176 |
friend class QPinchGestureRecognizer;
|
|
177 |
};
|
|
178 |
|
|
179 |
QT_END_NAMESPACE
|
|
180 |
|
|
181 |
Q_DECLARE_METATYPE(QPinchGesture::WhatChanged)
|
|
182 |
|
|
183 |
QT_BEGIN_NAMESPACE
|
|
184 |
|
|
185 |
class QSwipeGesturePrivate;
|
|
186 |
class Q_GUI_EXPORT QSwipeGesture : public QGesture
|
|
187 |
{
|
|
188 |
Q_OBJECT
|
|
189 |
Q_DECLARE_PRIVATE(QSwipeGesture)
|
|
190 |
Q_ENUMS(SwipeDirection)
|
|
191 |
|
|
192 |
Q_PROPERTY(SwipeDirection horizontalDirection READ horizontalDirection STORED false)
|
|
193 |
Q_PROPERTY(SwipeDirection verticalDirection READ verticalDirection STORED false)
|
|
194 |
Q_PROPERTY(qreal swipeAngle READ swipeAngle WRITE setSwipeAngle)
|
|
195 |
|
|
196 |
public:
|
|
197 |
enum SwipeDirection { NoDirection, Left, Right, Up, Down };
|
|
198 |
QSwipeGesture(QObject *parent = 0);
|
|
199 |
|
|
200 |
SwipeDirection horizontalDirection() const;
|
|
201 |
SwipeDirection verticalDirection() const;
|
|
202 |
|
|
203 |
qreal swipeAngle() const;
|
|
204 |
void setSwipeAngle(qreal value);
|
|
205 |
|
|
206 |
friend class QSwipeGestureRecognizer;
|
|
207 |
};
|
|
208 |
|
|
209 |
QT_END_NAMESPACE
|
|
210 |
|
|
211 |
QT_END_HEADER
|
|
212 |
|
|
213 |
#endif // QGESTURE_H
|