Add missed doxygen documentation
[platform/core/uifw/dali-core.git] / dali / public-api / events / touch-data.h
1 #ifndef __DALI_TOUCH_DATA_H__
2 #define __DALI_TOUCH_DATA_H__
3
4 /*
5  * Copyright (c) 2016 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 // EXTERNAL INCLUDES
22 #include <stdint.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/common/dali-common.h>
26 #include <dali/public-api/events/point-state.h>
27 #include <dali/public-api/object/base-handle.h>
28 #include <dali/public-api/math/degree.h>
29
30 namespace Dali
31 {
32
33 namespace Internal DALI_INTERNAL
34 {
35 class TouchData;
36 }
37
38 /**
39  * @addtogroup dali_core_events
40  * @{
41  */
42
43 class Actor;
44 struct Vector2;
45
46 /**
47  * @brief Touch events are a collection of points at a specific moment in time.
48  *
49  * When a multi-touch event occurs, each point represents the points that are currently being
50  * touched or the points where a touch has stopped.
51  *
52  * The first point is the primary point that's used for hit-testing.
53  * @SINCE_1_1.37
54  * @note Should not use this in a TouchData container as it is just a handle and the internal object can change.
55  */
56 class DALI_IMPORT_API TouchData : public BaseHandle
57 {
58 public:
59
60   // Construction & Destruction
61
62   /**
63    * @brief An uninitialized TouchData instance.
64    *
65    * Calling member functions with an uninitialized TouchData handle is not allowed.
66    * @SINCE_1_1.37
67    */
68   TouchData();
69
70   /**
71    * @brief Copy constructor
72    *
73    * @SINCE_1_1.37
74    * @param[in]  other  The TouchData to copy from.
75    */
76   TouchData( const TouchData& other );
77
78   /**
79    * @brief Destructor
80    *
81    * @SINCE_1_1.37
82    */
83   ~TouchData();
84
85   // Operators
86
87   /**
88    * @brief Assignment Operator
89    *
90    * @SINCE_1_1.37
91    * @param[in]  other  The TouchData to copy from.
92    * @return A reference to this
93    */
94   TouchData& operator=( const TouchData& other );
95
96   // Getters
97
98   /**
99    * @brief Returns the time (in ms) that the touch event occurred.
100    *
101    * @SINCE_1_1.37
102    * @return The time (in ms) that the touch event occurred.
103    */
104   unsigned long GetTime() const;
105
106   /**
107    * @brief Returns the total number of points in this TouchData.
108    *
109    * @SINCE_1_1.37
110    * @return Total number of Points.
111    */
112   std::size_t GetPointCount() const;
113
114   /**
115    * @brief Returns the ID of the device used for the Point specified.
116    *
117    * Each point has a unique device ID which specifies the device used for that
118    * point. This is returned by this method.
119    *
120    * @SINCE_1_1.37
121    * @param[in]  point  The point required.
122    * @return The Device ID of this point.
123    * @note If point is greater than GetPointCount() then this method will return -1.
124    */
125   int32_t GetDeviceId( std::size_t point ) const;
126
127   /**
128    * @brief Retrieves the State of the point specified.
129    *
130    * @SINCE_1_1.37
131    * @param[in]  point  The point required.
132    * @return The state of the point specified.
133    * @note If point is greater than GetPointCount() then this method will return PointState::FINISHED.
134    * @see State
135    */
136   PointState::Type GetState( std::size_t point ) const;
137
138   /**
139    * @brief Retrieve the actor that was underneath the point specified.
140    *
141    * @SINCE_1_1.37
142    * @param[in]  point  The point required.
143    * @return The actor that was underneath the point specified.
144    * @note If point is greater than GetPointCount() then this method will return an empty handle.
145    */
146   Actor GetHitActor( std::size_t point ) const;
147
148   /**
149    * @brief Retrieve the co-ordinates relative to the top-left of the hit-actor at the point specified.
150    *
151    * @SINCE_1_1.37
152    * @param[in]  point  The point required.
153    * @return The co-ordinates relative to the top-left of the hit-actor of the point specified.
154    *
155    * @note The top-left of an actor is (0.0, 0.0, 0.5).
156    * @note If you require the local coordinates of another actor (e.g the parent of the hit actor),
157    * then you should use Actor::ScreenToLocal().
158    * @note If point is greater than GetPointCount() then this method will return Vector2::ZERO.
159    */
160   const Vector2& GetLocalPosition( std::size_t point ) const;
161
162   /**
163    * @brief Retrieves the co-ordinates relative to the top-left of the screen of the point specified.
164    *
165    * @SINCE_1_1.37
166    * @param[in]  point  The point required.
167    * @return The co-ordinates relative to the top-left of the screen of the point specified.
168    * @note If point is greater than GetPointCount() then this method will return Vector2::ZERO.
169    */
170   const Vector2& GetScreenPosition( std::size_t point ) const;
171
172   /**
173    * @brief Retrieve the radius of the press point.
174    *
175    * This is the average of both the horizontal and vertical radii of the press point.
176    *
177    * @SINCE_1_1.39
178    * @param[in]  point  The point required.
179    * @return The radius of the press point.
180    * @note If point is greater than GetPointCount() then this method will return 0.0f.
181    */
182   float GetRadius( std::size_t point ) const;
183
184   /**
185    * @brief Retrieve BOTH the horizontal and the vertical radii of the press point.
186    *
187    * @SINCE_1_1.39
188    * @param[in]  point  The point required.
189    * @return The horizontal and vertical radii of the press point.
190    * @note If point is greater than GetPointCount() then this method will return Vector2::ZERO.
191    */
192   const Vector2& GetEllipseRadius( std::size_t point ) const;
193
194   /**
195    * @brief Retrieve the touch pressure.
196    *
197    * The pressure range starts at 0.0f.
198    * Normal pressure is defined as 1.0f.
199    * A value between 0.0f and 1.0f means light pressure has been applied.
200    * A value greater than 1.0f means more pressure than normal has been applied.
201    *
202    * @SINCE_1_1.39
203    * @param[in]  point  The point required.
204    * @return The touch pressure.
205    * @note If point is greater than GetPointCount() then this method will return 1.0f.
206    */
207   float GetPressure( std::size_t point ) const;
208
209   /**
210    * @brief Retrieve the angle of the press point relative to the Y-Axis.
211    *
212    * @SINCE_1_1.39
213    * @param[in]  point  The point required.
214    * @return The angle of the press point.
215    * @note If point is greater than GetPointCount() then this method will return Degree().
216    */
217   Degree GetAngle( std::size_t point ) const;
218
219 public: // Not intended for application developers
220
221   /// @cond internal
222   /**
223    * @brief This constructor is used internally to Create an initialized TouchData handle.
224    *
225    * @SINCE_1_1.37
226    * @param [in] touchData A pointer to a newly allocated Dali resource
227    */
228   explicit DALI_INTERNAL TouchData( Internal::TouchData* touchData );
229   /// @endcond
230 };
231
232 /**
233  * @}
234  */
235 } // namespace Dali
236
237 #endif // __DALI_TOUCH_DATA_H__