541b33eee0a461c23ca0fda7830a40853e101f98
[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) 2018 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
28
29 namespace Dali
30 {
31 /**
32  * @addtogroup dali_core_events
33  * @{
34  */
35
36 /**
37  * @brief The wheel event structure is used to store a wheel rolling, it facilitates
38  * processing of the wheel rolling and passing to other libraries like Toolkit.
39  *
40  * There is a key modifier which relates to keys like alt, shift and control functions are
41  * supplied to check if they have been pressed when the wheel is being rolled.
42  *
43  * 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.
44  * The mouse wheel event can be sent to the specific actor but the custom wheel event will be sent to the stage.
45  * @SINCE_1_0.0
46  */
47 struct DALI_CORE_API WheelEvent
48 {
49   // Enumerations
50
51   /**
52    * @brief Enumeration for specifying the type of the wheel event.
53    * @SINCE_1_0.0
54    */
55   enum Type
56   {
57     MOUSE_WHEEL,      ///< Mouse wheel event @SINCE_1_0.0
58     CUSTOM_WHEEL      ///< Custom wheel event @SINCE_1_0.0
59   };
60
61   /**
62    * @brief Default constructor.
63    * @SINCE_1_0.0
64    */
65   WheelEvent();
66
67   /**
68    * @brief Constructor.
69    *
70    * @SINCE_1_0.0
71    * @param[in] type      The type of the wheel event
72    * @param[in] direction The direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel)
73    * @param[in] modifiers Modifier keys pressed during the event (such as shift, alt and control)
74    * @param[in] point     The co-ordinates of the cursor relative to the top-left of the screen
75    * @param[in] z         The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise)
76    * @param[in] timeStamp The time the wheel is being rolled
77    */
78   WheelEvent( Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t z, uint32_t timeStamp );
79
80   /**
81    * @brief Destructor.
82    * @SINCE_1_0.0
83    */
84   ~WheelEvent();
85
86   /**
87    * @brief Checks to see if Shift key modifier has been supplied.
88    *
89    * @SINCE_1_0.0
90    * @return True if shift modifier
91    */
92   bool IsShiftModifier() const;
93
94   /**
95    * @brief Checks to see if Ctrl (control) key modifier has been supplied.
96    *
97    * @SINCE_1_0.0
98    * @return True if ctrl modifier
99    */
100   bool IsCtrlModifier() const;
101
102   /**
103    * @brief Checks to see if Alt key modifier has been supplied.
104    *
105    * @SINCE_1_0.0
106    * @return True if alt modifier
107    */
108   bool IsAltModifier() const;
109
110   // Data
111
112   /**
113    * @brief Type of the event.
114    *
115    * @see Type
116    */
117   Type type;
118
119   /**
120    * @brief The direction in which the wheel is being rolled.
121    *
122    * 0 means the default vertical wheel, and 1 means horizontal wheel.
123    */
124   int32_t direction;
125
126   /**
127    * @brief Modifier keys pressed during the event (such as shift, alt and control).
128    */
129   uint32_t modifiers;
130
131   /**
132    * @brief The co-ordinates of the cursor relative to the top-left of the screen
133    * when the wheel is being rolled.
134    */
135   Vector2 point;
136
137   /**
138    * @brief The offset of the wheel rolling, where positive value means rolling down or clockwise
139    * and negative value means rolling up or counter-clockwise.
140    */
141   int32_t z;
142
143   /**
144    * @brief The time when the wheel is being rolled.
145    */
146   uint32_t timeStamp;
147
148 };
149
150 /**
151  * @}
152  */
153 } // namespace Dali
154
155 #endif // __DALI_WHEEL_EVENT_H__