2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUiTouchFlickGestureDetector.h
20 * @brief This is the header file for the %TouchFlickGestureDetector class.
22 * This header file contains the declarations of the %TouchFlickGestureDetector class.
25 #ifndef _FUI_TOUCH_FLICK_GESTURE_DETECTOR_H_
26 #define _FUI_TOUCH_FLICK_GESTURE_DETECTOR_H_
28 #include <FUiTouchGestureDetector.h>
30 namespace Tizen { namespace Ui
33 class ITouchFlickGestureEventListener;
36 * @enum FlickDirection
38 * Defines the direction of a flick gesture.
44 FLICK_DIRECTION_NONE = -1, /**< Undefined flick direction */
45 FLICK_DIRECTION_RIGHT, /**< Rightward flick */
46 FLICK_DIRECTION_UP, /**< Upward flick */
47 FLICK_DIRECTION_LEFT, /**< Leftward flick */
48 FLICK_DIRECTION_DOWN /**< Downward flick */
52 * @class TouchFlickGestureDetector
53 * @brief This class stores the information of a flick gesture detector.
57 * @final This class is not intended for extension.
59 * The %TouchFlickGestureDetector class supports flicking of touches, and provides information about flick gesture detector.
62 class _OSP_EXPORT_ TouchFlickGestureDetector
63 : public Tizen::Ui::TouchGestureDetector
67 * The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor.
71 TouchFlickGestureDetector(void);
74 * This destructor overrides Tizen::Base::Object::~Object().
78 virtual ~TouchFlickGestureDetector(void);
82 * Initializes this instance of %TouchFlickGestureDetector.
85 * @exception E_SUCCESS The method is successful.
86 * @exception E_OUT_OF_MEMORY The memory is insufficient.
88 result Construct(void);
91 * Adds the ITouchFlickGestureEventListener instance to the flick gesture detector instance. @n
92 * The added listener gets notified when a gesture is recognized.
96 * @return An error code
97 * @param[in] listener The event listener to add
98 * @exception E_SUCCESS The method is successful.
99 * @exception E_OBJ_ALREADY_EXIST The listener is already added.
100 * @see RemoveFlickGestureEventListener()
102 result AddFlickGestureEventListener(Tizen::Ui::ITouchFlickGestureEventListener& listener);
105 * Removes the IFlickGestureEventListener instance from the flick gesture detector instance.
109 * @return An error code
110 * @param[in] listener The listener to remove
111 * @exception E_SUCCESS The method is successful.
112 * @exception E_OBJ_NOT_FOUND The specified @c listener is not found.
113 * @see AddFlickGestureEventListener()
115 result RemoveFlickGestureEventListener(Tizen::Ui::ITouchFlickGestureEventListener& listener);
118 * Gets the distance of flick.
122 * @return An error code
123 * @param[out] xDistance The distance in x direction
124 * @param[out] yDistance The distance in y direction
125 * @exception E_SUCCESS The method is successful.
126 * @remarks If an error occurs, this method returns the x distance of -1 and the y distance of -1.
128 result GetDistance(int& xDistance, int& yDistance) const;
131 * Gets the distance of flick.
135 * @return An error code
136 * @param[out] xDistance The distance in x direction
137 * @param[out] yDistance The distance in y direction
138 * @exception E_SUCCESS The method is successful.
139 * @remarks If an error occurs, this method returns the x distance of -1 and the y distance of -1.
141 result GetDistance(float& xDistance, float& yDistance) const;
144 * Gets the duration of flick.
148 * @return The duration of flick
149 * @exception E_SUCCESS The method is successful.
150 * @remarks If an error occurs, this method returns @c -1.
152 int GetDuration(void) const;
155 * Gets the direction of flick.
159 * @return The direction of flick
160 * @exception E_SUCCESS The method is successful.
161 * @remarks If an error occurs, this method returns FLICK_DIRECTION_NONE.
163 Tizen::Ui::FlickDirection GetDirection(void) const;
166 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
168 TouchFlickGestureDetector(const TouchFlickGestureDetector& rhs);
171 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
173 TouchFlickGestureDetector& operator =(const TouchFlickGestureDetector& rhs);
176 friend class _TouchFlickGestureDetectorImpl;
177 }; // TouchFlickGestureDetector
181 #endif //_FUI_TOUCH_FLICK_GESTURE_DETECTOR_H_