Revert "Revert "WheelEvent class pimpling""
[platform/core/uifw/dali-core.git] / dali / internal / event / events / wheel-event-impl.h
1 #ifndef DALI_INTERNAL_WHEEL_EVENT_H
2 #define DALI_INTERNAL_WHEEL_EVENT_H
3
4 /*
5  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/events/wheel-event.h>
23 #include <dali/public-api/object/base-object.h>
24
25 namespace Dali
26 {
27
28 namespace Internal
29 {
30
31 class WheelEvent;
32 typedef IntrusivePtr< WheelEvent > WheelEventPtr;
33
34 /**
35  * @copydoc Dali::WheelEvent
36  */
37 class WheelEvent : public BaseObject
38 {
39 public:
40
41   // Construction & Destruction
42
43   /**
44    * @brief Default constructor
45    */
46   WheelEvent();
47
48   /**
49    * @brief Constructor.
50    *
51    * @param[in] type      The type of the wheel event
52    * @param[in] direction The direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel)
53    * @param[in] modifiers Modifier keys pressed during the event (such as shift, alt and control)
54    * @param[in] point     The co-ordinates of the cursor relative to the top-left of the screen
55    * @param[in] delta     The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise)
56    * @param[in] timeStamp The time the wheel is being rolled
57    */
58   WheelEvent( Dali::WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp );
59
60   /**
61    * @brief Destructor
62    */
63   ~WheelEvent();
64
65   /**
66    * Create a new WheelEvent.
67    *
68    * @param[in] type      The type of the wheel event
69    * @param[in] direction The direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel)
70    * @param[in] modifiers Modifier keys pressed during the event (such as shift, alt and control)
71    * @param[in] point     The co-ordinates of the cursor relative to the top-left of the screen
72    * @param[in] delta     The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise)
73    * @param[in] timeStamp The time the wheel is being rolled
74    * @return A smart-pointer to the newly allocated WheelEvent.
75    */
76   static WheelEventPtr New( Dali::WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp );
77
78   /**
79    * @copydoc Dali::WheelEvent::IsShiftModifier()
80    */
81   bool IsShiftModifier() const;
82
83   /**
84    * @copydoc Dali::WheelEvent::IsCtrlModifier()
85    */
86   bool IsCtrlModifier() const;
87
88   /**
89    * @copydoc Dali::WheelEvent::IsAltModifier()
90    */
91   bool IsAltModifier() const;
92
93   // Getters
94
95   /**
96    * @copydoc Dali::WheelEvent::GetType()
97    */
98   Dali::WheelEvent::Type GetType() const;
99
100   /**
101    * @copydoc Dali::WheelEvent::GetDirection()
102    */
103   int32_t GetDirection() const;
104
105   /**
106    * @copydoc Dali::WheelEvent::GetModifiers()
107    */
108   uint32_t GetModifiers() const;
109
110   /**
111    * @copydoc Dali::WheelEvent::GetPoint()
112    */
113   const Vector2& GetPoint() const;
114
115   /**
116    * @copydoc Dali::WheelEvent::GetDelta()
117    */
118   int32_t GetDelta() const;
119
120   /**
121    * @copydoc Dali::WheelEvent::GetTime()
122    */
123   uint32_t GetTime() const;
124
125 private:
126
127   // Not copyable or movable
128
129   WheelEvent( const WheelEvent& rhs ) = delete;             ///< Deleted copy constructor
130   WheelEvent( WheelEvent&& rhs ) = delete;                  ///< Deleted move constructor
131   WheelEvent& operator=( const WheelEvent& rhs ) = delete;  ///< Deleted copy assignment operator
132   WheelEvent& operator=( WheelEvent&& rhs ) = delete;       ///< Deleted move assignment operator
133
134 private:
135
136   Dali::WheelEvent::Type mType; ///< The type of the event
137   int32_t mDirection;           ///< The direction in which the wheel is being rolled
138   uint32_t mModifiers;          ///< Modifier keys pressed during the event
139   Vector2 mPoint;               ///< The co-ordinates of the cursor relative to the top-left of the screen when the wheel is being rolled.
140   int32_t mDelta;               ///< The offset of the wheel rolling
141   uint32_t mTimeStamp;          ///< The time when the wheel is being rolled
142 };
143
144 } // namespace Internal
145
146 // Helpers for public-api forwarding methods
147
148 inline Internal::WheelEvent& GetImplementation( Dali::WheelEvent& wheelEvent )
149 {
150   DALI_ASSERT_ALWAYS( wheelEvent && "Wheel Event handle is empty" );
151
152   BaseObject& object = wheelEvent.GetBaseObject();
153
154   return static_cast< Internal::WheelEvent& >( object );
155 }
156
157 inline const Internal::WheelEvent& GetImplementation( const Dali::WheelEvent& wheelEvent )
158 {
159   DALI_ASSERT_ALWAYS( wheelEvent && "Wheel Event handle is empty" );
160
161   const BaseObject& object = wheelEvent.GetBaseObject();
162
163   return static_cast< const Internal::WheelEvent& >( object );
164 }
165
166 } // namespace Dali
167
168 #endif // DALI_INTERNAL_WHEEL_EVENT_H