Lomiri
Direction.h
1 /*
2  * Copyright (C) 2013, 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 DIRECTION_H
18 #define DIRECTION_H
19 
20 #include "LomiriGesturesQmlGlobal.h"
21 #include <QObject>
22 
23 /*
24  A Direction enum wrapper so that we can do things like "direction: Direction.Righwards"
25  from QML.
26  */
27 class LOMIRIGESTURESQML_EXPORT Direction : public QObject {
28  Q_OBJECT
29 
30 public:
31  // Make sure it is kept synchronized with SDK UCSwipeArea::Direction
32  enum Type {
33  Rightwards, // Along the positive direction of the X axis
34  Leftwards, // Along the negative direction of the X axis
35  Downwards, // Along the positive direction of the Y axis
36  Upwards, // Along the negative direction of the Y axis
37  Horizontal, // Along the X axis, in any direction
38  Vertical // Along the Y axis, in any direction
39  };
40  Q_ENUM(Type)
41 
42  Q_INVOKABLE static bool isHorizontal(Direction::Type type);
43  Q_INVOKABLE static bool isVertical(Direction::Type type);
44  Q_INVOKABLE static bool isPositive(Direction::Type type);
45 };
46 
47 #endif // DIRECTION_H