1 #ifndef DALI_INTERNAL_LONG_PRESS_GESTURE_H
2 #define DALI_INTERNAL_LONG_PRESS_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/internal/event/events/gesture-impl.h>
23 #include <dali/public-api/events/long-press-gesture.h>
24 #include <dali/public-api/math/vector2.h>
32 class LongPressGesture;
33 using LongPressGesturePtr = IntrusivePtr<LongPressGesture>;
36 * @copydoc Dali::LongPressGesture
38 class LongPressGesture final : public Gesture
44 * @param[in] state STARTED, when we detect a long press.
45 * FINISHED, when all touches are finished.
47 LongPressGesture( GestureState state )
48 : Gesture( GestureType::LONG_PRESS, state )
52 LongPressGesture(const LongPressGesture&) = delete; ///< Deleted copy constructor
53 LongPressGesture(LongPressGesture&&) = delete; ///< Deleted move constructor
54 LongPressGesture& operator=(const LongPressGesture&) = delete; ///< Deleted copy assignment operator
55 LongPressGesture& operator=(LongPressGesture&&) = delete; ///< Deleted move assignment operator
58 * @brief Set the number of touch points.
59 * @param[in] numberOfTouches The number of touch points to set.
61 inline void SetNumberOfTouches( uint32_t numberOfTouches )
63 mNumberOfTouches = numberOfTouches;
67 * @copydoc Dali::LongPressGesture::GetNumberOfTouches()
69 inline uint32_t GetNumberOfTouches() const
71 return mNumberOfTouches;
75 * @brief Set This is the point, in screen coordinates.
76 * @param[in] screenPoint The point in screen coordinates to set.
78 inline void SetScreenPoint( const Vector2& screenPoint )
80 mScreenPoint = screenPoint;
84 * @copydoc Dali::LongPressGesture::GetScreenPoint()
86 inline const Vector2& GetScreenPoint() const
92 * @brief Set This is the point, in local actor coordinates.
93 * @param[in] localPoint The point in local actor coordinates to set.
95 inline void SetLocalPoint( const Vector2& localPoint )
97 mLocalPoint = localPoint;
101 * @copydoc Dali::LongPressGesture::GetLocalPoint()
103 inline const Vector2& GetLocalPoint() const
111 * @brief Virtual destructor
113 * A reference counted object may only be deleted by calling Unreference()
115 virtual ~LongPressGesture() = default;
118 Vector2 mScreenPoint;
120 uint32_t mNumberOfTouches{1u};
123 } // namespace Internal
125 // Helpers for public-api forwarding methods
127 inline Internal::LongPressGesture& GetImplementation( Dali::LongPressGesture& longPressGesture )
129 DALI_ASSERT_ALWAYS( longPressGesture && "longPressGesture handle is empty" );
131 BaseObject& object = longPressGesture.GetBaseObject();
133 return static_cast< Internal::LongPressGesture& >( object );
136 inline const Internal::LongPressGesture& GetImplementation( const Dali::LongPressGesture& longPressGesture )
138 DALI_ASSERT_ALWAYS( longPressGesture && "longPressGesture handle is empty" );
140 const BaseObject& object = longPressGesture.GetBaseObject();
142 return static_cast< const Internal::LongPressGesture& >( object );
147 #endif // DALI_INTERNAL_LONG_PRESS_GESTURE_H