Formatted API
[platform/core/uifw/dali-core.git] / dali / public-api / events / pinch-gesture.h
1 #ifndef DALI_PINCH_GESTURE_H
2 #define DALI_PINCH_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 PinchGesture;
30 }
31
32 /**
33  * @addtogroup dali_core_events
34  * @{
35  */
36
37 /**
38  * @brief A PinchGesture is emitted when the user moves two fingers towards or away from each other.
39  *
40  * This gesture can be in one of three states; when the pinch gesture is first detected, its
41  * state is set to GestureState::STARTED.  After this, if there is change in the gesture, the state will
42  * be GestureState::CONTINUING. Finally, when the gesture ends, the state of the gesture changes to
43  * GestureState::FINISHED.
44  *
45  * A pinch gesture will continue to be sent to the actor under the center point of the pinch
46  * until the pinch ends.
47  * @SINCE_1_9.28
48  */
49 class DALI_CORE_API PinchGesture : public Gesture
50 {
51 public:
52   /**
53    * @brief Creates an uninitialized PinchGesture handle.
54    *
55    * Calling member functions with an uninitialized Actor handle is not allowed.
56    * @SINCE_1_9.28
57    */
58   PinchGesture();
59
60   /**
61    * @brief Copy constructor.
62    * @SINCE_1_9.28
63    * @param[in] rhs A reference to the copied handle
64    */
65   PinchGesture(const PinchGesture& rhs);
66
67   /**
68    * @brief Move constructor.
69    * @SINCE_1_9.28
70    * @param[in] rhs A reference to the moved handle
71    */
72   PinchGesture(PinchGesture&& rhs);
73
74   /**
75    * @brief Assignment operator.
76    * @SINCE_1_9.28
77    * @param[in] rhs A reference to the copied handle
78    * @return A reference to this
79    */
80   PinchGesture& operator=(const PinchGesture& rhs);
81
82   /**
83    * @brief Assignment operator.
84    * @SINCE_1_9.28
85    * @param[in] rhs A reference to the moved handle
86    * @return A reference to this
87    */
88   PinchGesture& operator=(PinchGesture&& rhs);
89
90   /**
91    * @brief Non virtual destructor.
92    * @SINCE_1_9.28
93    */
94   ~PinchGesture();
95
96   /**
97    * @brief The scale factor from the start of the pinch gesture till the latest pinch gesture.
98    *
99    * If the user is moving their fingers away from each other, then this value increases.
100    * Conversely, if the user is moving their fingers towards each other, this value will
101    * decrease.
102    * @SINCE_1_9.28
103    * @return The scale of the pinch (from the pinch start)
104    */
105   float GetScale() const;
106
107   /**
108    * @brief The speed at which the user is moving their fingers.
109    *
110    * This is the pixel movement per second.
111    * @SINCE_1_9.28
112    * @return The speed of the pinch (pixels per second)
113    */
114   float GetSpeed() const;
115
116   /**
117    * @brief The center point of the two points that caused the pinch gesture in screen coordinates.
118    * @SINCE_1_9.28
119    * @return The current center point of the pinch (in screen coordinates)
120    */
121   const Vector2& GetScreenCenterPoint() const;
122
123   /**
124    * @brief The center point of the two points that caused the pinch gesture in local actor coordinates.
125    * @SINCE_1_9.28
126    * @return The current center point of the pinch (in local actor coordinates)
127    */
128   const Vector2& GetLocalCenterPoint() const;
129
130 public: // Not intended for application developers
131   /// @cond internal
132   /**
133    * @brief This constructor is used internally to Create an initialized PinchGesture handle.
134    *
135    * @param[in] PinchGesture A pointer to a newly allocated Dali resource
136    * @SINCE_1_9.28
137    */
138   explicit DALI_INTERNAL PinchGesture(Internal::PinchGesture* pinchGesture);
139   /// @endcond
140 };
141
142 /**
143  * @}
144  */
145 } // namespace Dali
146
147 #endif // DALI_PINCH_GESTURE_H