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