Update doxygen comments
[platform/core/uifw/dali-core.git] / dali / public-api / events / long-press-gesture-detector.h
1 #ifndef __DALI_LONG_PRESS_GESTURE_DETECTOR_H__
2 #define __DALI_LONG_PRESS_GESTURE_DETECTOR_H__
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/events/gesture-detector.h>
23 #include <dali/public-api/signals/dali-signal.h>
24
25 namespace Dali
26 {
27 /**
28  * @addtogroup dali_core_events
29  * @{
30  */
31
32 namespace Internal DALI_INTERNAL
33 {
34 class LongPressGestureDetector;
35 }
36
37 struct LongPressGesture;
38
39 /**
40  * @brief This class emits a signals when a long press gesture occurs that meets the requirements set by the application.
41  * @SINCE_1_0.0
42  *
43  * For any valid long press, two signals will be emitted:
44  * - First identifying the beginning (state = Started) i.e. when fingers held down for the required time.
45  * - Second identifying the ending (state = Finished) i.e. when fingers are released.
46  *
47  * The application programmer can use this gesture detector as follows:
48  * @code
49  * LongPressGestureDetector detector = LongPressGestureDetector::New();
50  * detector.Attach(myActor);
51  * detector.DetectedSignal().Connect(this, &MyApplication::OnLongPress);
52  * @endcode
53  *
54  * @see LongPressGesture
55  *
56  * Signals
57  * | %Signal Name      | Method                |
58  * |-------------------|-----------------------|
59  * | longPressDetected | @ref DetectedSignal() |
60  */
61 class DALI_IMPORT_API LongPressGestureDetector : public GestureDetector
62 {
63 public: // Typedefs
64
65   typedef Signal< void ( Actor, const LongPressGesture& ) > DetectedSignalType; ///< Gesture detected signal type @SINCE_1_0.0
66
67 public: // Creation & Destruction
68
69   /**
70    * @brief Creates an uninitialized LongPressGestureDetector; this can be initialized with LongPressGestureDetector::New().
71    *
72    * Calling member functions with an uninitialized LongPressGestureDetector handle is not allowed.
73    * @SINCE_1_0.0
74    */
75   LongPressGestureDetector();
76
77   /**
78    * @brief Creates an initialized LongPressGestureDetector.
79    *
80    * By default, this would create a gesture detector that requires only one touch.
81    * @SINCE_1_0.0
82    * @return A handle to a newly allocated Dali resource
83    */
84   static LongPressGestureDetector New();
85
86   /**
87    * @brief Creates an initialized LongPressGestureDetector with the number of touches required.
88    *
89    * A long press gesture will be emitted from this detector if the number of fingers touching the
90    * screen is equal to the touches required.
91    * @SINCE_1_0.0
92    * @param[in] touchesRequired The number of touches required
93    * @return A handle to a newly allocated Dali resource
94    */
95   static LongPressGestureDetector New(unsigned int touchesRequired);
96
97   /**
98    * @brief Creates an initialized LongPressGestureDetector with the minimum and maximum number of touches required.
99    *
100    * A long press gesture will be emitted from this detector if the number of fingers touching the screen
101    * falls between the minimum and maximum touches set.
102    * @SINCE_1_0.0
103    * @param[in] minTouches The minimum number of touches required
104    * @param[in] maxTouches The maximum number of touches required
105    * @return A handle to a newly allocated Dali resource
106    */
107   static LongPressGestureDetector New(unsigned int minTouches, unsigned int maxTouches);
108
109   /**
110    * @brief Downcasts a handle to LongPressGestureDetector handle.
111    *
112    * If handle points to a LongPressGestureDetector object, the
113    * downcast produces valid handle. If not, the returned handle is left uninitialized.
114    * @SINCE_1_0.0
115    * @param[in] handle Handle to an object
116    * @return Handle to a LongPressGestureDetector object or an uninitialized handle
117    */
118   static LongPressGestureDetector DownCast( BaseHandle handle );
119
120   /**
121    * @brief Destructor.
122    *
123    * This is non-virtual since derived Handle types must not contain data or virtual methods.
124    * @SINCE_1_0.0
125    */
126   ~LongPressGestureDetector();
127
128   /**
129    * @brief This copy constructor is required for (smart) pointer semantics.
130    *
131    * @SINCE_1_0.0
132    * @param[in] handle A reference to the copied handle
133    */
134   LongPressGestureDetector(const LongPressGestureDetector& handle);
135
136   /**
137    * @brief This assignment operator is required for (smart) pointer semantics.
138    *
139    * @SINCE_1_0.0
140    * @param[in] rhs A reference to the copied handle
141    * @return A reference to this
142    */
143   LongPressGestureDetector& operator=(const LongPressGestureDetector& rhs);
144
145 public: // Setters
146
147   /**
148    * @brief Sets the number of touches required.
149    *
150    * The number of touches corresponds to the number of fingers a user
151    * has on the screen.  This sets the minimum and maximum touches to
152    * the input parameter.
153    *
154    * @SINCE_1_0.0
155    * @param[in] touches Touches required
156    * @pre The gesture detector has been initialized.
157    * @note The default is '1'.
158    */
159   void SetTouchesRequired(unsigned int touches);
160
161   /**
162    * @brief Sets the minimum and maximum touches required.
163    *
164    * The number of touches corresponds to the number of fingers a user
165    * has on the screen.
166    *
167    * @SINCE_1_0.0
168    * @param[in] minTouches Minimum Touches required
169    * @param[in] maxTouches Maximum Touches required
170    * @pre The gesture detector has been initialized.
171    * @note The default is '1'.
172    */
173   void SetTouchesRequired(unsigned int minTouches, unsigned int maxTouches);
174
175 public: // Getters
176
177   /**
178    * @brief Retrieves the minimum number of touches required.
179    *
180    * @SINCE_1_0.0
181    * @return The minimum number of touches required
182    * @pre The gesture detector has been initialized.
183    */
184   unsigned int GetMinimumTouchesRequired() const;
185
186   /**
187    * @brief Retrieves the maximum number of touches required.
188    *
189    * @SINCE_1_0.0
190    * @return The maximum number of touches required
191    * @pre The gesture detector has been initialized.
192    */
193   unsigned int GetMaximumTouchesRequired() const;
194
195 public: // Signals
196
197   /**
198    * @brief This signal is emitted when the specified long press is detected on the attached actor.
199    *
200    * A callback of the following type may be connected:
201    * @code
202    *   void YourCallbackName( Actor actor, const LongPressGesture& gesture );
203    * @endcode
204    * @SINCE_1_0.0
205    * @return The signal to connect to
206    * @pre The gesture detector has been initialized.
207    */
208   DetectedSignalType& DetectedSignal();
209
210 public: // Not intended for Application developers
211
212   /// @cond internal
213   /**
214    * @brief This constructor is used by LongPressGestureDetector::New() methods.
215    *
216    * @SINCE_1_0.0
217    * @param[in] internal A pointer to a newly allocated Dali resource
218    */
219   explicit DALI_INTERNAL LongPressGestureDetector(Internal::LongPressGestureDetector* internal);
220   /// @endcond
221
222 };
223
224 /**
225  * @}
226  */
227 } // namespace Dali
228
229 #endif // __DALI_LONG_PRESS_GESTURE_DETECTOR_H__