Get world scale more faster
[platform/core/uifw/dali-core.git] / dali / public-api / events / wheel-event.h
1 #ifndef DALI_WHEEL_EVENT_H
2 #define DALI_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 // EXTERNAL INCLUDES
22 #include <cstdint> // uint32_t
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/common/dali-common.h>
26 #include <dali/public-api/math/vector2.h>
27 #include <dali/public-api/object/base-handle.h>
28
29 namespace Dali
30 {
31 namespace Internal DALI_INTERNAL
32 {
33 class WheelEvent;
34 }
35
36 /**
37  * @addtogroup dali_core_events
38  * @{
39  */
40
41 /**
42  * @brief The wheel event class is used to store a wheel rolling, it facilitates
43  * processing of the wheel rolling and passing to other libraries like Toolkit.
44  *
45  * There is a key modifier which relates to keys like alt, shift and control functions are
46  * supplied to check if they have been pressed when the wheel is being rolled.
47  *
48  * We support a mouse device and there may be another custom device that support the wheel event. The device type is specified as \e type.
49  * The mouse wheel event can be sent to the specific actor but the custom wheel event will be sent to the stage.
50  * @SINCE_1_0.0
51  */
52 class DALI_CORE_API WheelEvent : public BaseHandle
53 {
54 public:
55   // Enumerations
56
57   /**
58    * @brief Enumeration for specifying the type of the wheel event.
59    * @SINCE_1_0.0
60    */
61   enum Type
62   {
63     MOUSE_WHEEL, ///< Mouse wheel event @SINCE_1_0.0
64     CUSTOM_WHEEL ///< Custom wheel event @SINCE_1_0.0
65   };
66
67   // Construction & Destruction
68
69   /**
70    * @brief An uninitialized WheelEvent instance.
71    *
72    * Calling member functions with an uninitialized WheelEvent handle is not allowed.
73    * @SINCE_1_0.0
74    */
75   WheelEvent();
76
77   /**
78    * @brief Copy constructor.
79    *
80    * @SINCE_1_9.26
81    * @param[in] rhs The WheelEvent to copy from
82    */
83   WheelEvent(const WheelEvent& rhs);
84
85   /**
86    * @brief Move constructor.
87    *
88    * @SINCE_1_9.26
89    * @param[in] rhs A reference to the moved WheelEvent
90    */
91   WheelEvent(WheelEvent&& rhs);
92
93   /**
94    * @brief Destructor.
95    * @SINCE_1_0.0
96    */
97   ~WheelEvent();
98
99   /**
100    * @brief Copy assignment operator.
101    *
102    * @SINCE_1_9.26
103    * @param[in] rhs The WheelEvent to copy from
104    * @return A reference to this
105    */
106   WheelEvent& operator=(const WheelEvent& rhs);
107
108   /**
109    * @brief Move assignment operator.
110    *
111    * @SINCE_1_9.26
112    * @param[in] rhs A reference to the moved WheelEvent
113    * @return A reference to this
114    */
115   WheelEvent& operator=(WheelEvent&& rhs);
116
117   /**
118    * @brief Checks to see if Shift key modifier has been supplied.
119    *
120    * @SINCE_1_0.0
121    * @return True if shift modifier
122    */
123   bool IsShiftModifier() const;
124
125   /**
126    * @brief Checks to see if Ctrl (control) key modifier has been supplied.
127    *
128    * @SINCE_1_0.0
129    * @return True if ctrl modifier
130    */
131   bool IsCtrlModifier() const;
132
133   /**
134    * @brief Checks to see if Alt key modifier has been supplied.
135    *
136    * @SINCE_1_0.0
137    * @return True if alt modifier
138    */
139   bool IsAltModifier() const;
140
141   // Getters
142
143   /**
144    * @brief Get the type of the wheel event.
145    *
146    * @SINCE_1_9.26
147    * @return The type of the wheel event
148    */
149   Type GetType() const;
150
151   /**
152    * @brief Get the direction in which the wheel is being rolled.
153    *
154    * @SINCE_1_9.26
155    * @return The direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel)
156    */
157   int32_t GetDirection() const;
158
159   /**
160    * @brief Get the modifier keys pressed during the event (such as shift, alt and control).
161    *
162    * @SINCE_1_9.26
163    * @return The modifier keys pressed during the event
164    */
165   uint32_t GetModifiers() const;
166
167   /**
168    * @brief Get the co-ordinates of the cursor relative to the top-left of the screen
169    * when the wheel is being rolled.
170    *
171    * @SINCE_1_9.26
172    * @return The co-ordinates of the cursor relative to the top-left of the screen
173    */
174   const Vector2& GetPoint() const;
175
176   /**
177    * @brief Get the offset of the wheel rolling
178    *
179    * @SINCE_1_9.26
180    * @return The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise)
181    */
182   int32_t GetDelta() const;
183
184   /**
185    * @brief Get the time when the wheel is being rolled.
186    *
187    * @SINCE_1_9.26
188    * @return The time when the wheel is being rolled
189    */
190   uint32_t GetTime() const;
191
192 public: // Not intended for application developers
193   /// @cond internal
194   /**
195    * @brief This constructor is used internally to Create an initialized WheelEvent handle.
196    *
197    * @SINCE_1_9.26
198    * @param[in] wheelEvent A pointer to a newly allocated Dali resource
199    */
200   explicit DALI_INTERNAL WheelEvent(Internal::WheelEvent* hoverEvent);
201   /// @endcond
202 };
203
204 /**
205  * @}
206  */
207 } // namespace Dali
208
209 #endif // DALI_WHEEL_EVENT_H