2
* Copyright (C) 2015 Canonical, Ltd.
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.
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.
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/>.
21
#include <QtQuick/QQuickItem>
22
#include "ubuntugesturesqmlglobal.h"
26
#include <UbuntuGestures/Pool>
27
#include <UbuntuGestures/Timer>
30
#include <QtCore/QLoggingCategory>
32
class TouchOwnershipEvent;
33
class UnownedTouchEvent;
34
class UCSwipeAreaPrivate;
36
class UBUNTUGESTURESQML_EXPORT UCSwipeArea : public QQuickItem
40
Q_PROPERTY(Direction direction READ direction WRITE setDirection NOTIFY directionChanged)
41
Q_PROPERTY(qreal distance READ distance NOTIFY distanceChanged)
42
Q_PROPERTY(QPointF touchPosition READ touchPosition NOTIFY touchPositionChanged)
43
Q_PROPERTY(bool dragging READ dragging NOTIFY draggingChanged)
44
Q_PROPERTY(bool pressed READ pressed NOTIFY pressedChanged)
45
Q_PROPERTY(bool immediateRecognition
46
READ immediateRecognition
47
WRITE setImmediateRecognition
48
NOTIFY immediateRecognitionChanged)
61
UCSwipeArea(QQuickItem *parent = 0);
63
Direction direction() const;
64
void setDirection(Direction);
66
qreal distance() const;
68
QPointF touchPosition() const;
70
bool dragging() const;
74
bool immediateRecognition() const;
75
void setImmediateRecognition(bool enabled);
78
void directionChanged(Direction direction);
79
void draggingChanged(bool dragging);
80
void pressedChanged(bool pressed);
81
void distanceChanged(qreal distance);
82
void touchPositionChanged(const QPointF &position);
83
void immediateRecognitionChanged(bool immediateRecognition);
86
bool event(QEvent *e) override;
88
void touchEvent(QTouchEvent *event) override;
89
void itemChange(ItemChange change, const ItemChangeData &value) override;
91
public: // so tests can access it
92
UCSwipeAreaPrivate *d;
95
Q_DECLARE_LOGGING_CATEGORY(ucSwipeArea)
96
Q_DECLARE_LOGGING_CATEGORY(ucActiveTouchInfo)
98
#endif // UCSWIPEAREA_H