1 #ifndef DALI_INTERNAL_WHEEL_EVENT_H
2 #define DALI_INTERNAL_WHEEL_EVENT_H
5 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/events/wheel-event.h>
23 #include <dali/public-api/object/base-object.h>
32 typedef IntrusivePtr< WheelEvent > WheelEventPtr;
35 * @copydoc Dali::WheelEvent
37 class WheelEvent : public BaseObject
41 // Construction & Destruction
44 * @brief Default constructor
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
58 WheelEvent( Dali::WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp );
66 * Create a new WheelEvent.
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.
76 static WheelEventPtr New( Dali::WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp );
79 * @copydoc Dali::WheelEvent::IsShiftModifier()
81 bool IsShiftModifier() const;
84 * @copydoc Dali::WheelEvent::IsCtrlModifier()
86 bool IsCtrlModifier() const;
89 * @copydoc Dali::WheelEvent::IsAltModifier()
91 bool IsAltModifier() const;
96 * @copydoc Dali::WheelEvent::GetType()
98 Dali::WheelEvent::Type GetType() const;
101 * @copydoc Dali::WheelEvent::GetDirection()
103 int32_t GetDirection() const;
106 * @copydoc Dali::WheelEvent::GetModifiers()
108 uint32_t GetModifiers() const;
111 * @copydoc Dali::WheelEvent::GetPoint()
113 const Vector2& GetPoint() const;
116 * @copydoc Dali::WheelEvent::GetDelta()
118 int32_t GetDelta() const;
121 * @copydoc Dali::WheelEvent::GetTime()
123 uint32_t GetTime() const;
127 // Not copyable or movable
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
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
144 } // namespace Internal
146 // Helpers for public-api forwarding methods
148 inline Internal::WheelEvent& GetImplementation( Dali::WheelEvent& wheelEvent )
150 DALI_ASSERT_ALWAYS( wheelEvent && "Wheel Event handle is empty" );
152 BaseObject& object = wheelEvent.GetBaseObject();
154 return static_cast< Internal::WheelEvent& >( object );
157 inline const Internal::WheelEvent& GetImplementation( const Dali::WheelEvent& wheelEvent )
159 DALI_ASSERT_ALWAYS( wheelEvent && "Wheel Event handle is empty" );
161 const BaseObject& object = wheelEvent.GetBaseObject();
163 return static_cast< const Internal::WheelEvent& >( object );
168 #endif // DALI_INTERNAL_WHEEL_EVENT_H