Revert "[Tizen] Not execute the remove callback"
[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) 2021 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 namespace Internal
28 {
29 class WheelEvent;
30 using WheelEventPtr = IntrusivePtr<WheelEvent>;
31
32 /**
33  * @copydoc Dali::WheelEvent
34  */
35 class WheelEvent : public BaseObject
36 {
37 public:
38   // Construction & Destruction
39
40   /**
41    * @brief Default constructor
42    */
43   WheelEvent();
44
45   /**
46    * @brief Constructor.
47    *
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
54    */
55   WheelEvent(Dali::WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp);
56
57   /**
58    * Create a new WheelEvent.
59    *
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.
67    */
68   static WheelEventPtr New(Dali::WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp);
69
70   /**
71    * @copydoc Dali::WheelEvent::IsShiftModifier()
72    */
73   bool IsShiftModifier() const;
74
75   /**
76    * @copydoc Dali::WheelEvent::IsCtrlModifier()
77    */
78   bool IsCtrlModifier() const;
79
80   /**
81    * @copydoc Dali::WheelEvent::IsAltModifier()
82    */
83   bool IsAltModifier() const;
84
85   // Getters
86
87   /**
88    * @copydoc Dali::WheelEvent::GetType()
89    */
90   Dali::WheelEvent::Type GetType() const;
91
92   /**
93    * @copydoc Dali::WheelEvent::GetDirection()
94    */
95   int32_t GetDirection() const;
96
97   /**
98    * @copydoc Dali::WheelEvent::GetModifiers()
99    */
100   uint32_t GetModifiers() const;
101
102   /**
103    * @copydoc Dali::WheelEvent::GetPoint()
104    */
105   const Vector2& GetPoint() const;
106
107   /**
108    * @copydoc Dali::WheelEvent::GetDelta()
109    */
110   int32_t GetDelta() const;
111
112   /**
113    * @copydoc Dali::WheelEvent::GetTime()
114    */
115   uint32_t GetTime() const;
116
117 private:
118   /**
119    * @brief Destructor
120    *
121    * A reference counted object may only be deleted by calling Unreference()
122    */
123   ~WheelEvent() override = default;
124
125   // Not copyable or movable
126
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
131
132 private:
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
139 };
140
141 } // namespace Internal
142
143 // Helpers for public-api forwarding methods
144
145 inline Internal::WheelEvent& GetImplementation(Dali::WheelEvent& wheelEvent)
146 {
147   DALI_ASSERT_ALWAYS(wheelEvent && "Wheel Event handle is empty");
148
149   BaseObject& object = wheelEvent.GetBaseObject();
150
151   return static_cast<Internal::WheelEvent&>(object);
152 }
153
154 inline const Internal::WheelEvent& GetImplementation(const Dali::WheelEvent& wheelEvent)
155 {
156   DALI_ASSERT_ALWAYS(wheelEvent && "Wheel Event handle is empty");
157
158   const BaseObject& object = wheelEvent.GetBaseObject();
159
160   return static_cast<const Internal::WheelEvent&>(object);
161 }
162
163 } // namespace Dali
164
165 #endif // DALI_INTERNAL_WHEEL_EVENT_H