1 #ifndef DALI_INTERNAL_LONG_PRESS_GESTURE_H
2 #define DALI_INTERNAL_LONG_PRESS_GESTURE_H
5 * Copyright (c) 2021 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>
30 class LongPressGesture;
31 using LongPressGesturePtr = IntrusivePtr<LongPressGesture>;
34 * @copydoc Dali::LongPressGesture
36 class LongPressGesture final : public Gesture
41 * @param[in] state STARTED, when we detect a long press.
42 * FINISHED, when all touches are finished.
44 LongPressGesture(GestureState state)
45 : Gesture(GestureType::LONG_PRESS, state)
49 LongPressGesture(const LongPressGesture&) = delete; ///< Deleted copy constructor
50 LongPressGesture(LongPressGesture&&) = delete; ///< Deleted move constructor
51 LongPressGesture& operator=(const LongPressGesture&) = delete; ///< Deleted copy assignment operator
52 LongPressGesture& operator=(LongPressGesture&&) = delete; ///< Deleted move assignment operator
55 * @brief Set the number of touch points.
56 * @param[in] numberOfTouches The number of touch points to set.
58 inline void SetNumberOfTouches(uint32_t numberOfTouches)
60 mNumberOfTouches = numberOfTouches;
64 * @copydoc Dali::LongPressGesture::GetNumberOfTouches()
66 inline uint32_t GetNumberOfTouches() const
68 return mNumberOfTouches;
72 * @brief Set This is the point, in screen coordinates.
73 * @param[in] screenPoint The point in screen coordinates to set.
75 inline void SetScreenPoint(const Vector2& screenPoint)
77 mScreenPoint = screenPoint;
81 * @copydoc Dali::LongPressGesture::GetScreenPoint()
83 inline const Vector2& GetScreenPoint() const
89 * @brief Set This is the point, in local actor coordinates.
90 * @param[in] localPoint The point in local actor coordinates to set.
92 inline void SetLocalPoint(const Vector2& localPoint)
94 mLocalPoint = localPoint;
98 * @copydoc Dali::LongPressGesture::GetLocalPoint()
100 inline const Vector2& GetLocalPoint() const
107 * @brief Virtual destructor
109 * A reference counted object may only be deleted by calling Unreference()
111 ~LongPressGesture() override = default;
114 Vector2 mScreenPoint;
116 uint32_t mNumberOfTouches{1u};
119 } // namespace Internal
121 // Helpers for public-api forwarding methods
123 inline Internal::LongPressGesture& GetImplementation(Dali::LongPressGesture& longPressGesture)
125 DALI_ASSERT_ALWAYS(longPressGesture && "longPressGesture handle is empty");
127 BaseObject& object = longPressGesture.GetBaseObject();
129 return static_cast<Internal::LongPressGesture&>(object);
132 inline const Internal::LongPressGesture& GetImplementation(const Dali::LongPressGesture& longPressGesture)
134 DALI_ASSERT_ALWAYS(longPressGesture && "longPressGesture handle is empty");
136 const BaseObject& object = longPressGesture.GetBaseObject();
138 return static_cast<const Internal::LongPressGesture&>(object);
143 #endif // DALI_INTERNAL_LONG_PRESS_GESTURE_H