Clean up the code to build successfully on macOS
[platform/core/uifw/dali-core.git] / dali / integration-api / events / point.cpp
1 /*
2  * Copyright (c) 2020 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 #include <dali/public-api/events/mouse-button.h>
21
22 namespace Dali
23 {
24 namespace Integration
25 {
26 Point::Point()
27 : mTouchPoint(0, PointState::STARTED, 0.0f, 0.0f),
28   mEllipseRadius(),
29   mAngle(0.0f),
30   mDeviceClass(Device::Class::NONE),
31   mDeviceSubclass(Device::Subclass::NONE),
32   mPressure(1.0f),
33   mRadius(0.0f),
34   mMouseButton(MouseButton::INVALID)
35 {
36 }
37
38 Point::Point(const TouchPoint& touchPoint)
39 : mTouchPoint(touchPoint),
40   mEllipseRadius(),
41   mAngle(0.0f),
42   mDeviceClass(Device::Class::NONE),
43   mDeviceSubclass(Device::Subclass::NONE),
44   mPressure(1.0f),
45   mRadius(0.0f),
46   mMouseButton(MouseButton::INVALID)
47 {
48 }
49
50 Point::~Point()
51 {
52 }
53
54 void Point::SetDeviceId(int32_t deviceId)
55 {
56   mTouchPoint.deviceId = deviceId;
57 }
58
59 void Point::SetState(PointState::Type state)
60 {
61   mTouchPoint.state = static_cast<PointState::Type>(state);
62 }
63
64 void Point::SetScreenPosition(const Vector2& screenPosition)
65 {
66   mTouchPoint.screen = screenPosition;
67 }
68
69 void Point::SetRadius(float radius)
70 {
71   mRadius = mEllipseRadius.x = mEllipseRadius.y = radius;
72 }
73
74 void Point::SetRadius(float radius, Vector2 ellipseRadius)
75 {
76   mRadius        = radius;
77   mEllipseRadius = ellipseRadius;
78 }
79
80 void Point::SetPressure(float pressure)
81 {
82   mPressure = pressure;
83 }
84
85 void Point::SetAngle(Degree angle)
86 {
87   mAngle = angle;
88 }
89
90 int Point::GetDeviceId() const
91 {
92   return mTouchPoint.deviceId;
93 }
94
95 PointState::Type Point::GetState() const
96 {
97   return static_cast<PointState::Type>(mTouchPoint.state);
98 }
99
100 const Vector2& Point::GetScreenPosition() const
101 {
102   return mTouchPoint.screen;
103 }
104
105 float Point::GetRadius() const
106 {
107   return mRadius;
108 }
109
110 const Vector2& Point::GetEllipseRadius() const
111 {
112   return mEllipseRadius;
113 }
114
115 float Point::GetPressure() const
116 {
117   return mPressure;
118 }
119
120 Degree Point::GetAngle() const
121 {
122   return mAngle;
123 }
124
125 void Point::SetHitActor(Actor hitActor)
126 {
127   mTouchPoint.hitActor = hitActor;
128 }
129
130 void Point::SetLocalPosition(const Vector2& localPosition)
131 {
132   mTouchPoint.local = localPosition;
133 }
134
135 Actor Point::GetHitActor() const
136 {
137   return mTouchPoint.hitActor;
138 }
139
140 const Vector2& Point::GetLocalPosition() const
141 {
142   return mTouchPoint.local;
143 }
144
145 const TouchPoint& Point::GetTouchPoint() const
146 {
147   return mTouchPoint;
148 }
149
150 void Point::SetDeviceClass(Device::Class::Type deviceClass)
151 {
152   mDeviceClass = deviceClass;
153 }
154
155 void Point::SetDeviceSubclass(Device::Subclass::Type deviceSubclass)
156 {
157   mDeviceSubclass = deviceSubclass;
158 }
159
160 Device::Class::Type Point::GetDeviceClass() const
161 {
162   return mDeviceClass;
163 }
164
165 Device::Subclass::Type Point::GetDeviceSubclass() const
166 {
167   return mDeviceSubclass;
168 }
169
170 MouseButton::Type Point::GetMouseButton() const
171 {
172   return mMouseButton;
173 }
174
175 void Point::SetMouseButton(MouseButton::Type button)
176 {
177   mMouseButton = button;
178 }
179
180 } // namespace Integration
181
182 } // namespace Dali