The class declaration should be the first header in the cc file for
[shopper.git] / src / ui / GestureReader.h
blob76540c78b566a4d5fad2441f5e8babd0e3707416
1 /* Shopper
2 * Copyright (C) 2008 David Greaves
4 * This software is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public License
6 * as published by the Free Software Foundation; either version 2.1 of
7 * the License, or (at your option) any later version.
9 * This software is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this software; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17 * 02110-1301 USA
20 #ifndef GESTUREREADER_H
21 #define GESTUREREADER_H
23 #include "shopper.h" // automake, i8n, gettext
24 #include "Gesture.h"
26 // This class is used to record gesture events
27 // These can be press, release and move
28 // as some gestures may have multiple strokes
30 class GestureReader
32 public:
33 class Point
35 public:
36 typedef enum _Type { Move, Release, Press, Start, Invalid } Type;
37 typedef enum _Direction { None,
38 Up, Right, Down, Left,
39 UpRight, DownRight, DownLeft, UpLeft } Direction;
41 Point();
42 Point( int _x, int _y, int _len, Point::Direction _dir, Point::Type _type);
44 private:
45 friend class GestureReader;
46 int x;
47 int y;
48 int len2; // length squared
49 Direction direction;
50 Type type;
53 public:
54 GestureReader();
55 ~GestureReader();
57 void start(int x, int y);
58 void addPoint(int x, int y, Point::Type type);
60 Gesture matchOne( QList<Gesture> gs);
63 private:
64 QString generateStrokes();
66 struct Private;
67 Private *p;
70 #endif //GESTUREREADER_H