1 #ifndef __DALI_TOUCH_POINT_H__
2 #define __DALI_TOUCH_POINT_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/actors/actor.h>
23 #include <dali/public-api/math/vector2.h>
28 * @addtogroup dali_core_events
33 * @brief A TouchPoint represents a point on the screen that is currently being touched
34 * or where touch has stopped.
37 struct DALI_IMPORT_API TouchPoint
47 Started, /**< Touch or hover started */
48 Finished, /**< Touch or hover finished */
49 Down = Started, /**< Screen touched */
50 Up = Finished, /**< Touch stopped */
51 Motion, /**< Finger dragged or hovered */
52 Leave, /**< Leave the boundary of an actor */
53 Stationary, /**< No change from last event. Useful when a multi-point event occurs where
54 all points are sent but indicates that this particular point has not changed
55 since the last time */
56 Interrupted, /**< A system event has occurred which has interrupted the touch or hover event sequence. */
57 Last /**< Number of states. */
60 // Construction & Destruction
66 * @param[in] id The touch device ID.
67 * @param[in] state The state.
68 * @param[in] screenX The X co-ordinate relative to the screen's origin.
69 * @param[in] screenY The Y co-ordinate relative to the screen's origin.
71 TouchPoint(int id, State state, float screenX, float screenY);
77 * @param[in] id The touch device ID.
78 * @param[in] state The state.
79 * @param[in] screenX The X co-ordinate relative to the screen's origin.
80 * @param[in] screenY The Y co-ordinate relative to the screen's origin.
81 * @param[in] localX The X co-ordinate relative to the top-left (0.0, 0.0, 0.5) of the actor.
82 * @param[in] localY The Y co-ordinate relative to the top-left (0.0, 0.0, 0.5) of the actor.
84 TouchPoint(int id, State state, float screenX, float screenY, float localX, float localY);
95 * @brief Each touch point has a unique device ID which specifies the touch device for that point.
100 * @brief State of the point.
107 * @brief The actor that was underneath the touch point.
112 * @brief The co-ordinates relative to the top-left of the hit-actor.
114 * @note The top-left of an actor is (0.0, 0.0, 0.5).
115 * @note If you require the local coordinates of another actor (e.g the parent of the hit actor),
116 * then you should use Actor::ScreenToLocal().
121 * @brief The co-ordinates relative to the top-left of the screen.
126 typedef std::vector<TouchPoint> TouchPointContainer; ///< Container of touch points. @since_tizen 2.4
127 typedef TouchPointContainer::iterator TouchPointContainerIterator; ///< Iterator for Dali::TouchPointContainer @since_tizen 2.4
128 typedef TouchPointContainer::const_iterator TouchPointContainerConstIterator; ///< Const iterator for Dali::TouchPointContainer @since_tizen 2.4
135 #endif // __DALI_TOUCH_POINT_H__