1 #ifndef DALI_INTERNAL_ROTATION_GESTURE_DETECTOR_H
2 #define DALI_INTERNAL_ROTATION_GESTURE_DETECTOR_H
5 * Copyright (c) 2020 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/rotation-gesture-detector.h>
23 #include <dali/public-api/events/rotation-gesture.h>
24 #include <dali/internal/event/events/gesture-detector-impl.h>
32 class RotationGestureDetector;
34 typedef IntrusivePtr<RotationGestureDetector> RotationGestureDetectorPtr;
35 typedef DerivedGestureDetectorContainer<RotationGestureDetector>::type RotationGestureDetectorContainer;
38 * @copydoc Dali::RotationGestureDetector
40 class RotationGestureDetector : public GestureDetector
45 * Create a new gesture detector.
46 * @return A smart-pointer to the newly allocated detector.
48 static RotationGestureDetectorPtr New();
51 * Construct a new GestureDetector.
53 RotationGestureDetector();
57 RotationGestureDetector( const RotationGestureDetector& ) = delete; ///< Deleted copy constructor
58 RotationGestureDetector& operator=(const RotationGestureDetector& rhs) = delete; ///< Deleted copy assignment operator
63 * Called by the RotationGestureProcessor when a rotation gesture event occurs within the bounds of our
65 * @param[in] actor The rotated actor
66 * @param[in] rotation The rotation gesture
68 void EmitRotationGestureSignal( Dali::Actor actor, const Dali::RotationGesture& rotation );
73 * @copydoc Dali::RotationGestureDetector::DetectedSignal()
75 Dali::RotationGestureDetector::DetectedSignalType& DetectedSignal()
77 return mDetectedSignal;
81 * Connects a callback function with the object's signals.
82 * @param[in] object The object providing the signal.
83 * @param[in] tracker Used to disconnect the signal.
84 * @param[in] signalName The signal to connect to.
85 * @param[in] functor A newly allocated FunctorDelegate.
86 * @return True if the signal was connected.
87 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
89 static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
94 * A reference counted object may only be deleted by calling Unreference()
96 virtual ~RotationGestureDetector() = default;
98 private: // GestureDetector overrides
101 * @copydoc Dali::Internal::GestureDetector::OnActorAttach(Actor&)
103 virtual void OnActorAttach( Actor& actor ) { /* Nothing to do */ }
106 * @copydoc Dali::Internal::GestureDetector::OnActorDetach(Actor&)
108 virtual void OnActorDetach( Actor& actor ) { /* Nothing to do */ }
111 * @copydoc Dali::Internal::GestureDetector::OnActorDestroyed(Object&)
113 virtual void OnActorDestroyed( Object& object ) { /* Nothing to do */ }
117 Dali::RotationGestureDetector::DetectedSignalType mDetectedSignal;
120 } // namespace Internal
122 // Helpers for public-api forwarding methods
124 inline Internal::RotationGestureDetector& GetImplementation( Dali::RotationGestureDetector& detector )
126 DALI_ASSERT_ALWAYS( detector && "RotationGestureDetector handle is empty" );
128 BaseObject& handle = detector.GetBaseObject();
130 return static_cast<Internal::RotationGestureDetector&>( handle );
133 inline const Internal::RotationGestureDetector& GetImplementation( const Dali::RotationGestureDetector& detector )
135 DALI_ASSERT_ALWAYS( detector && "RotationGestureDetector handle is empty" );
137 const BaseObject& handle = detector.GetBaseObject();
139 return static_cast<const Internal::RotationGestureDetector&>( handle );
144 #endif // DALI_INTERNAL_ROTATION_GESTURE_DETECTOR_H