[dali_2.3.24] Merge branch 'devel/master'
[platform/core/uifw/dali-core.git] / dali / public-api / events / long-press-gesture.h
1 #ifndef DALI_LONG_PRESS_GESTURE_H
2 #define DALI_LONG_PRESS_GESTURE_H
3
4 /*
5  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/events/gesture.h>
23 #include <dali/public-api/math/vector2.h>
24
25 namespace Dali
26 {
27 namespace Internal DALI_INTERNAL
28 {
29 class LongPressGesture;
30 }
31
32 /**
33  * @addtogroup dali_core_events
34  * @{
35  */
36
37 /**
38  * @brief A LongPressGesture is emitted when the user touches and holds the screen with the stated number of fingers.
39  *
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.
42  *
43  * Long press gesture finishes when all touches have been released.
44  *
45  * @SINCE_1_9.28
46  * @see LongPressGestureDetector
47  */
48 class DALI_CORE_API LongPressGesture : public Gesture
49 {
50 public:
51   /**
52    * @brief Creates an uninitialized LongPressGesture handle.
53    *
54    * Calling member functions with an uninitialized Actor handle is not allowed.
55    * @SINCE_1_9.28
56    */
57   LongPressGesture();
58
59   /**
60    * @brief Copy constructor.
61    * @SINCE_1_9.28
62    * @param[in] rhs A reference to the copied handle
63    */
64   LongPressGesture(const LongPressGesture& rhs);
65
66   /**
67    * @brief Move constructor.
68    * @SINCE_1_9.28
69    * @param[in] rhs A reference to the handle to move
70    */
71   LongPressGesture(LongPressGesture&& rhs) noexcept;
72
73   /**
74    * @brief Assignment operator.
75    * @SINCE_1_9.28
76    * @param[in] rhs A reference to the copied handle
77    * @return A reference to this
78    */
79   LongPressGesture& operator=(const LongPressGesture& rhs);
80
81   /**
82    * @brief Move assignment operator.
83    * @SINCE_1_9.28
84    * @param[in] rhs A reference to the moved handle
85    * @return A reference to this
86    */
87   LongPressGesture& operator=(LongPressGesture&& rhs) noexcept;
88
89   /**
90    * @brief Non virtual destructor.
91    * @SINCE_1_9.28
92    */
93   ~LongPressGesture();
94
95   /**
96    * @brief The number of touch points in this long press gesture.
97    *
98    * In other words, the number of fingers the user had on the screen to generate the long press gesture.
99    * @SINCE_1_9.28
100    * @return The number of touch points
101    */
102   uint32_t GetNumberOfTouches() const;
103
104   /**
105    * @brief This is the point, in screen coordinates, where the long press occurred.
106    *
107    * If a multi-touch long press, then this is the centroid of all the touch points.
108    * @SINCE_1_9.28
109    * @return The point where the long press occurred (in screen coordinates)
110    */
111   const Vector2& GetScreenPoint() const;
112
113   /**
114    * @brief This is the point, in local actor coordinates, where the long press occurred.
115    *
116    * If a multi-touch long press, then this is the centroid of all the touch points.
117    * @SINCE_1_9.28
118    * @return The point where tap has occurred (in local actor coordinates)
119    */
120   const Vector2& GetLocalPoint() const;
121
122 public: // Not intended for application developers
123   /// @cond internal
124   /**
125    * @brief This constructor is used internally to Create an initialized LongPressGesture handle.
126    *
127    * @param[in] longPressGesture A pointer to a newly allocated Dali resource
128    * @SINCE_1_9.28
129    */
130   explicit DALI_INTERNAL LongPressGesture(Internal::LongPressGesture* longPressGesture);
131   /// @endcond
132 };
133
134 /**
135  * @}
136  */
137 } // namespace Dali
138
139 #endif // DALI_LONG_PRESS_GESTURE_H