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