1 #ifndef DALI_PINCH_GESTURE_DETECTOR_H
2 #define DALI_PINCH_GESTURE_DETECTOR_H
5 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/events/gesture-detector.h>
23 #include <dali/public-api/signals/dali-signal.h>
28 * @addtogroup dali_core_events
32 namespace Internal DALI_INTERNAL
34 class PinchGestureDetector;
40 * @brief This class looks for pinching gestures involving two touches.
42 * It tries to detect when the user moves two touch points towards or
43 * away from each other. Please see PinchGesture for more
46 * The application programmer can use this gesture detector as follows:
48 * PinchGestureDetector detector = PinchGestureDetector::New();
49 * detector.Attach(myActor);
50 * detector.DetectedSignal().Connect(this, &MyApplication::OnPinch);
57 * | %Signal Name | Method |
58 * |----------------|-----------------------|
59 * | pinchDetected | @ref DetectedSignal() |
61 class DALI_CORE_API PinchGestureDetector : public GestureDetector
68 using DetectedSignalType = Signal<void(Actor, const PinchGesture&)>;
70 public: // Creation & Destruction
72 * @brief Creates an uninitialized PinchGestureDetector; this can be initialized with PinchGestureDetector::New().
74 * Calling member functions with an uninitialized PinchGestureDetector handle is not allowed.
77 PinchGestureDetector();
80 * @brief Creates an initialized PinchGestureDetector.
83 * @return A handle to a newly allocated Dali resource
85 static PinchGestureDetector New();
88 * @brief Downcasts a handle to PinchGestureDetector handle.
90 * If handle points to a PinchGestureDetector object, the
91 * downcast produces valid handle. If not, the returned handle is left uninitialized.
93 * @param[in] handle Handle to an object
94 * @return Handle to a PinchGestureDetector object or an uninitialized handle
96 static PinchGestureDetector DownCast(BaseHandle handle);
101 * This is non-virtual since derived Handle types must not contain data or virtual methods.
104 ~PinchGestureDetector();
107 * @brief This copy constructor is required for (smart) pointer semantics.
110 * @param[in] handle A reference to the copied handle
112 PinchGestureDetector(const PinchGestureDetector& handle);
115 * @brief This assignment operator is required for (smart) pointer semantics.
118 * @param[in] rhs A reference to the copied handle
119 * @return A reference to this
121 PinchGestureDetector& operator=(const PinchGestureDetector& rhs);
124 * @brief This move constructor is required for (smart) pointer semantics.
127 * @param[in] handle A reference to the moved handle
129 PinchGestureDetector(PinchGestureDetector&& handle) noexcept;
132 * @brief This move assignment operator is required for (smart) pointer semantics.
135 * @param[in] rhs A reference to the moved handle
136 * @return A reference to this
138 PinchGestureDetector& operator=(PinchGestureDetector&& rhs) noexcept;
142 * @brief This signal is emitted when the pinch gesture is detected on the attached actor.
144 * A callback of the following type may be connected:
146 * void YourCallbackName( Actor actor, const PinchGesture& gesture );
149 * @return The signal to connect to
150 * @pre The gesture detector has been initialized.
152 DetectedSignalType& DetectedSignal();
154 public: // Not intended for Application developers
157 * @brief This constructor is used by PinchGestureDetector::New() methods.
160 * @param[in] internal A pointer to a newly allocated Dali resource
162 explicit DALI_INTERNAL PinchGestureDetector(Internal::PinchGestureDetector* internal);
171 #endif // DALI_PINCH_GESTURE_DETECTOR_H