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