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
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
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"
39 * A manager class that can detect mouse gesture
40 * @see http://en.wikipedia.org/wiki/Pointing_device_gesture
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 */
54 * Constructor of the GestureManager class
55 * @param _threshold The threshold distance in px for edge detection
61 * Returns the recognized gesture
62 * @return NULL or recognized gesture string
64 const TCHAR
* GetGesture() const;
67 * Stops the GestureManager and returns the recognized gesture
68 * @return NULL or recognized gesture string
70 const TCHAR
* Finish();
73 * Starts the GestureManager at the given coordinates
75 void Start(PixelScalar x
, PixelScalar y
, int _threshold
);
78 * Adds new coordinates to the GestureManager
79 * @return True if the threshold was reached, False otherwise
81 bool Update(PixelScalar x
, PixelScalar y
);