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 | #include "qscopedpointer.h" |
24 | |
25 | #ifndef QT_NO_GESTURES |
26 | |
27 | QT_BEGIN_NAMESPACE |
28 | |
29 | class QFlickGesturePrivate; |
30 | class QGraphicsItem; |
31 | |
32 | class Q_WIDGETS_EXPORT QFlickGesture : public QGesture |
33 | { |
34 | Q_OBJECT |
35 | Q_DECLARE_PRIVATE(QFlickGesture) |
36 | |
37 | public: |
38 | QFlickGesture(QObject *receiver, Qt::MouseButton button, QObject *parent = nullptr); |
39 | ~QFlickGesture(); |
40 | |
41 | friend class QFlickGestureRecognizer; |
42 | }; |
43 | |
44 | class QFlickGesturePrivate : public QGesturePrivate |
45 | { |
46 | Q_DECLARE_PUBLIC(QFlickGesture) |
47 | public: |
48 | QFlickGesturePrivate(); |
49 | |
50 | QPointer<QObject> receiver; |
51 | QScroller *receiverScroller; |
52 | Qt::MouseButton button; // NoButton == Touch |
53 | bool macIgnoreWheel; |
54 | }; |
55 | |
56 | class QFlickGestureRecognizer : public QGestureRecognizer |
57 | { |
58 | public: |
59 | QFlickGestureRecognizer(Qt::MouseButton button); |
60 | |
61 | QGesture *create(QObject *target) override; |
62 | QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) override; |
63 | void reset(QGesture *state) override; |
64 | |
65 | private: |
66 | Qt::MouseButton button; // NoButton == Touch |
67 | }; |
68 | |
69 | QT_END_NAMESPACE |
70 | |
71 | #endif // QT_NO_GESTURES |
72 | |
73 | #endif // QFLICKGESTURE_P_H |
74 |