Doxygen grouping
[platform/core/uifw/dali-core.git] / dali / public-api / events / touch-point.h
1 #ifndef __DALI_TOUCH_POINT_H__
2 #define __DALI_TOUCH_POINT_H__
3
4 /*
5  * Copyright (c) 2015 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/actors/actor.h>
23 #include <dali/public-api/math/vector2.h>
24
25 namespace Dali
26 {
27 /**
28  * @addtogroup dali-core-events
29  * @{
30  */
31
32 /**
33  * @brief A TouchPoint represents a point on the screen that is currently being touched
34  * or where touch has stopped.
35  */
36 struct DALI_IMPORT_API TouchPoint
37 {
38   // Enumerations
39
40   /**
41    * @brief Touch state
42    */
43   enum State
44   {
45     Started,        /**< Touch or hover started */
46     Finished,       /**< Touch or hover finished */
47     Down = Started, /**< Screen touched */
48     Up = Finished,  /**< Touch stopped */
49     Motion,         /**< Finger dragged or hovered */
50     Leave,          /**< Leave the boundary of an actor */
51     Stationary,     /**< No change from last event.  Useful when a multi-point event occurs where
52                          all points are sent but indicates that this particular point has not changed
53                          since the last time */
54     Interrupted,    /**< A system event has occurred which has interrupted the touch or hover event sequence. */
55     Last            /**< Number of states. */
56   };
57
58   // Construction & Destruction
59
60   /**
61    * @brief Constructor
62    *
63    * @param[in]  id       The touch device ID.
64    * @param[in]  state    The state.
65    * @param[in]  screenX  The X co-ordinate relative to the screen's origin.
66    * @param[in]  screenY  The Y co-ordinate relative to the screen's origin.
67    */
68   TouchPoint(int id, State state, float screenX, float screenY);
69
70   /**
71    * @brief Constructor
72    *
73    * @param[in]  id       The touch device ID.
74    * @param[in]  state    The state.
75    * @param[in]  screenX  The X co-ordinate relative to the screen's origin.
76    * @param[in]  screenY  The Y co-ordinate relative to the screen's origin.
77    * @param[in]  localX   The X co-ordinate relative to the top-left (0.0, 0.0, 0.5) of the actor.
78    * @param[in]  localY   The Y co-ordinate relative to the top-left (0.0, 0.0, 0.5) of the actor.
79    */
80   TouchPoint(int id, State state, float screenX, float screenY, float localX, float localY);
81
82   /**
83    * @brief Destructor
84    */
85   ~TouchPoint();
86
87   // Data
88
89   /**
90    * @brief Each touch point has a unique device ID which specifies the touch device for that point.
91    */
92   int deviceId;
93
94   /**
95    * @brief State of the point.
96    *
97    * @see State
98    */
99   State state;
100
101   /**
102    * @brief The actor that was underneath the touch point.
103    */
104   Actor hitActor;
105
106   /**
107    * @brief The co-ordinates relative to the top-left of the hit-actor.
108    *
109    * @note The top-left of an actor is (0.0, 0.0, 0.5).
110    * @note If you require the local coordinates of another actor (e.g the parent of the hit actor),
111    * then you should use Actor::ScreenToLocal().
112    */
113   Vector2 local;
114
115   /**
116    * @brief The co-ordinates relative to the top-left of the screen.
117    */
118   Vector2 screen;
119 };
120
121 typedef std::vector<TouchPoint> TouchPointContainer; ///< Container of touch points.
122 typedef TouchPointContainer::iterator TouchPointContainerIterator; ///< Iterator for Dali::TouchPointContainer
123 typedef TouchPointContainer::const_iterator TouchPointContainerConstIterator; ///< Const iterator for Dali::TouchPointContainer
124
125 /**
126  * @}
127  */
128 } // namespace Dali
129
130 #endif // __DALI_TOUCH_POINT_H__