Revert "[Tizen] Not execute the remove callback"
[platform/core/uifw/dali-core.git] / dali / internal / event / events / hover-event-impl.cpp
1 /*
2  * Copyright (c) 2021 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/internal/event/events/hover-event-impl.h>
20
21 namespace Dali
22 {
23 namespace Internal
24 {
25 HoverEvent::HoverEvent()
26 : mPoints(),
27   mTime(0)
28 {
29 }
30
31 HoverEvent::HoverEvent(unsigned long time)
32 : mPoints(),
33   mTime(time)
34 {
35 }
36
37 HoverEventPtr HoverEvent::Clone(const HoverEvent& rhs)
38 {
39   HoverEventPtr hoverEvent(new HoverEvent);
40   hoverEvent->mPoints = rhs.mPoints;
41   hoverEvent->mTime   = rhs.mTime;
42   return hoverEvent;
43 }
44
45 unsigned long HoverEvent::GetTime() const
46 {
47   return mTime;
48 }
49
50 std::size_t HoverEvent::GetPointCount() const
51 {
52   return mPoints.size();
53 }
54
55 int32_t HoverEvent::GetDeviceId(std::size_t point) const
56 {
57   if(point < mPoints.size())
58   {
59     return mPoints[point].GetDeviceId();
60   }
61   return -1;
62 }
63
64 PointState::Type HoverEvent::GetState(std::size_t point) const
65 {
66   if(point < mPoints.size())
67   {
68     return mPoints[point].GetState();
69   }
70   return PointState::FINISHED;
71 }
72
73 Dali::Actor HoverEvent::GetHitActor(std::size_t point) const
74 {
75   if(point < mPoints.size())
76   {
77     return mPoints[point].GetHitActor();
78   }
79   return Dali::Actor();
80 }
81
82 const Vector2& HoverEvent::GetLocalPosition(std::size_t point) const
83 {
84   if(point < mPoints.size())
85   {
86     return mPoints[point].GetLocalPosition();
87   }
88   return Vector2::ZERO;
89 }
90
91 const Vector2& HoverEvent::GetScreenPosition(std::size_t point) const
92 {
93   if(point < mPoints.size())
94   {
95     return mPoints[point].GetScreenPosition();
96   }
97   return Vector2::ZERO;
98 }
99
100 const Integration::Point& HoverEvent::GetPoint(std::size_t point) const
101 {
102   DALI_ASSERT_DEBUG(point < mPoints.size() && "No point at index");
103   return mPoints[point];
104 }
105
106 Integration::Point& HoverEvent::GetPoint(std::size_t point)
107 {
108   DALI_ASSERT_DEBUG(point < mPoints.size() && "No point at index");
109   return mPoints[point];
110 }
111
112 void HoverEvent::AddPoint(const Integration::Point& point)
113 {
114   mPoints.push_back(point);
115 }
116
117 } // namespace Internal
118
119 } // namespace Dali