N_SE-47263 : reset touch cancel when indicator touch released/N_SE-51832 : fix checki...
[platform/framework/native/uifw.git] / inc / FUiTouchTapGestureDetector.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0/
10 //
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.
16 //
17
18 /**
19  * @file                        FUiTouchTapGestureDetector.h
20  * @brief               This is the header file for the %TouchTapGestureDetector class.
21  *
22  * This header file contains the declarations of the %TouchTapGestureDetector class.
23  *
24  */
25
26 #ifndef _FUI_TOUCH_TAP_GESTURE_DETECTOR_H_
27 #define _FUI_TOUCH_TAP_GESTURE_DETECTOR_H_
28
29 #include <FUiTouchGestureDetector.h>
30
31 namespace Tizen { namespace Ui
32 {
33
34 class ITouchTapGestureEventListener;
35
36 /**
37  * @class               TouchTapGestureDetector
38  * @brief               This class stores the information of a tap gesture detector.
39  *
40  * @since 2.0
41  *
42  * @final        This class is not intended for extension.
43  *
44  * The %TouchTapGestureDetector class supports changing conditions of tap gesture, and provides information about tap gesture detector.
45  *
46  */
47 class _OSP_EXPORT_ TouchTapGestureDetector
48         : public Tizen::Ui::TouchGestureDetector
49 {
50 public:
51         /**
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.
53          *
54          * @since 2.0
55          */
56         TouchTapGestureDetector(void);
57
58         /**
59          * This destructor overrides Tizen::Base::Object::~Object().
60          *
61          * @since 2.0
62          */
63         virtual ~TouchTapGestureDetector(void);
64
65         /**
66          * Initializes this instance of %TouchTapGestureDetector.
67          *
68          * @since 2.0
69          * @exception   E_SUCCESS                                       The method is successful.
70          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
71          */
72         result Construct(void);
73
74         /**
75         * Adds the ITouchTapGestureEventListener instance to the tap gesture detector instance. @n
76         * The added listener gets notified when a gesture is recognized.
77         *
78         * @since 2.0
79         *
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()
85         */
86         result AddTapGestureEventListener(Tizen::Ui::ITouchTapGestureEventListener& listener);
87
88         /**
89         * Removes the ITouchTapGestureEventListener instance from the tap gesture detector instance.
90         *
91         * @since 2.0
92         *
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()
98         */
99         result RemoveTapGestureEventListener(Tizen::Ui::ITouchTapGestureEventListener& listener);
100
101         /**
102         * Sets the tap count required for the recognition of tap gesture.
103         *
104         * @since 2.0
105         *
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.
110         * @see                          GetTapCount()
111         *
112         */
113         result SetTapCount(int count);
114
115         /**
116          * Gets the tap count required for the recognition of tap gesture.
117          *
118          * @since 2.0
119          *
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.
124          * @see                 SetTapCount()
125          */
126         int GetTapCount(void) const;
127
128         /**
129         * Sets the time interval between taps.
130         *
131         * @since 2.0
132         *
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()
138         *
139         */
140         result SetTapInterval(int interval);
141
142         /**
143          * Gets the time interval between taps.
144          *
145          * @since 2.0
146          *
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()
152          */
153         int GetTapInterval(void) const;
154
155         /**
156         * Sets the finger count for the recognition of tap gesture at the same time.
157         *
158         * @since 2.0
159         *
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()
167         *
168         */
169         result SetTouchCount(int count);
170
171         /**
172         * Gets the finger count for the recognition of tap gesture at the same time.
173         *
174         * @since 2.0
175         *
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()
181         *
182         */
183         int GetTouchCount(void) const;
184
185         /**
186         *  Sets the allowed displacement between touches for the recognition of tap gesture.
187         *
188         * @since 2.0
189         *
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()
197         *
198         */
199         result SetMoveAllowance(int allowance);
200
201         /**
202         *  Sets the allowed displacement between touches for the recognition of tap gesture.
203         *
204         * @since 2.1
205         *
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()
213         *
214         */
215         result SetMoveAllowance(float allowance);
216
217         /**
218          * Gets ths allowed displacement between touches for the recognition of tap gesture.
219          *
220          * @since 2.0
221          *
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()
226          */
227         int GetMoveAllowance(void) const;
228
229         /**
230          * Gets ths allowed displacement between touches for the recognition of tap gesture.
231          *
232          * @since 2.1
233          *
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()
238          */
239         float GetMoveAllowanceF(void) const;
240 private:
241         //
242         // This is the copy constructor for this class.
243         //
244         TouchTapGestureDetector(const TouchTapGestureDetector& rhs);
245
246         //
247         // Assigns the value of the specified instance to the current instance of %TouchTapGestureDetector.
248         //
249         TouchTapGestureDetector& operator =(const TouchTapGestureDetector& rhs);
250
251 protected:
252         friend class _TouchTapGestureDetectorImpl;
253 }; // TouchTapGestureDetector
254
255 }} // Tizen::Ui
256
257 #endif  //_FUI_TOUCH_TAP_GESTURE_DETECTOR_H_