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