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