1 #ifndef DALI_LONG_PRESS_GESTURE_H
2 #define DALI_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/public-api/events/gesture.h>
23 #include <dali/public-api/math/vector2.h>
28 namespace Internal DALI_INTERNAL
30 class LongPressGesture;
34 * @addtogroup dali_core_events
39 * @brief A LongPressGesture is emitted when the user touches and holds the screen with the stated number of fingers.
41 * This gesture can be in one of two states, when the long-press gesture is first detected: GestureState::STARTED
42 * and when the long-press gesture ends: GestureState::FINISHED.
44 * Long press gesture finishes when all touches have been released.
47 * @see LongPressGestureDetector
49 class DALI_CORE_API LongPressGesture : public Gesture
54 * @brief Creates an uninitialized LongPressGesture handle.
56 * Calling member functions with an uninitialized Actor handle is not allowed.
62 * @brief Copy constructor.
64 * @param[in] rhs A reference to the copied handle
66 LongPressGesture( const LongPressGesture& rhs );
69 * @brief Move constructor.
71 * @param[in] rhs A reference to the handle to move
73 LongPressGesture( LongPressGesture&& rhs );
76 * @brief Assignment operator.
78 * @param[in] rhs A reference to the copied handle
79 * @return A reference to this
81 LongPressGesture& operator=( const LongPressGesture& rhs );
84 * @brief Move assignment operator.
86 * @param[in] rhs A reference to the moved handle
87 * @return A reference to this
89 LongPressGesture& operator=( LongPressGesture&& rhs );
92 * @brief Non virtual destructor.
98 * @brief The number of touch points in this long press gesture.
100 * In other words, the number of fingers the user had on the screen to generate the long press gesture.
102 * @return The number of touch points
104 uint32_t GetNumberOfTouches() const;
107 * @brief This is the point, in screen coordinates, where the long press occurred.
109 * If a multi-touch long press, then this is the centroid of all the touch points.
111 * @return The point where the long press occurred (in screen coordinates)
113 const Vector2& GetScreenPoint() const;
116 * @brief This is the point, in local actor coordinates, where the long press occurred.
118 * If a multi-touch long press, then this is the centroid of all the touch points.
120 * @return The point where tap has occurred (in local actor coordinates)
122 const Vector2& GetLocalPoint() const;
124 public: // Not intended for application developers
128 * @brief This constructor is used internally to Create an initialized LongPressGesture handle.
130 * @param[in] longPressGesture A pointer to a newly allocated Dali resource
133 explicit DALI_INTERNAL LongPressGesture( Internal::LongPressGesture* longPressGesture );
143 #endif // DALI_LONG_PRESS_GESTURE_H