Merge "Ensure BaseHandle class move noexcept (core public-api)" into devel/master
[platform/core/uifw/dali-core.git] / dali / public-api / events / rotation-gesture-detector.h
1 #ifndef DALI_ROTATION_GESTURE_DETECTOR_H
2 #define DALI_ROTATION_GESTURE_DETECTOR_H
3
4 /*
5  * Copyright (c) 2022 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 namespace Internal DALI_INTERNAL
28 {
29 class RotationGestureDetector;
30 }
31
32 class RotationGesture;
33
34 /**
35  * @brief This class looks for a rotation gesture involving two touches.
36  *
37  * It measures the relative rotation of two touch points & emits a signal
38  * when this changes. Please see RotationGesture for more information.
39  *
40  * The application programmer can use this gesture detector as follows:
41  * @code
42  * RotationGestureDetector detector = RotationGestureDetector::New();
43  * detector.Attach( myActor );
44  * detector.DetectedSignal().Connect( this, &MyApplication::OnRotation );
45  * @endcode
46  *
47  * @see RotationGesture
48  *
49  * Signals
50  * | %Signal Name      | Method                |
51  * |-------------------|-----------------------|
52  * | rotationDetected  | @ref DetectedSignal() |
53  *
54  * @SINCE_1_9.27
55  */
56 class DALI_CORE_API RotationGestureDetector : public GestureDetector
57 {
58 public: // Typedefs
59   /**
60    * @brief Signal type.
61    */
62   using DetectedSignalType = Signal<void(Actor, const RotationGesture&)>;
63
64 public: // Creation & Destruction
65   /**
66    * @brief Creates an uninitialized RotationGestureDetector; this can be initialized with RotationGestureDetector::New().
67    *
68    * @SINCE_1_9.27
69    * Calling member functions with an uninitialized RotationGestureDetector handle is not allowed.
70    */
71   RotationGestureDetector();
72
73   /**
74    * @brief Creates an initialized RotationGestureDetector.
75    *
76    * @SINCE_1_9.27
77    * @return A handle to a newly allocated Dali resource
78    */
79   static RotationGestureDetector New();
80
81   /**
82    * @brief Downcasts a handle to RotationGestureDetector handle.
83    *
84    * @SINCE_1_9.27
85    * If handle points to a RotationGestureDetector object, the
86    * downcast produces valid handle. If not, the returned handle is left uninitialized.
87    * @param[in] handle Handle to an object
88    * @return Handle to a RotationGestureDetector object or an uninitialized handle
89    */
90   static RotationGestureDetector DownCast(BaseHandle handle);
91
92   /**
93    * @brief Destructor.
94    *
95    * @SINCE_1_9.27
96    * This is non-virtual since derived Handle types must not contain data or virtual methods.
97    */
98   ~RotationGestureDetector();
99
100   /**
101    * @brief This copy constructor is required for (smart) pointer semantics.
102    *
103    * @SINCE_1_9.27
104    * @param[in] handle A reference to the copied handle
105    */
106   RotationGestureDetector(const RotationGestureDetector& handle);
107
108   /**
109    * @brief This assignment operator is required for (smart) pointer semantics.
110    *
111    * @SINCE_1_9.27
112    * @param[in] rhs A reference to the copied handle
113    * @return A reference to this
114    */
115   RotationGestureDetector& operator=(const RotationGestureDetector& rhs);
116
117   /**
118    * @brief This move constructor is required for (smart) pointer semantics.
119    *
120    * @SINCE_2_2.4
121    * @param[in] handle A reference to the moved handle
122    */
123   RotationGestureDetector(RotationGestureDetector&& handle) noexcept;
124
125   /**
126    * @brief This move assignment operator is required for (smart) pointer semantics.
127    *
128    * @SINCE_2_2.4
129    * @param[in] rhs A reference to the moved handle
130    * @return A reference to this
131    */
132   RotationGestureDetector& operator=(RotationGestureDetector&& rhs) noexcept;
133
134 public: // Signals
135   /**
136    * @brief This signal is emitted when the rotation gesture is detected on the attached actor.
137    *
138    * A callback of the following type may be connected:
139    * @code
140    *   void YourCallbackName( Actor actor, const RotationGesture& gesture );
141    * @endcode
142    * @SINCE_1_9.27
143    * @return The signal to connect to
144    * @pre The gesture detector has been initialized.
145    */
146   DetectedSignalType& DetectedSignal();
147
148 public: // Not intended for Application developers
149   /// @cond internal
150   /**
151    * @brief This constructor is used by RotationGestureDetector::New() methods.
152    *
153    * @SINCE_1_9.27
154    * @param[in] internal A pointer to a newly allocated Dali resource
155    */
156   explicit DALI_INTERNAL RotationGestureDetector(Internal::RotationGestureDetector* internal);
157   /// @endcond
158 };
159
160 } // namespace Dali
161
162 #endif // DALI_ROTATION_GESTURE_DETECTOR_H