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