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 using WheelEventPtr = IntrusivePtr<WheelEvent>;
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 );
61 * Create a new WheelEvent.
63 * @param[in] type The type of the wheel event
64 * @param[in] direction The direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel)
65 * @param[in] modifiers Modifier keys pressed during the event (such as shift, alt and control)
66 * @param[in] point The co-ordinates of the cursor relative to the top-left of the screen
67 * @param[in] delta The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise)
68 * @param[in] timeStamp The time the wheel is being rolled
69 * @return A smart-pointer to the newly allocated WheelEvent.
71 static WheelEventPtr New( Dali::WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp );
74 * @copydoc Dali::WheelEvent::IsShiftModifier()
76 bool IsShiftModifier() const;
79 * @copydoc Dali::WheelEvent::IsCtrlModifier()
81 bool IsCtrlModifier() const;
84 * @copydoc Dali::WheelEvent::IsAltModifier()
86 bool IsAltModifier() const;
91 * @copydoc Dali::WheelEvent::GetType()
93 Dali::WheelEvent::Type GetType() const;
96 * @copydoc Dali::WheelEvent::GetDirection()
98 int32_t GetDirection() const;
101 * @copydoc Dali::WheelEvent::GetModifiers()
103 uint32_t GetModifiers() const;
106 * @copydoc Dali::WheelEvent::GetPoint()
108 const Vector2& GetPoint() const;
111 * @copydoc Dali::WheelEvent::GetDelta()
113 int32_t GetDelta() const;
116 * @copydoc Dali::WheelEvent::GetTime()
118 uint32_t GetTime() const;
125 * A reference counted object may only be deleted by calling Unreference()
127 ~WheelEvent() override = default;
129 // Not copyable or movable
131 WheelEvent( const WheelEvent& rhs ) = delete; ///< Deleted copy constructor
132 WheelEvent( WheelEvent&& rhs ) = delete; ///< Deleted move constructor
133 WheelEvent& operator=( const WheelEvent& rhs ) = delete; ///< Deleted copy assignment operator
134 WheelEvent& operator=( WheelEvent&& rhs ) = delete; ///< Deleted move assignment operator
138 Dali::WheelEvent::Type mType; ///< The type of the event
139 int32_t mDirection; ///< The direction in which the wheel is being rolled
140 uint32_t mModifiers; ///< Modifier keys pressed during the event
141 Vector2 mPoint; ///< The co-ordinates of the cursor relative to the top-left of the screen when the wheel is being rolled.
142 int32_t mDelta; ///< The offset of the wheel rolling
143 uint32_t mTimeStamp; ///< The time when the wheel is being rolled
146 } // namespace Internal
148 // Helpers for public-api forwarding methods
150 inline Internal::WheelEvent& GetImplementation( Dali::WheelEvent& wheelEvent )
152 DALI_ASSERT_ALWAYS( wheelEvent && "Wheel Event handle is empty" );
154 BaseObject& object = wheelEvent.GetBaseObject();
156 return static_cast< Internal::WheelEvent& >( object );
159 inline const Internal::WheelEvent& GetImplementation( const Dali::WheelEvent& wheelEvent )
161 DALI_ASSERT_ALWAYS( wheelEvent && "Wheel Event handle is empty" );
163 const BaseObject& object = wheelEvent.GetBaseObject();
165 return static_cast< const Internal::WheelEvent& >( object );
170 #endif // DALI_INTERNAL_WHEEL_EVENT_H