~unity-ui-team/ubuntu-ui-toolkit/trunk-ubuntu-ui-toolkit-image-extension-crash-workaround

« back to all changes in this revision

Viewing changes to src/Ubuntu/Components/plugin/gestures/ucswipearea.h

  • Committer: CI Train Bot
  • Author(s): Christian Dywan, Launchpad Translations on behalf of ubuntu-sdk-team, Brendan Donegan, Zoltán Balogh, CI Train Bot, Tim Peeters, Florian Boucault, Loïc Molinari, Zsombor Egri, Andrea Bernabei, Timo Jyrinki, Benjamin Zeller
  • Date: 2015-12-09 14:43:54 UTC
  • mfrom: (1000.669.63 OTA9_landing_2015-12-05)
  • Revision ID: ci-train-bot@canonical.com-20151209144354-2yo5xlsnp8ox38vm
Landing 2015.12.05 - OTA9
Approved by: Zoltan Balogh

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
18
#ifndef UCSWIPEAREA_H
 
19
#define UCSWIPEAREA_H
 
20
 
 
21
#include <QtQuick/QQuickItem>
 
22
#include "ubuntugesturesqmlglobal.h"
 
23
#include "damper.h"
 
24
 
 
25
// lib UbuntuGestures
 
26
#include <UbuntuGestures/Pool>
 
27
#include <UbuntuGestures/Timer>
 
28
 
 
29
// logging
 
30
#include <QtCore/QLoggingCategory>
 
31
 
 
32
class TouchOwnershipEvent;
 
33
class UnownedTouchEvent;
 
34
class UCSwipeAreaPrivate;
 
35
 
 
36
class UBUNTUGESTURESQML_EXPORT UCSwipeArea : public QQuickItem
 
37
{
 
38
    Q_OBJECT
 
39
 
 
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)
 
49
 
 
50
    Q_ENUMS(Direction)
 
51
public:
 
52
    enum Direction {
 
53
        Rightwards,
 
54
        Leftwards,
 
55
        Downwards,
 
56
        Upwards,
 
57
        Horizontal,
 
58
        Vertical
 
59
    };
 
60
 
 
61
    UCSwipeArea(QQuickItem *parent = 0);
 
62
 
 
63
    Direction direction() const;
 
64
    void setDirection(Direction);
 
65
 
 
66
    qreal distance() const;
 
67
 
 
68
    QPointF touchPosition() const;
 
69
 
 
70
    bool dragging() const;
 
71
 
 
72
    bool pressed() const;
 
73
 
 
74
    bool immediateRecognition() const;
 
75
    void setImmediateRecognition(bool enabled);
 
76
 
 
77
Q_SIGNALS:
 
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);
 
84
 
 
85
protected:
 
86
    bool event(QEvent *e) override;
 
87
 
 
88
    void touchEvent(QTouchEvent *event) override;
 
89
    void itemChange(ItemChange change, const ItemChangeData &value) override;
 
90
 
 
91
public: // so tests can access it
 
92
    UCSwipeAreaPrivate *d;
 
93
};
 
94
 
 
95
Q_DECLARE_LOGGING_CATEGORY(ucSwipeArea)
 
96
Q_DECLARE_LOGGING_CATEGORY(ucActiveTouchInfo)
 
97
 
 
98
#endif // UCSWIPEAREA_H