Use modern construct 'using' instead of typedef.
[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) 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 // 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
28 namespace Internal
29 {
30
31 class WheelEvent;
32 using WheelEventPtr = IntrusivePtr<WheelEvent>;
33
34 /**
35  * @copydoc Dali::WheelEvent
36  */
37 class WheelEvent : public BaseObject
38 {
39 public:
40
41   // Construction & Destruction
42
43   /**
44    * @brief Default constructor
45    */
46   WheelEvent();
47
48   /**
49    * @brief Constructor.
50    *
51    * @param[in] type      The type of the wheel event
52    * @param[in] direction The direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel)
53    * @param[in] modifiers Modifier keys pressed during the event (such as shift, alt and control)
54    * @param[in] point     The co-ordinates of the cursor relative to the top-left of the screen
55    * @param[in] delta     The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise)
56    * @param[in] timeStamp The time the wheel is being rolled
57    */
58   WheelEvent( Dali::WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp );
59
60   /**
61    * Create a new WheelEvent.
62    *
63    * @param[in] type      The type of the wheel event
64    * @param[in] direction The direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel)
65    * @param[in] modifiers Modifier keys pressed during the event (such as shift, alt and control)
66    * @param[in] point     The co-ordinates of the cursor relative to the top-left of the screen
67    * @param[in] delta     The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise)
68    * @param[in] timeStamp The time the wheel is being rolled
69    * @return A smart-pointer to the newly allocated WheelEvent.
70    */
71   static WheelEventPtr New( Dali::WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp );
72
73   /**
74    * @copydoc Dali::WheelEvent::IsShiftModifier()
75    */
76   bool IsShiftModifier() const;
77
78   /**
79    * @copydoc Dali::WheelEvent::IsCtrlModifier()
80    */
81   bool IsCtrlModifier() const;
82
83   /**
84    * @copydoc Dali::WheelEvent::IsAltModifier()
85    */
86   bool IsAltModifier() const;
87
88   // Getters
89
90   /**
91    * @copydoc Dali::WheelEvent::GetType()
92    */
93   Dali::WheelEvent::Type GetType() const;
94
95   /**
96    * @copydoc Dali::WheelEvent::GetDirection()
97    */
98   int32_t GetDirection() const;
99
100   /**
101    * @copydoc Dali::WheelEvent::GetModifiers()
102    */
103   uint32_t GetModifiers() const;
104
105   /**
106    * @copydoc Dali::WheelEvent::GetPoint()
107    */
108   const Vector2& GetPoint() const;
109
110   /**
111    * @copydoc Dali::WheelEvent::GetDelta()
112    */
113   int32_t GetDelta() const;
114
115   /**
116    * @copydoc Dali::WheelEvent::GetTime()
117    */
118   uint32_t GetTime() const;
119
120 private:
121
122   /**
123    * @brief Destructor
124    *
125    * A reference counted object may only be deleted by calling Unreference()
126    */
127   virtual ~WheelEvent() = default;
128
129   // Not copyable or movable
130
131   WheelEvent( const WheelEvent& rhs ) = delete;             ///< Deleted copy constructor
132   WheelEvent( WheelEvent&& rhs ) = delete;                  ///< Deleted move constructor
133   WheelEvent& operator=( const WheelEvent& rhs ) = delete;  ///< Deleted copy assignment operator
134   WheelEvent& operator=( WheelEvent&& rhs ) = delete;       ///< Deleted move assignment operator
135
136 private:
137
138   Dali::WheelEvent::Type mType; ///< The type of the event
139   int32_t mDirection;           ///< The direction in which the wheel is being rolled
140   uint32_t mModifiers;          ///< Modifier keys pressed during the event
141   Vector2 mPoint;               ///< The co-ordinates of the cursor relative to the top-left of the screen when the wheel is being rolled.
142   int32_t mDelta;               ///< The offset of the wheel rolling
143   uint32_t mTimeStamp;          ///< The time when the wheel is being rolled
144 };
145
146 } // namespace Internal
147
148 // Helpers for public-api forwarding methods
149
150 inline Internal::WheelEvent& GetImplementation( Dali::WheelEvent& wheelEvent )
151 {
152   DALI_ASSERT_ALWAYS( wheelEvent && "Wheel Event handle is empty" );
153
154   BaseObject& object = wheelEvent.GetBaseObject();
155
156   return static_cast< Internal::WheelEvent& >( object );
157 }
158
159 inline const Internal::WheelEvent& GetImplementation( const Dali::WheelEvent& wheelEvent )
160 {
161   DALI_ASSERT_ALWAYS( wheelEvent && "Wheel Event handle is empty" );
162
163   const BaseObject& object = wheelEvent.GetBaseObject();
164
165   return static_cast< const Internal::WheelEvent& >( object );
166 }
167
168 } // namespace Dali
169
170 #endif // DALI_INTERNAL_WHEEL_EVENT_H