2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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 FUiTouchTapGestureDetector.h
20 * @brief This is the header file for the %TouchTapGestureDetector class.
22 * This header file contains the declarations of the %TouchTapGestureDetector class.
26 #ifndef _FUI_TOUCH_TAP_GESTURE_DETECTOR_H_
27 #define _FUI_TOUCH_TAP_GESTURE_DETECTOR_H_
29 #include <FUiTouchGestureDetector.h>
31 namespace Tizen { namespace Ui
34 class ITouchTapGestureEventListener;
37 * @class TouchTapGestureDetector
38 * @brief This class stores the information of a tap gesture detector.
42 * @final This class is not intended for extension.
44 * The %TouchTapGestureDetector class supports changing conditions of tap gesture, and provides information about tap gesture detector.
47 class _OSP_EXPORT_ TouchTapGestureDetector
48 : public Tizen::Ui::TouchGestureDetector
52 * 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.
56 TouchTapGestureDetector(void);
59 * This destructor overrides Tizen::Base::Object::~Object().
63 virtual ~TouchTapGestureDetector(void);
66 * Initializes this instance of %TouchTapGestureDetector.
69 * @exception E_SUCCESS The method is successful.
70 * @exception E_OUT_OF_MEMORY The memory is insufficient.
72 result Construct(void);
75 * Adds the ITouchTapGestureEventListener instance to the tap gesture detector instance. @n
76 * The added listener gets notified when a gesture is recognized.
80 * @return An error code
81 * @param[in] listener The event listener to add
82 * @exception E_SUCCESS The method is successful.
83 * @exception E_OBJ_ALREADY_EXIST The listener is already added.
84 * @see RemoveTapGestureEventListener()
86 result AddTapGestureEventListener(Tizen::Ui::ITouchTapGestureEventListener& listener);
89 * Removes the ITouchTapGestureEventListener instance from the tap gesture detector instance.
93 * @return An error code
94 * @param[in] listener The listener to remove
95 * @exception E_SUCCESS The method is successful.
96 * @exception E_OBJ_NOT_FOUND The specified @c listener is not found.
97 * @see AddTapGestureEventListener()
99 result RemoveTapGestureEventListener(Tizen::Ui::ITouchTapGestureEventListener& listener);
102 * Sets the tap count required for the recognition of tap gesture.
106 * @param[in] count The tap count
107 * @exception E_SUCCESS The method is successful.
108 * @exception E_INVALID_ARG The specified @c tap count is less than @c 0.
109 * @remarks The default value is @c 2.
113 result SetTapCount(int count);
116 * Gets the tap count required for the recognition of tap gesture.
120 * @return The tap count
121 * @exception E_SUCCESS The method is successful.
122 * @remarks The specific error code can be accessed using the GetLastResult() method.
123 * @remarks If an error occurs, this method returns @c -1.
126 int GetTapCount(void) const;
129 * Sets the time interval between taps.
133 * @param[in] interval The time interval between taps
134 * @exception E_SUCCESS The method is successful.
135 * @exception E_INVALID_ARG The specified @c interval is less than @c 0.
136 * @remarks If the interval between touches is longer than @c interval, the sequence of touch actions is not recognized as a tap gesture. The default value is @c 330.
137 * @see GetTapInterval()
140 result SetTapInterval(int interval);
143 * Gets the time interval between taps.
147 * @return The time interval between taps
148 * @exception E_SUCCESS The method is successful.
149 * @remarks The specific error code can be accessed using the GetLastResult() method.
150 * @remarks If an error occurs, this method returns @c -1.
151 * @see SetTapInterval()
153 int GetTapInterval(void) const;
156 * Sets the finger count for the recognition of tap gesture at the same time.
160 * @param[in] count The finger count for long press gesture
161 * @exception E_SUCCESS The method is successful.
162 * @exception E_INVALID_ARG The specified @c count is less than @c 0.
163 * @remarks If the touch count at the same time is less than @c count, the sequence of touch actions is not recognized as a tap gesture. The default value is @c 1. @n
164 * It is recommended to check the maximum touch count of a device before changing the touch count of a gesture detector.
165 * You can set the gesture touch count to more than the maximum device touch count, but the gesture recognition may not work as you expected.
166 * @see GetTouchCount()
169 result SetTouchCount(int count);
172 * Gets the finger count for the recognition of tap gesture at the same time.
176 * @return The finger count for tap gesture
177 * @exception E_SUCCESS The method is successful.
178 * @remarks The specific error code can be accessed using the GetLastResult() method.
179 * @remarks If an error occurs, this method returns @c -1.
180 * @see GetTouchCount()
183 int GetTouchCount(void) const;
186 * Sets the allowed displacement between touches for the recognition of tap gesture.
190 * @param[in] allowance The allowed displacement between touches
191 * @exception E_SUCCESS The method is successful.
192 * @exception E_INVALID_ARG The specified @c allowance is less than @c 0.
193 * @exception E_INVALID_CONDITION %Touch count is more than @c 2.
194 * @remarks The tap gesture is recognized when touches are pressed within the given allowed displacement from the first touch point. The default allowance is @c 10. @n
195 * MoveAllowance is effective only when touch count is @c 1. If touch count is more than 1, MoveAllowance is ignored.
196 * @see GetMoveAllowance()
199 result SetMoveAllowance(int allowance);
202 * Sets the allowed displacement between touches for the recognition of tap gesture.
206 * @param[in] allowance The allowed displacement between touches
207 * @exception E_SUCCESS The method is successful.
208 * @exception E_INVALID_ARG The specified @c allowance is less than @c 0.
209 * @exception E_INVALID_CONDITION %Touch count is more than @c 2.
210 * @remarks The tap gesture is recognized when touches are pressed within the given allowed displacement from the first touch point. The default allowance is @c 10. @n
211 * MoveAllowance is effective only when touch count is @c 1. If touch count is more than 1, MoveAllowance is ignored.
212 * @see GetMoveAllowance()
215 result SetMoveAllowance(float allowance);
218 * Gets ths allowed displacement between touches for the recognition of tap gesture.
222 * @return The allowed displacement between touches
223 * @exception E_SUCCESS The method is successful.
224 * @remarks If an error occurs, this method returns @c -1.
225 * @see SetMoveAllowance()
227 int GetMoveAllowance(void) const;
230 * Gets ths allowed displacement between touches for the recognition of tap gesture.
234 * @return The allowed displacement between touches
235 * @exception E_SUCCESS The method is successful.
236 * @remarks If an error occurs, this method returns @c -1.
237 * @see SetMoveAllowance()
239 float GetMoveAllowanceF(void) const;
242 // This is the copy constructor for this class.
244 TouchTapGestureDetector(const TouchTapGestureDetector& rhs);
247 // Assigns the value of the specified instance to the current instance of %TouchTapGestureDetector.
249 TouchTapGestureDetector& operator =(const TouchTapGestureDetector& rhs);
252 friend class _TouchTapGestureDetectorImpl;
253 }; // TouchTapGestureDetector
257 #endif //_FUI_TOUCH_TAP_GESTURE_DETECTOR_H_