1 | // Copyright (C) 2016 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QFLICKGESTURE_P_H |
5 | #define QFLICKGESTURE_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists for the convenience |
12 | // of other Qt classes. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <QtWidgets/private/qtwidgetsglobal_p.h> |
19 | #include "qevent.h" |
20 | #include "qgesturerecognizer.h" |
21 | #include "private/qgesture_p.h" |
22 | #include "qscroller.h" |
23 | |
24 | #include <QtCore/qpointer.h> |
25 | #include "qscopedpointer.h" |
26 | |
27 | #ifndef QT_NO_GESTURES |
28 | |
29 | QT_BEGIN_NAMESPACE |
30 | |
31 | class QFlickGesturePrivate; |
32 | class QGraphicsItem; |
33 | |
34 | class Q_WIDGETS_EXPORT QFlickGesture : public QGesture |
35 | { |
36 | Q_OBJECT |
37 | Q_DECLARE_PRIVATE(QFlickGesture) |
38 | |
39 | public: |
40 | QFlickGesture(QObject *receiver, Qt::MouseButton button, QObject *parent = nullptr); |
41 | ~QFlickGesture(); |
42 | |
43 | friend class QFlickGestureRecognizer; |
44 | }; |
45 | |
46 | class QFlickGesturePrivate : public QGesturePrivate |
47 | { |
48 | Q_DECLARE_PUBLIC(QFlickGesture) |
49 | public: |
50 | QFlickGesturePrivate(); |
51 | |
52 | QPointer<QObject> receiver; |
53 | QScroller *receiverScroller; |
54 | Qt::MouseButton button; // NoButton == Touch |
55 | bool macIgnoreWheel; |
56 | }; |
57 | |
58 | class QFlickGestureRecognizer : public QGestureRecognizer |
59 | { |
60 | public: |
61 | QFlickGestureRecognizer(Qt::MouseButton button); |
62 | |
63 | QGesture *create(QObject *target) override; |
64 | QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) override; |
65 | void reset(QGesture *state) override; |
66 | |
67 | private: |
68 | Qt::MouseButton button; // NoButton == Touch |
69 | }; |
70 | |
71 | QT_END_NAMESPACE |
72 | |
73 | #endif // QT_NO_GESTURES |
74 | |
75 | #endif // QFLICKGESTURE_P_H |
76 |