1 #ifndef DALI_ROTATION_GESTURE_DETECTOR_H
2 #define DALI_ROTATION_GESTURE_DETECTOR_H
5 * Copyright (c) 2019 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 namespace Internal DALI_INTERNAL
30 class RotationGestureDetector;
33 struct RotationGesture;
36 * @brief This class looks for a rotation gesture involving two touches.
38 * It measures the relative rotation of two touch points & emits a signal
39 * when this changes. Please see RotationGesture for more information.
41 * The application programmer can use this gesture detector as follows:
43 * RotationGestureDetector detector = RotationGestureDetector::New();
44 * detector.Attach( myActor );
45 * detector.DetectedSignal().Connect( this, &MyApplication::OnRotation );
48 * @see RotationGesture
51 * | %Signal Name | Method |
52 * |-------------------|-----------------------|
53 * | rotationDetected | @ref DetectedSignal() |
55 class DALI_CORE_API RotationGestureDetector : public GestureDetector
62 typedef Signal< void ( Actor, const RotationGesture& ) > DetectedSignalType;
64 public: // Creation & Destruction
67 * @brief Creates an uninitialized RotationGestureDetector; this can be initialized with RotationGestureDetector::New().
69 * Calling member functions with an uninitialized RotationGestureDetector handle is not allowed.
71 RotationGestureDetector();
74 * @brief Creates an initialized RotationGestureDetector.
76 * @return A handle to a newly allocated Dali resource
78 static RotationGestureDetector New();
81 * @brief Downcasts a handle to RotationGestureDetector handle.
83 * If handle points to a RotationGestureDetector object, the
84 * downcast produces valid handle. If not, the returned handle is left uninitialized.
85 * @param[in] handle Handle to an object
86 * @return Handle to a RotationGestureDetector object or an uninitialized handle
88 static RotationGestureDetector DownCast( BaseHandle handle );
93 * This is non-virtual since derived Handle types must not contain data or virtual methods.
95 ~RotationGestureDetector();
98 * @brief This copy constructor is required for (smart) pointer semantics.
100 * @param[in] handle A reference to the copied handle
102 RotationGestureDetector(const RotationGestureDetector& handle);
105 * @brief This assignment operator is required for (smart) pointer semantics.
107 * @param[in] rhs A reference to the copied handle
108 * @return A reference to this
110 RotationGestureDetector& operator=(const RotationGestureDetector& rhs);
115 * @brief This signal is emitted when the rotation gesture is detected on the attached actor.
117 * A callback of the following type may be connected:
119 * void YourCallbackName( Actor actor, const RotationGesture& gesture );
121 * @return The signal to connect to
122 * @pre The gesture detector has been initialized.
124 DetectedSignalType& DetectedSignal();
126 public: // Not intended for Application developers
130 * @brief This constructor is used by RotationGestureDetector::New() methods.
132 * @param[in] internal A pointer to a newly allocated Dali resource
134 explicit DALI_INTERNAL RotationGestureDetector(Internal::RotationGestureDetector* internal);
141 #endif // DALI_ROTATION_GESTURE_DETECTOR_H