[5.0] Add GetLogicalKey API in DevelKeyEvent
[platform/core/uifw/dali-core.git] / dali / integration-api / events / point.cpp
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/integration-api/events/point.h>
20
21 namespace Dali
22 {
23
24 namespace Integration
25 {
26
27 Point::Point()
28 : mTouchPoint( 0, TouchPoint::Started, 0.0f, 0.0f ),
29   mEllipseRadius(),
30   mAngle( 0.0f ),
31   mDeviceClass( Device::Class::NONE ),
32   mDeviceSubclass( Device::Subclass::NONE ),
33   mPressure( 1.0f ),
34   mRadius( 0.0f ),
35   mMouseButton( MouseButton::INVALID )
36 {
37 }
38
39 Point::Point( const TouchPoint& touchPoint )
40 : mTouchPoint( touchPoint ),
41   mEllipseRadius(),
42   mAngle( 0.0f ),
43   mDeviceClass( Device::Class::NONE ),
44   mDeviceSubclass( Device::Subclass::NONE ),
45   mPressure( 1.0f ),
46   mRadius( 0.0f ),
47   mMouseButton( MouseButton::INVALID )
48 {
49 }
50
51 Point::~Point()
52 {
53 }
54
55 void Point::SetDeviceId( int32_t deviceId )
56 {
57   mTouchPoint.deviceId = deviceId;
58 }
59
60 void Point::SetState( PointState::Type state )
61 {
62   mTouchPoint.state = static_cast< TouchPoint::State >( state );
63 }
64
65 void Point::SetScreenPosition( const Vector2& screenPosition )
66 {
67   mTouchPoint.screen = screenPosition;
68 }
69
70 void Point::SetRadius( float radius )
71 {
72   mRadius = mEllipseRadius.x = mEllipseRadius.y = radius;
73 }
74
75 void Point::SetRadius( float radius, Vector2 ellipseRadius )
76 {
77   mRadius = radius;
78   mEllipseRadius = ellipseRadius;
79 }
80
81 void Point::SetPressure( float pressure )
82 {
83   mPressure = pressure;
84 }
85
86 void Point::SetAngle( Degree angle )
87 {
88   mAngle = angle;
89 }
90
91 int Point::GetDeviceId() const
92 {
93   return mTouchPoint.deviceId;
94 }
95
96 PointState::Type Point::GetState() const
97 {
98   return static_cast< PointState::Type >( mTouchPoint.state );
99 }
100
101 const Vector2& Point::GetScreenPosition() const
102 {
103   return mTouchPoint.screen;
104 }
105
106 float Point::GetRadius() const
107 {
108   return mRadius;
109 }
110
111 const Vector2& Point::GetEllipseRadius() const
112 {
113   return mEllipseRadius;
114 }
115
116 float Point::GetPressure() const
117 {
118   return mPressure;
119 }
120
121 Degree Point::GetAngle() const
122 {
123   return mAngle;
124 }
125
126 void Point::SetHitActor( Actor hitActor )
127 {
128   mTouchPoint.hitActor = hitActor;
129 }
130
131 void Point::SetLocalPosition( const Vector2& localPosition )
132 {
133   mTouchPoint.local = localPosition;
134 }
135
136 Actor Point::GetHitActor() const
137 {
138   return mTouchPoint.hitActor;
139 }
140
141 const Vector2& Point::GetLocalPosition() const
142 {
143   return mTouchPoint.local;
144 }
145
146 const TouchPoint& Point::GetTouchPoint() const
147 {
148   return mTouchPoint;
149 }
150
151 void Point::SetDeviceClass( Device::Class::Type deviceClass )
152 {
153   mDeviceClass = deviceClass;
154 }
155
156 void Point::SetDeviceSubclass( Device::Subclass::Type deviceSubclass )
157 {
158   mDeviceSubclass = deviceSubclass;
159 }
160
161 Device::Class::Type Point::GetDeviceClass() const
162 {
163   return mDeviceClass;
164 }
165
166 Device::Subclass::Type Point::GetDeviceSubclass() const
167 {
168   return mDeviceSubclass;
169 }
170
171 MouseButton::Type Point::GetMouseButton() const
172 {
173   return mMouseButton;
174 }
175
176 void Point::SetMouseButton(MouseButton::Type button)
177 {
178   mMouseButton = button;
179 }
180
181
182 } // namespace Integration
183
184 } // namespace Dali