Added move semantics to TouchEvent & fixed some other internal event classes
[platform/core/uifw/dali-core.git] / dali / internal / event / events / wheel-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/wheel-event-impl.h>
20
21 namespace Dali
22 {
23
24 namespace
25 {
26 const uint32_t MODIFIER_SHIFT = 0x1;
27 const uint32_t MODIFIER_CTRL  = 0x2;
28 const uint32_t MODIFIER_ALT   = 0x4;
29 }
30
31 namespace Internal
32 {
33
34 WheelEvent::WheelEvent()
35 : mType( Dali::WheelEvent::MOUSE_WHEEL ),
36   mDirection( 0 ),
37   mModifiers( 0 ),
38   mPoint( Vector2::ZERO ),
39   mDelta( 0 ),
40   mTimeStamp( 0 )
41 {
42 }
43
44 WheelEvent::WheelEvent( Dali::WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp )
45 : mType( type ),
46   mDirection( direction ),
47   mModifiers( modifiers ),
48   mPoint( point ),
49   mDelta( delta ),
50   mTimeStamp( timeStamp )
51 {
52 }
53
54 WheelEventPtr WheelEvent::New( Dali::WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp )
55 {
56   WheelEventPtr wheelEvent = new WheelEvent( type, direction, modifiers, point, delta, timeStamp );
57   return wheelEvent;
58 }
59
60 bool WheelEvent::IsShiftModifier() const
61 {
62   return ( ( MODIFIER_SHIFT & mModifiers ) == MODIFIER_SHIFT );
63 }
64
65 bool WheelEvent::IsCtrlModifier() const
66 {
67   return ( ( MODIFIER_CTRL & mModifiers ) == MODIFIER_CTRL );
68 }
69
70 bool WheelEvent::IsAltModifier() const
71 {
72   return ( ( MODIFIER_ALT & mModifiers ) == MODIFIER_ALT );
73 }
74
75 Dali::WheelEvent::Type WheelEvent::GetType() const
76 {
77   return mType;
78 }
79
80 int32_t WheelEvent::GetDirection() const
81 {
82   return mDirection;
83 }
84
85 uint32_t WheelEvent::GetModifiers() const
86 {
87   return mModifiers;
88 }
89
90 const Vector2& WheelEvent::GetPoint() const
91 {
92   return mPoint;
93 }
94
95 int32_t WheelEvent::GetDelta() const
96 {
97   return mDelta;
98 }
99
100 uint32_t WheelEvent::GetTime() const
101 {
102   return mTimeStamp;
103 }
104
105 } // namsespace Internal
106
107 } // namespace Dali