Revert "Revert "WheelEvent class pimpling""
[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 WheelEvent::~WheelEvent()
55 {
56 }
57
58 WheelEventPtr WheelEvent::New( Dali::WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp )
59 {
60   WheelEventPtr wheelEvent = new WheelEvent( type, direction, modifiers, point, delta, timeStamp );
61   return wheelEvent;
62 }
63
64 bool WheelEvent::IsShiftModifier() const
65 {
66   return ( ( MODIFIER_SHIFT & mModifiers ) == MODIFIER_SHIFT );
67 }
68
69 bool WheelEvent::IsCtrlModifier() const
70 {
71   return ( ( MODIFIER_CTRL & mModifiers ) == MODIFIER_CTRL );
72 }
73
74 bool WheelEvent::IsAltModifier() const
75 {
76   return ( ( MODIFIER_ALT & mModifiers ) == MODIFIER_ALT );
77 }
78
79 Dali::WheelEvent::Type WheelEvent::GetType() const
80 {
81   return mType;
82 }
83
84 int32_t WheelEvent::GetDirection() const
85 {
86   return mDirection;
87 }
88
89 uint32_t WheelEvent::GetModifiers() const
90 {
91   return mModifiers;
92 }
93
94 const Vector2& WheelEvent::GetPoint() const
95 {
96   return mPoint;
97 }
98
99 int32_t WheelEvent::GetDelta() const
100 {
101   return mDelta;
102 }
103
104 uint32_t WheelEvent::GetTime() const
105 {
106   return mTimeStamp;
107 }
108
109 } // namsespace Internal
110
111 } // namespace Dali