1 #ifndef DALI_INTERNAL_WHEEL_EVENT_H
2 #define DALI_INTERNAL_WHEEL_EVENT_H
5 * Copyright (c) 2021 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>
30 using WheelEventPtr = IntrusivePtr<WheelEvent>;
33 * @copydoc Dali::WheelEvent
35 class WheelEvent : public BaseObject
38 // Construction & Destruction
41 * @brief Default constructor
48 * @param[in] type The type of the wheel event
49 * @param[in] direction The direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel)
50 * @param[in] modifiers Modifier keys pressed during the event (such as shift, alt and control)
51 * @param[in] point The co-ordinates of the cursor relative to the top-left of the screen
52 * @param[in] delta The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise)
53 * @param[in] timeStamp The time the wheel is being rolled
55 WheelEvent(Dali::WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp);
58 * Create a new WheelEvent.
60 * @param[in] type The type of the wheel event
61 * @param[in] direction The direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel)
62 * @param[in] modifiers Modifier keys pressed during the event (such as shift, alt and control)
63 * @param[in] point The co-ordinates of the cursor relative to the top-left of the screen
64 * @param[in] delta The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise)
65 * @param[in] timeStamp The time the wheel is being rolled
66 * @return A smart-pointer to the newly allocated WheelEvent.
68 static WheelEventPtr New(Dali::WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp);
71 * @copydoc Dali::WheelEvent::IsShiftModifier()
73 bool IsShiftModifier() const;
76 * @copydoc Dali::WheelEvent::IsCtrlModifier()
78 bool IsCtrlModifier() const;
81 * @copydoc Dali::WheelEvent::IsAltModifier()
83 bool IsAltModifier() const;
88 * @copydoc Dali::WheelEvent::GetType()
90 Dali::WheelEvent::Type GetType() const;
93 * @copydoc Dali::WheelEvent::GetDirection()
95 int32_t GetDirection() const;
98 * @copydoc Dali::WheelEvent::GetModifiers()
100 uint32_t GetModifiers() const;
103 * @copydoc Dali::WheelEvent::GetPoint()
105 const Vector2& GetPoint() const;
108 * @copydoc Dali::WheelEvent::GetDelta()
110 int32_t GetDelta() const;
113 * @copydoc Dali::WheelEvent::GetTime()
115 uint32_t GetTime() const;
121 * A reference counted object may only be deleted by calling Unreference()
123 ~WheelEvent() override = default;
125 // Not copyable or movable
127 WheelEvent(const WheelEvent& rhs) = delete; ///< Deleted copy constructor
128 WheelEvent(WheelEvent&& rhs) = delete; ///< Deleted move constructor
129 WheelEvent& operator=(const WheelEvent& rhs) = delete; ///< Deleted copy assignment operator
130 WheelEvent& operator=(WheelEvent&& rhs) = delete; ///< Deleted move assignment operator
133 Dali::WheelEvent::Type mType; ///< The type of the event
134 int32_t mDirection; ///< The direction in which the wheel is being rolled
135 uint32_t mModifiers; ///< Modifier keys pressed during the event
136 Vector2 mPoint; ///< The co-ordinates of the cursor relative to the top-left of the screen when the wheel is being rolled.
137 int32_t mDelta; ///< The offset of the wheel rolling
138 uint32_t mTimeStamp; ///< The time when the wheel is being rolled
141 } // namespace Internal
143 // Helpers for public-api forwarding methods
145 inline Internal::WheelEvent& GetImplementation(Dali::WheelEvent& wheelEvent)
147 DALI_ASSERT_ALWAYS(wheelEvent && "Wheel Event handle is empty");
149 BaseObject& object = wheelEvent.GetBaseObject();
151 return static_cast<Internal::WheelEvent&>(object);
154 inline const Internal::WheelEvent& GetImplementation(const Dali::WheelEvent& wheelEvent)
156 DALI_ASSERT_ALWAYS(wheelEvent && "Wheel Event handle is empty");
158 const BaseObject& object = wheelEvent.GetBaseObject();
160 return static_cast<const Internal::WheelEvent&>(object);
165 #endif // DALI_INTERNAL_WHEEL_EVENT_H