Replaces TextArray type definition.
[platform/core/uifw/dali-core.git] / dali / integration-api / events / touch-data.h
1 #ifndef __DALI_INTEGRATION_TOUCH_DATA_H__
2 #define __DALI_INTEGRATION_TOUCH_DATA_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 #include <dali/public-api/common/vector-wrapper.h>
21
22 namespace Dali
23 {
24
25 namespace Integration
26 {
27
28 struct TouchData;
29
30 typedef std::vector<TouchData> TouchDataContainer;
31 typedef TouchDataContainer::iterator TouchDataIter;
32
33 /**
34  * TouchData structure
35  * represents the raw touch information from touch-screen for
36  * a single touch event e.g.
37  *
38  * "First finger touching down at pixel 123,456 on the screen (relative
39  * to top left corner of phone in portrait mode). at timestamp 125ms (from a reference
40  * timestamp e.g. phone boot being 0secs)."
41  * TouchData(Down, 125, 0, 123, 456)
42  *
43  * "Above finger moving to pixel 133,457, at timestamp 150ms"
44  * TouchData(Motion, 150, 0, 133, 457)
45  *
46  * "Additional finger touching down at pixel 50, 75, at timestamp 175ms"
47  * TouchData(Down, 175, 1, 50, 75)
48  *
49  * "First finger removing at pixel 143, 458, at timestamp 200ms"
50  * TouchData(Up, 200, 0, 143, 458)
51  *
52  * "Additional finger removing at pixel 51, 77, at timestamp 225ms"
53  * TouchData(Up, 225, 1, 51, 77)
54  *
55  * Note: Multiple incidents of touch data can be present at the same timestamp.
56  */
57 struct TouchData
58 {
59
60   /**
61    * The Touch Type for this data.
62    */
63   enum TouchType
64   {
65     Down,     // Touch started
66     Up,       // Touch ended
67     Motion    // Touch is continuing
68   };
69
70   TouchData()
71   : type(Motion),
72     timestamp(0u),
73     index(0u),
74     x(0),
75     y(0)
76   {
77
78   }
79
80   TouchData(TouchType type,
81             unsigned int timestamp,
82             unsigned int index,
83             int x,
84             int y)
85   : type(type),
86     timestamp(timestamp),
87     index(index),
88     x(x),
89     y(y)
90   {
91   }
92
93   TouchType type;
94   unsigned int timestamp;
95   unsigned int index;
96   int x;
97   int y;
98
99 };
100
101 } // namespace Integration
102
103 } // namespace Dali
104
105 #endif // __DALI_INTEGRATION_TOUCH_DATA_H__