Debian Codegraph @

src/LomiriGestures/ucswipearea_p.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2015 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17 #ifndef UCSWIPEAREA_P_H
18 #define UCSWIPEAREA_P_H
19
20 #include <QtCore/QLoggingCategory>
21 #include <QtQuick/QQuickItem>
22
23 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
24 #include <LomiriGestures-Qt6/lomirigesturesglobal.h>
25 #else
26 #include <LomiriGestures/lomirigesturesglobal.h>
27 #endif
28 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
29 #include <LomiriGestures-Qt6/private/pool_p.h>
30 #else
31 #include <LomiriGestures/private/pool_p.h>
32 #endif
33 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
34 #include <LomiriGestures-Qt6/private/timer_p.h>
35 #else
36 #include <LomiriGestures/private/timer_p.h>
37 #endif
38
39 UG_NAMESPACE_BEGIN
40
41 class TouchOwnershipEvent;
42 class UnownedTouchEvent;
43 class UCSwipeAreaPrivate;
44 class LOMIRIGESTURES_EXPORT UCSwipeArea : public QQuickItem
45 {
46 Q_OBJECT
47
48 Q_PROPERTY(Direction direction READ direction WRITE setDirection NOTIFY directionChanged)
49 Q_PROPERTY(qreal distance READ distance NOTIFY distanceChanged)
50 Q_PROPERTY(QPointF touchPosition READ touchPosition NOTIFY touchPositionChanged)
51 Q_PROPERTY(bool dragging READ dragging NOTIFY draggingChanged)
52 Q_PROPERTY(bool pressed READ pressed NOTIFY pressedChanged)
53 Q_PROPERTY(bool immediateRecognition
54 READ immediateRecognition
55 WRITE setImmediateRecognition
56 NOTIFY immediateRecognitionChanged)
57 Q_PROPERTY(bool grabGesture READ grabGesture WRITE setGrabGesture NOTIFY grabGestureChanged FINAL)
58
59 Q_ENUMS(Direction)
60 public:
61 enum Direction {
62 Rightwards,
63 Leftwards,
64 Downwards,
65 Upwards,
66 Horizontal,
67 Vertical
68 };
69
70 UCSwipeArea(QQuickItem *parent = 0);
71
72 Direction direction() const;
73 void setDirection(Direction);
74
75 qreal distance() const;
76
77 QPointF touchPosition() const;
78
79 bool dragging() const;
80
81 bool pressed() const;
82
83 bool immediateRecognition() const;
84 void setImmediateRecognition(bool enabled);
85
86 bool grabGesture() const;
87 void setGrabGesture(bool enabled);
88
89 Q_SIGNALS:
90 void directionChanged(Direction direction);
91 void draggingChanged(bool dragging);
92 void pressedChanged(bool pressed);
93 void distanceChanged(qreal distance);
94 void touchPositionChanged(const QPointF &position);
95 void immediateRecognitionChanged(bool immediateRecognition);
96 void grabGestureChanged(bool grabGesture);
97
98 protected:
99 bool event(QEvent *e) override;
100
101 void touchEvent(QTouchEvent *event) override;
102 void itemChange(ItemChange change, const ItemChangeData &value) override;
103
104 // functors
105 void giveUpIfDisabledOrInvisible();
106 void rejectGesture();
107
108 private:
109 Q_DECLARE_PRIVATE(UCSwipeArea)
110 };
111
112 UG_NAMESPACE_END
113
114 Q_DECLARE_LOGGING_CATEGORY(ucSwipeArea)
115 Q_DECLARE_LOGGING_CATEGORY(ucActiveTouchInfo)
116
117 #endif // UCSWIPEAREA_P_H