android/GlueIOIOPort: fix spurious errors after IOIO baud rate change
[xcsoar.git] / src / UIUtil / GestureManager.hpp
blob06c6119fb0e92b3dd4af045ca13f27e13994a643
1 /*
2 * Copyright (C) 2003-2010 Tobias Bieniek <Tobias.Bieniek@gmx.de>
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
8 * - Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the
14 * distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
19 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20 * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
27 * OF THE POSSIBILITY OF SUCH DAMAGE.
30 #ifndef GESTURE_MANAGER_HPP
31 #define GESTURE_MANAGER_HPP
33 #include "Util/StaticString.hpp"
34 #include "Screen/Point.hpp"
36 #include <tchar.h>
38 /**
39 * A manager class that can detect mouse gesture
40 * @see http://en.wikipedia.org/wiki/Pointing_device_gesture
42 class GestureManager
44 /** Position of the last mouse_move event */
45 RasterPoint drag_last;
46 /** The gesture string */
47 StaticString<11> gesture;
49 /** The threshold distance in px for edge detection */
50 int threshold;
52 public:
53 /**
54 * Constructor of the GestureManager class
55 * @param _threshold The threshold distance in px for edge detection
57 GestureManager():
58 threshold(0) {}
60 /**
61 * Returns the recognized gesture
62 * @return NULL or recognized gesture string
64 const TCHAR* GetGesture() const;
66 /**
67 * Stops the GestureManager and returns the recognized gesture
68 * @return NULL or recognized gesture string
70 const TCHAR* Finish();
72 /**
73 * Starts the GestureManager at the given coordinates
75 void Start(PixelScalar x, PixelScalar y, int _threshold);
77 /**
78 * Adds new coordinates to the GestureManager
79 * @return True if the threshold was reached, False otherwise
81 bool Update(PixelScalar x, PixelScalar y);
84 #endif