Exclude internal tag module in Public API reference
[platform/core/uifw/dali-core.git] / dali / public-api / events / tap-gesture-detector.h
1 #ifndef __DALI_TAP_GESTURE_DETECTOR_H__
2 #define __DALI_TAP_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 TapGestureDetector;
35 }
36
37 struct TapGesture;
38
39 /**
40  * @brief This class emits a signal when a tap gesture occurs that meets the requirements set by the
41  * application.
42  *
43  * See @ref TapGestureDetector::SetMinimumTapsRequired
44  * See @ref TapGestureDetector::SetMaximumTapsRequired
45  *
46  * A TapGesture is a discrete gesture, which means it does not have any state information attached
47  * to it.  Please see TapGesture for more information.
48  *
49  * The application programmer can use this gesture detector as follows:
50  * @code
51  * TapGestureDetector detector = TapGestureDetector::New();
52  * detector.Attach(myActor);
53  * detector.DetectedSignal().Connect(this, &MyApplication::OnTap);
54  * @endcode
55  *
56  * @SINCE_1_0.0
57  * @note Multi-touch taps are not currently supported. However, multiple taps (double & triple tap etc.) are supported.
58  *
59  * Signals
60  * | %Signal Name | Method                |
61  * |--------------|-----------------------|
62  * | tapDetected  | @ref DetectedSignal() |
63  * @see TapGesture
64  *
65  */
66 class DALI_IMPORT_API TapGestureDetector : public GestureDetector
67 {
68 public: // Typedefs
69
70   /**
71    * @brief Signal type for detected signal.
72    * @SINCE_1_0.0
73    */
74   typedef Signal< void ( Actor, const TapGesture& ) > DetectedSignalType;
75
76 public: // Creation & Destruction
77
78   /**
79    * @brief Create an uninitialized TapGestureDetector; this can be initialized with TapGestureDetector::New().
80    *
81    * Calling member functions with an uninitialized TapGestureDetector handle is not allowed.
82    * @SINCE_1_0.0
83    */
84   TapGestureDetector();
85
86   /**
87    * @brief Create an initialized TapGestureDetector.
88    *
89    * By default, this would create a gesture detector which requires one tap with one touch.
90    * @SINCE_1_0.0
91    * @return A handle to a newly allocated Dali resource.
92    */
93   static TapGestureDetector New();
94
95   /**
96    * @brief Create an initialized TapGestureDetector with the specified parameters.
97    *
98    * @SINCE_1_0.0
99    * @param[in] tapsRequired The minimum & maximum number of taps required.
100    * @return A handle to a newly allocated Dali resource.
101    */
102   static TapGestureDetector New( unsigned int tapsRequired );
103
104   /**
105    * @brief Downcast a handle to TapGestureDetector handle.
106    *
107    * If handle points to a TapGestureDetector object the
108    * downcast produces valid handle. If not the returned handle is left uninitialized.
109    * @SINCE_1_0.0
110    * @param[in] handle Handle to an object
111    * @return Handle to a TapGestureDetector object or an uninitialized handle
112    */
113   static TapGestureDetector DownCast( BaseHandle handle );
114
115   /**
116    * @brief Destructor
117    *
118    * This is non-virtual since derived Handle types must not contain data or virtual methods.
119    * @SINCE_1_0.0
120    */
121   ~TapGestureDetector();
122
123   /**
124    * @brief This copy constructor is required for (smart) pointer semantics.
125    *
126    * @SINCE_1_0.0
127    * @param [in] handle A reference to the copied handle
128    */
129   TapGestureDetector(const TapGestureDetector& handle);
130
131   /**
132    * @brief This assignment operator is required for (smart) pointer semantics.
133    *
134    * @SINCE_1_0.0
135    * @param [in] rhs  A reference to the copied handle
136    * @return A reference to this
137    */
138   TapGestureDetector& operator=(const TapGestureDetector& rhs);
139
140 public: // Setters
141
142   /**
143    * @brief Set the minimum number of taps required.
144    *
145    * The tap count is the number of times a user should "tap" the screen.
146    * @SINCE_1_0.0
147    * @param[in]  minimumTaps  The minimum taps required.
148    * @pre The gesture detector has been initialized.
149    * @note The default is '1'.
150    */
151   void SetMinimumTapsRequired( unsigned int minimumTaps );
152
153   /**
154    * @brief Set the maximum number of taps required.
155    *
156    * The tap count is the number of times a user should "tap" the screen.
157    * @SINCE_1_0.0
158    * @param[in]  maximumTaps  The maximum taps required.
159    * @pre The gesture detector has been initialized.
160    * @note The default is '1'.
161    */
162   void SetMaximumTapsRequired( unsigned int maximumTaps );
163
164 public: // Getters
165
166   /**
167    * @brief Retrieves the minimum number of taps required.
168    *
169    * @SINCE_1_0.0
170    * @return The minimum taps required.
171    * @pre The gesture detector has been initialized.
172    */
173   unsigned int GetMinimumTapsRequired() const;
174
175   /**
176    * @brief Retrieves the maximum number of taps required.
177    *
178    * @SINCE_1_0.0
179    * @return The maximum taps required.
180    * @pre The gesture detector has been initialized.
181    */
182   unsigned int GetMaximumTapsRequired() const;
183
184 public: // Signals
185
186   /**
187    * @brief This signal is emitted when the specified tap is detected on the attached actor.
188    *
189    * A callback of the following type may be connected:
190    * @code
191    *   void YourCallbackName( Actor actor, const TapGesture& gesture );
192    * @endcode
193    * @SINCE_1_0.0
194    * @return The signal to connect to.
195    * @pre The gesture detector has been initialized.
196    */
197   DetectedSignalType& DetectedSignal();
198
199 public: // Not intended for Application developers
200
201   /// @cond internal
202   /**
203    * @brief This constructor is used by TapGestureDetector::New() methods.
204    *
205    * @SINCE_1_0.0
206    * @param [in] internal A pointer to a newly allocated Dali resource.
207    */
208   explicit DALI_INTERNAL TapGestureDetector(Internal::TapGestureDetector* internal);
209   /// @endcond
210 };
211
212 /**
213  * @}
214  */
215
216 } // namespace Dali
217
218 #endif // __DALI_TAP_GESTURE_DETECTOR_H__