1 #ifndef DALI_INTERNAL_ROTATION_GESTURE_H
2 #define DALI_INTERNAL_ROTATION_GESTURE_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/math/vector2.h>
23 #include <dali/public-api/object/base-object.h>
24 #include <dali/public-api/events/rotation-gesture.h>
25 #include <dali/internal/event/events/gesture-impl.h>
33 class RotationGesture;
34 using RotationGesturePtr = IntrusivePtr<RotationGesture>;
37 * @copydoc Dali::RotationGesture
39 class RotationGesture final : public Gesture
44 * @brief Default constructor
46 RotationGesture( GestureState state )
47 : Gesture( GestureType::ROTATION, state )
51 RotationGesture(const RotationGesture&) = delete; ///< Deleted copy constructor
52 RotationGesture(RotationGesture&&) = delete; ///< Deleted move constructor
53 RotationGesture& operator=(const RotationGesture&) = delete; ///< Deleted copy assignment operator
54 RotationGesture& operator=(RotationGesture&&) = delete; ///< Deleted move assignment operator
57 * @brief The overall rotation from the start of the rotation gesture till the latest rotation gesture.
58 * @param[in] rotation The rotation to set.
60 inline void SetRotation( const Radian& rotation )
66 * @copydoc Dali::RotationGesture::GetRotation()
68 inline const Radian& GetRotation() const
74 * @brief The center point of the two points that caused the rotation gesture in screen coordinates.
75 * @param[in] screenCenterPoint The point in screen coordinates to set.
77 inline void SetScreenCenterPoint( const Vector2& screenCenterPoint )
79 mScreenCenterPoint = screenCenterPoint;
83 * @copydoc Dali::RotationGesture::GetScreenCenterPoint()
85 inline const Vector2& GetScreenCenterPoint() const
87 return mScreenCenterPoint;
91 * @brief The center point of the two points that caused the rotation gesture in local actor coordinates.
92 * @param[in] localCenterPoint The point in local actor coordinates to set.
94 inline void SetLocalCenterPoint( const Vector2& localCenterPoint )
96 mLocalCenterPoint = localCenterPoint;
100 * @copydoc Dali::RotationGesture::GetLocalCenterPoint()
102 inline const Vector2& GetLocalCenterPoint() const
104 return mLocalCenterPoint;
110 * @brief Virtual destructor
112 * A reference counted object may only be deleted by calling Unreference()
114 virtual ~RotationGesture() = default;
118 Vector2 mScreenCenterPoint;
119 Vector2 mLocalCenterPoint;
122 } // namespace Internal
124 // Helpers for public-api forwarding methods
126 inline Internal::RotationGesture& GetImplementation( Dali::RotationGesture& rotationGesture )
128 DALI_ASSERT_ALWAYS( rotationGesture && "rotationGesture handle is empty" );
130 BaseObject& object = rotationGesture.GetBaseObject();
132 return static_cast< Internal::RotationGesture& >( object );
135 inline const Internal::RotationGesture& GetImplementation( const Dali::RotationGesture& rotationGesture )
137 DALI_ASSERT_ALWAYS( rotationGesture && "rotationGesture handle is empty" );
139 const BaseObject& object = rotationGesture.GetBaseObject();
141 return static_cast< const Internal::RotationGesture& >( object );
146 #endif // DALI_INTERNAL_ROTATION_GESTURE_H