Tizen 2.1 base
[framework/osp/uifw.git] / inc / FUiTouchFlickGestureDetector.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://floralicense.org/license/
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                        FUiTouchFlickGestureDetector.h
20  * @brief               This is the header file for the %TouchFlickGestureDetector class.
21  *
22  * This header file contains the declarations of the %TouchFlickGestureDetector class.
23  *
24  */
25 #ifndef _FUI_TOUCH_FLICK_GESTURE_DETECTOR_H_
26 #define _FUI_TOUCH_FLICK_GESTURE_DETECTOR_H_
27
28 #include <FUiTouchGestureDetector.h>
29
30 namespace Tizen { namespace Ui
31 {
32
33 class ITouchFlickGestureEventListener;
34
35 /**
36  * @enum FlickDirection
37  *
38  * Defines the direction of a flick gesture.
39  *
40  * @since 2.0
41  */
42 enum FlickDirection
43 {
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 */
49 };
50
51 /**
52  * @class               TouchFlickGestureDetector
53  * @brief               This class stores the information of a flick gesture detector.
54  *
55  * @since 2.0
56  *
57  * @final        This class is not intended for extension.
58  *
59  * The %TouchFlickGestureDetector class supports flicking of touches, and provides information about flick gesture detector.
60  *
61  */
62 class _OSP_EXPORT_ TouchFlickGestureDetector
63         : public Tizen::Ui::TouchGestureDetector
64 {
65 public:
66         /**
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.
68          *
69          * @since 2.0
70          */
71                 TouchFlickGestureDetector(void);
72
73         /**
74          * This destructor overrides Osp::Base::Object::~Object().
75          *
76          * @since 2.0
77          */
78         virtual ~TouchFlickGestureDetector(void);
79
80 public:
81          /**
82          * Initializes this instance of %TouchFlickGestureDetector.
83          *
84          * @since 2.0
85          * @exception   E_SUCCESS                                       The method is successful.
86          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
87          */
88         result Construct(void);
89
90         /**
91          * Adds the ITouchFlickGestureEventListener instance to the flick gesture detector instance. @n
92          * The added listener gets notified when a gesture is recognized.
93          *
94          * @since 2.0
95          *
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()
101          */
102         result AddFlickGestureEventListener(Tizen::Ui::ITouchFlickGestureEventListener& listener);
103
104         /**
105          * Removes the IFlickGestureEventListener instance from the flick gesture detector instance.
106          *
107          * @since 2.0
108          *
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()
114          */
115         result RemoveFlickGestureEventListener(Tizen::Ui::ITouchFlickGestureEventListener& listener);
116
117         /**
118          * Gets the distance of flick.
119          *
120          * @since 2.0
121          *
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.
127          */
128         result GetDistance(int& xDistance, int& yDistance) const;
129
130         /**
131          * Gets the duration of flick.
132          *
133          * @since 2.0
134          *
135          * @return                      The duration of flick
136          * @exception   E_SUCCESS                                       The method is successful.
137          * @remarks     If an error occurs, this method returns -1.
138          */
139         int GetDuration(void) const;
140
141         /**
142          * Gets the direction of flick.
143          *
144          * @since 2.0
145          *
146          * @return                      The direction of flick
147          * @exception   E_SUCCESS                                       The method is successful.
148          * @remarks     If an error occurs, this method returns FLICK_DIRECTION_NONE.
149          */
150         Tizen::Ui::FlickDirection GetDirection(void) const;
151 private:
152         //
153         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
154         //
155         TouchFlickGestureDetector(const TouchFlickGestureDetector& rhs);
156
157         //
158         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
159         //
160         TouchFlickGestureDetector& operator =(const TouchFlickGestureDetector& rhs);
161
162 private:
163         friend class _TouchFlickGestureDetectorImpl;
164 }; // TouchFlickGestureDetector
165
166 }} // Tizen::Ui
167
168 #endif  //_FUI_TOUCH_FLICK_GESTURE_DETECTOR_H_