1 #ifndef DALI_INTERNAL_ROTATION_GESTURE_DETECTOR_H
2 #define DALI_INTERNAL_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/internal/event/events/gesture-detector-impl.h>
23 #include <dali/devel-api/events/rotation-gesture-detector.h>
28 class RotationGesture;
33 class RotationGestureDetector;
35 typedef IntrusivePtr<RotationGestureDetector> RotationGestureDetectorPtr;
36 typedef DerivedGestureDetectorContainer<RotationGestureDetector>::type RotationGestureDetectorContainer;
39 * @copydoc Dali::RotationGestureDetector
41 class RotationGestureDetector : public GestureDetector
46 * Create a new gesture detector.
47 * @return A smart-pointer to the newly allocated detector.
49 static RotationGestureDetectorPtr New();
52 * Construct a new GestureDetector.
54 RotationGestureDetector();
58 RotationGestureDetector( const RotationGestureDetector& ) = delete; ///< Deleted copy constructor
59 RotationGestureDetector& operator=(const RotationGestureDetector& rhs) = delete; ///< Deleted copy assignment operator
64 * Called by the RotationGestureProcessor when a rotation gesture event occurs within the bounds of our
66 * @param[in] actor The rotated actor
67 * @param[in] rotation The rotation gesture
69 void EmitRotationGestureSignal( Dali::Actor actor, const RotationGesture& rotation );
74 * @copydoc Dali::RotationGestureDetector::DetectedSignal()
76 Dali::RotationGestureDetector::DetectedSignalType& DetectedSignal()
78 return mDetectedSignal;
82 * Connects a callback function with the object's signals.
83 * @param[in] object The object providing the signal.
84 * @param[in] tracker Used to disconnect the signal.
85 * @param[in] signalName The signal to connect to.
86 * @param[in] functor A newly allocated FunctorDelegate.
87 * @return True if the signal was connected.
88 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
90 static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
95 * A reference counted object may only be deleted by calling Unreference()
97 virtual ~RotationGestureDetector() = default;
99 private: // GestureDetector overrides
102 * @copydoc Dali::Internal::GestureDetector::OnActorAttach(Actor&)
104 virtual void OnActorAttach( Actor& actor ) { /* Nothing to do */ }
107 * @copydoc Dali::Internal::GestureDetector::OnActorDetach(Actor&)
109 virtual void OnActorDetach( Actor& actor ) { /* Nothing to do */ }
112 * @copydoc Dali::Internal::GestureDetector::OnActorDestroyed(Object&)
114 virtual void OnActorDestroyed( Object& object ) { /* Nothing to do */ }
118 Dali::RotationGestureDetector::DetectedSignalType mDetectedSignal;
121 } // namespace Internal
123 // Helpers for public-api forwarding methods
125 inline Internal::RotationGestureDetector& GetImplementation( Dali::RotationGestureDetector& detector )
127 DALI_ASSERT_ALWAYS( detector && "RotationGestureDetector handle is empty" );
129 BaseObject& handle = detector.GetBaseObject();
131 return static_cast<Internal::RotationGestureDetector&>( handle );
134 inline const Internal::RotationGestureDetector& GetImplementation( const Dali::RotationGestureDetector& detector )
136 DALI_ASSERT_ALWAYS( detector && "RotationGestureDetector handle is empty" );
138 const BaseObject& handle = detector.GetBaseObject();
140 return static_cast<const Internal::RotationGestureDetector&>( handle );
145 #endif // DALI_INTERNAL_ROTATION_GESTURE_DETECTOR_H