1 #ifndef DALI_INTERNAL_PINCH_GESTURE_H
2 #define DALI_INTERNAL_PINCH_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/pinch-gesture.h>
25 #include <dali/internal/event/events/gesture-impl.h>
34 typedef IntrusivePtr< PinchGesture > PinchGesturePtr;
37 * @copydoc Dali::PinchGesture
39 class PinchGesture final : public Gesture
44 * @brief Default constructor
46 PinchGesture( GestureState state )
47 : Gesture(GestureType::PINCH, state)
51 PinchGesture(const PinchGesture&) = delete; ///< Deleted copy constructor
52 PinchGesture(PinchGesture&&) = delete; ///< Deleted move constructor
53 PinchGesture& operator=(const PinchGesture&) = delete; ///< Deleted copy assignment operator
54 PinchGesture& operator=(PinchGesture&&) = delete; ///< Deleted move assignment operator
57 * @brief The scale factor from the start of the pinch gesture till the latest pinch gesture.
58 * @param[in] scale The scale to set.
60 inline void SetScale( float scale )
66 * @copydoc Dali::PinchGesture::GetScale()
68 inline float GetScale() const
74 * @brief The speed at which the user is moving their fingers.
75 * @param[in] speed The speed to set.
77 inline void SetSpeed( float speed )
83 * @copydoc Dali::PinchGesture::GetSpeed()
85 inline float GetSpeed() const
91 * @brief The center point of the two points that caused the pinch gesture in screen coordinates.
92 * @param[in] screenCenterPoint The point in screen coordinates to set.
94 inline void SetScreenCenterPoint( const Vector2& screenCenterPoint )
96 mScreenCenterPoint = screenCenterPoint;
100 * @copydoc Dali::PinchGesture::GetScreenCenterPoint()
102 inline const Vector2& GetScreenCenterPoint() const
104 return mScreenCenterPoint;
108 * @brief The center point of the two points that caused the pinch gesture in local actor coordinates.
109 * @param[in] localCenterPoint The point in local actor coordinates to set.
111 inline void SetLocalCenterPoint( const Vector2& localCenterPoint )
113 mLocalCenterPoint = localCenterPoint;
117 * @copydoc Dali::PinchGesture::GetLocalCenterPoint()
119 inline const Vector2& GetLocalCenterPoint() const
121 return mLocalCenterPoint;
127 * @brief Virtual destructor
129 * A reference counted object may only be deleted by calling Unreference()
131 virtual ~PinchGesture() = default;
134 Vector2 mScreenCenterPoint;
135 Vector2 mLocalCenterPoint;
140 } // namespace Internal
142 // Helpers for public-api forwarding methods
144 inline Internal::PinchGesture& GetImplementation( Dali::PinchGesture& pinchGesture )
146 DALI_ASSERT_ALWAYS( pinchGesture && "pinchGesture handle is empty" );
148 BaseObject& object = pinchGesture.GetBaseObject();
150 return static_cast< Internal::PinchGesture& >( object );
153 inline const Internal::PinchGesture& GetImplementation( const Dali::PinchGesture& pinchGesture )
155 DALI_ASSERT_ALWAYS( pinchGesture && "pinchGesture handle is empty" );
157 const BaseObject& object = pinchGesture.GetBaseObject();
159 return static_cast< const Internal::PinchGesture& >( object );
164 #endif // DALI_INTERNAL_PINCH_GESTURE_H