2 * Copyright(c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 /// The wheel event structure is used to store a wheel rolling, it facilitates processing of the wheel rolling and passing to other libraries like Toolkit.<br />
22 /// There is a key modifier which relates to keys like Alt, Shift, and Ctrl functions are supplied to check if they have been pressed when the wheel is being rolled.<br />
23 /// 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.<br />
24 /// The mouse wheel event can be sent to the specific actor but the custom wheel event will be sent to the window.<br />
26 /// <since_tizen> 3 </since_tizen>
27 public class Wheel : Disposable
32 /// <since_tizen> 3 </since_tizen>
33 protected bool swigCMemOwn;
35 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
38 /// The default constructor.
40 /// <since_tizen> 3 </since_tizen>
41 public Wheel() : this(Interop.Wheel.new_Wheel__SWIG_0(), true)
43 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
49 /// <param name="type">The type of the wheel event.</param>
50 /// <param name="direction">The direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel).</param>
51 /// <param name="modifiers">Modifier keys pressed during the event (such as Shift, Alt, and Ctrl).</param>
52 /// <param name="point">The coordinates of the cursor relative to the top-left of the screen.</param>
53 /// <param name="z">The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise).</param>
54 /// <param name="timeStamp">The time the wheel is being rolled.</param>
55 /// <since_tizen> 3 </since_tizen>
56 public Wheel(Wheel.WheelType type, int direction, uint modifiers, Vector2 point, int z, uint timeStamp) : this(Interop.Wheel.new_Wheel__SWIG_1((int)type, direction, modifiers, Vector2.getCPtr(point), z, timeStamp), true)
58 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
61 internal Wheel(global::System.IntPtr cPtr, bool cMemoryOwn)
63 swigCMemOwn = cMemoryOwn;
64 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
68 /// The type of the wheel event.
70 /// <since_tizen> 3 </since_tizen>
74 /// Mouse wheel event.
76 /// <since_tizen> 3 </since_tizen>
80 /// Custom wheel event.
82 /// <since_tizen> 3 </since_tizen>
87 /// The type of the wheel event.
89 /// <since_tizen> 3 </since_tizen>
90 public Wheel.WheelType Type
99 /// The direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel).
101 /// <since_tizen> 3 </since_tizen>
111 /// Modifier keys pressed during the event (such as Shift, Alt, and Ctrl).
113 /// <since_tizen> 3 </since_tizen>
114 public uint Modifiers
123 /// The coordinates of the cursor relative to the top-left of the screen.
125 /// <since_tizen> 3 </since_tizen>
135 /// The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise).
137 /// <since_tizen> 3 </since_tizen>
147 /// The time the wheel is being rolled.
149 /// <since_tizen> 3 </since_tizen>
150 public uint TimeStamp
158 private Wheel.WheelType type
162 Interop.Wheel.Wheel_type_set(swigCPtr, (int)value);
163 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
167 Wheel.WheelType ret = (Wheel.WheelType)Interop.Wheel.Wheel_type_get(swigCPtr);
168 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
173 private int direction
177 Interop.Wheel.Wheel_direction_set(swigCPtr, value);
178 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
182 int ret = Interop.Wheel.Wheel_direction_get(swigCPtr);
183 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
188 private uint modifiers
192 Interop.Wheel.Wheel_modifiers_set(swigCPtr, value);
193 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
197 uint ret = Interop.Wheel.Wheel_modifiers_get(swigCPtr);
198 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
203 private Vector2 point
207 Interop.Wheel.Wheel_point_set(swigCPtr, Vector2.getCPtr(value));
208 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
212 global::System.IntPtr cPtr = Interop.Wheel.Wheel_point_get(swigCPtr);
213 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
214 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
223 Interop.Wheel.Wheel_z_set(swigCPtr, value);
224 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
228 int ret = Interop.Wheel.Wheel_z_get(swigCPtr);
229 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
234 private uint timeStamp
238 Interop.Wheel.Wheel_timeStamp_set(swigCPtr, value);
239 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
243 uint ret = Interop.Wheel.Wheel_timeStamp_get(swigCPtr);
244 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
251 /// Checks to see if the Shift key modifier has been supplied.
253 /// <returns>True if Shift modifier.</returns>
254 /// <since_tizen> 3 </since_tizen>
255 public bool IsShiftModifier()
257 bool ret = Interop.Wheel.Wheel_IsShiftModifier(swigCPtr);
258 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
263 /// Checks to see if Ctrl (control) key modifier has been supplied.
265 /// <returns>True if Ctrl modifier.</returns>
266 /// <since_tizen> 3 </since_tizen>
267 public bool IsCtrlModifier()
269 bool ret = Interop.Wheel.Wheel_IsCtrlModifier(swigCPtr);
270 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
275 /// Checks to see if Alt key modifier has been supplied.
277 /// <returns>True if Alt modifier.</returns>
278 /// <since_tizen> 3 </since_tizen>
279 public bool IsAltModifier()
281 bool ret = Interop.Wheel.Wheel_IsAltModifier(swigCPtr);
282 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
286 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Wheel obj)
288 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
291 internal static Wheel GetWheelFromPtr(global::System.IntPtr cPtr)
293 Wheel ret = new Wheel(cPtr, false);
294 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
301 /// <param name="type">The type dispose, it could be from user, or called by DisposeQueue.</param>
302 /// <since_tizen> 3 </since_tizen>
303 protected override void Dispose(DisposeTypes type)
310 //Release your own unmanaged resources here.
311 //You should not access any managed member here except static instance.
312 //because the execution order of Finalizes is non-deterministic.
314 if (swigCPtr.Handle != global::System.IntPtr.Zero)
319 Interop.Wheel.delete_Wheel(swigCPtr);
321 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);