summaryrefslogtreecommitdiffstats
path: root/examples/gestures/collidingmice/linjazaxgesture.h
blob: 9601675692d43fd55786d45eb144bde5b90cdaaa (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
#ifndef LINJAZAXGESTURE_H
#define LINJAZAXGESTURE_H

#include <QGesture>

class Q_GUI_EXPORT 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(const Qt::GestureType &type, Qt::GestureState state = Qt::GestureStarted)
        : QGesture(type, state), lastDirection_(None), direction_(None), zoomState_(NoZoom) { }
    LinjaZaxGesture(const Qt::GestureType &type, const QPoint &startPos,
                     const QPoint &lastPos, const QPoint &pos, const QRect &rect,
                     const QPoint &hotSpot, const QDateTime &startTime,
                     uint duration, Qt::GestureState state)
        : QGesture(type, 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