License conversion from Flora to Apache 2.0
[platform/core/uifw/dali-core.git] / capi / dali / public-api / events / touch-event.h
1 #ifndef __DALI_TOUCH_EVENT_H__
2 #define __DALI_TOUCH_EVENT_H__
3
4 /*
5  * Copyright (c) 2014 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 /**
22  * @addtogroup CAPI_DALI_EVENTS_MODULE
23  * @{
24  */
25
26 // INTERNAL INCLUDES
27 #include <dali/public-api/common/vector-wrapper.h>
28 #include <dali/public-api/common/dali-common.h>
29 #include <dali/public-api/events/touch-point.h>
30
31 namespace Dali DALI_IMPORT_API
32 {
33 typedef std::vector<TouchPoint> TouchPointContainer; ///< Container of touch points.
34 typedef TouchPointContainer::iterator TouchPointContainerIterator; ///< Iterator for Dali::TouchPointContainer
35 typedef TouchPointContainer::const_iterator TouchPointContainerConstIterator; ///< Const iterator for Dali::TouchPointContainer
36
37 /**
38  * @brief Touch events are a collection of touch points at a specific moment in time.
39  *
40  * When a multi-touch event occurs, each touch point represents the points that are currently being
41  * touched or the points where a touch has stopped.
42  */
43 struct DALI_IMPORT_API TouchEvent
44 {
45   // Construction & Destruction
46
47   /**
48    * @brief Default constructor
49    */
50   TouchEvent();
51
52   /**
53    * @brief Constructor
54    * @param[in]  time  The time the event occurred
55    */
56   TouchEvent(unsigned long time);
57
58   /**
59    * @brief Destructor
60    */
61   ~TouchEvent();
62
63   // Data
64
65   /**
66    * @brief This is a container of points for this touch event.
67    *
68    * The first point in the set is always the
69    * primary touch point (i.e. the first point touched in a multi-touch event).
70    */
71   TouchPointContainer points;
72
73   /**
74    * @brief The time (in ms) that the touch event occurred.
75    */
76   unsigned long time;
77
78   // Convenience Methods
79
80   /**
81    * @brief Returns the total number of points in this TouchEvent.
82    *
83    * @return Total number of Points.
84    */
85   unsigned int GetPointCount() const;
86
87   /**
88    * @brief Returns a touch point at the index requested.
89    *
90    * The first point in the set is always the primary
91    * touch point (i.e. the first point touched in a multi-touch event).
92    * @note "point" should be less than the value returned by GetPointCount().
93    *       If out of range, then program asserts.
94    * @param[in] point The index of the required Point.
95    * @return Point requested
96    */
97   const TouchPoint& GetPoint(unsigned int point) const;
98 };
99
100 } // namespace Dali
101
102 /**
103  * @}
104  */
105 #endif // __DALI_TOUCH_EVENT_H__