summaryrefslogtreecommitdiffstats
path: root/examples/gestures/collidingmice/linjazaxgesture.h
blob: 92343cfa6cd724cd7cd8cf2d9321e6c61026060e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef LINJAZAXGESTURE_H
#define LINJAZAXGESTURE_H

#include <QGesture>

class LinjaZaxGesture : public QGesture
{
public:
    enum DirectionType
    {
        None = 0,
        LeftDown = 1,
        DownLeft = LeftDown,
        Down = 2,
        RightDown = 3,
        DownRight = RightDown,
        Left = 4,
        Right = 6,
        LeftUp = 7,
        UpLeft = LeftUp,
        Up = 8,
        RightUp = 9,
        UpRight = RightUp
    };

    enum ZoomState
    {
        NoZoom,
        ZoomingIn,
        ZoomingOut
    };

public:
    explicit LinjaZaxGesture(QObject *parent,
                             Qt::GestureState state = Qt::GestureStarted)
        : QGesture(parent, QLatin1String("LinjaZax"), state), lastDirection_(None),
        direction_(None), zoomState_(NoZoom) { }
    LinjaZaxGesture(QObject *parent, const QPoint &startPos,
                    const QPoint &lastPos, const QPoint &pos, const QRect &rect,
                    const QPoint &hotSpot, const QDateTime &startTime,
                    uint duration, Qt::GestureState state)
        : QGesture(parent, QLatin1String("LinjaZax"), startPos, lastPos,
                   pos, rect, hotSpot, startTime, duration, state) { }
    ~LinjaZaxGesture() { }

    DirectionType lastDirection() const
    { return lastDirection_; }
    DirectionType direction() const
    { return direction_; }

    ZoomState zoomState() const
    { return zoomState_; }

private:
    DirectionType lastDirection_;
    DirectionType direction_;
    ZoomState zoomState_;
    friend class GestureRecognizerLinjaZax;
};

#endif