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>
27 namespace Internal DALI_INTERNAL
29 class LongPressGesture;
33 * @addtogroup dali_core_events
38 * @brief A LongPressGesture is emitted when the user touches and holds the screen with the stated number of fingers.
40 * This gesture can be in one of two states, when the long-press gesture is first detected: GestureState::STARTED
41 * and when the long-press gesture ends: GestureState::FINISHED.
43 * Long press gesture finishes when all touches have been released.
46 * @see LongPressGestureDetector
48 class DALI_CORE_API LongPressGesture : public Gesture
52 * @brief Creates an uninitialized LongPressGesture handle.
54 * Calling member functions with an uninitialized Actor handle is not allowed.
60 * @brief Copy constructor.
62 * @param[in] rhs A reference to the copied handle
64 LongPressGesture(const LongPressGesture& rhs);
67 * @brief Move constructor.
69 * @param[in] rhs A reference to the handle to move
71 LongPressGesture(LongPressGesture&& rhs);
74 * @brief Assignment operator.
76 * @param[in] rhs A reference to the copied handle
77 * @return A reference to this
79 LongPressGesture& operator=(const LongPressGesture& rhs);
82 * @brief Move assignment operator.
84 * @param[in] rhs A reference to the moved handle
85 * @return A reference to this
87 LongPressGesture& operator=(LongPressGesture&& rhs);
90 * @brief Non virtual destructor.
96 * @brief The number of touch points in this long press gesture.
98 * In other words, the number of fingers the user had on the screen to generate the long press gesture.
100 * @return The number of touch points
102 uint32_t GetNumberOfTouches() const;
105 * @brief This is the point, in screen coordinates, where the long press occurred.
107 * If a multi-touch long press, then this is the centroid of all the touch points.
109 * @return The point where the long press occurred (in screen coordinates)
111 const Vector2& GetScreenPoint() const;
114 * @brief This is the point, in local actor coordinates, where the long press occurred.
116 * If a multi-touch long press, then this is the centroid of all the touch points.
118 * @return The point where tap has occurred (in local actor coordinates)
120 const Vector2& GetLocalPoint() const;
122 public: // Not intended for application developers
125 * @brief This constructor is used internally to Create an initialized LongPressGesture handle.
127 * @param[in] longPressGesture A pointer to a newly allocated Dali resource
130 explicit DALI_INTERNAL LongPressGesture(Internal::LongPressGesture* longPressGesture);
139 #endif // DALI_LONG_PRESS_GESTURE_H