2 * Copyright(c) 2020 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.
17 using System.ComponentModel;
18 using Tizen.NUI.BaseComponents;
23 /// 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 />
24 /// 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 />
25 /// 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 />
26 /// The mouse wheel event can be sent to the specific actor but the custom wheel event will be sent to the window.<br />
28 /// <since_tizen> 3 </since_tizen>
29 public class Wheel : BaseHandle
33 /// The default constructor.
35 /// <since_tizen> 3 </since_tizen>
36 public Wheel() : this(Interop.Wheel.New(0, 0, 0u, Vector2.getCPtr(new Vector2(0.0f, 0.0f)), 0, 0u), true)
38 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
44 /// <param name="type">The type of the wheel event.</param>
45 /// <param name="direction">The direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel).</param>
46 /// <param name="modifiers">Modifier keys pressed during the event (such as Shift, Alt, and Ctrl).</param>
47 /// <param name="point">The coordinates of the cursor relative to the top-left of the screen.</param>
48 /// <param name="z">The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise).</param>
49 /// <param name="timeStamp">The time the wheel is being rolled.</param>
50 /// <since_tizen> 3 </since_tizen>
51 public Wheel(Wheel.WheelType type, int direction, uint modifiers, Vector2 point, int z, uint timeStamp) : this(Interop.Wheel.New((int)type, direction, modifiers, Vector2.getCPtr(point), z, timeStamp), true)
53 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
56 internal Wheel(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Wheel.Upcast(cPtr), cMemoryOwn)
61 /// The type of the wheel event.
63 /// <since_tizen> 3 </since_tizen>
67 /// Mouse wheel event.
69 /// <since_tizen> 3 </since_tizen>
73 /// Custom wheel event.
75 /// <since_tizen> 3 </since_tizen>
80 /// The type of the wheel event.
82 /// <since_tizen> 3 </since_tizen>
83 public Wheel.WheelType Type
92 /// The direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel).
94 /// <since_tizen> 3 </since_tizen>
104 /// Modifier keys pressed during the event (such as Shift, Alt, and Ctrl).
106 /// <since_tizen> 3 </since_tizen>
107 public uint Modifiers
116 /// The coordinates of the cursor relative to the top-left of the screen.
118 /// <since_tizen> 3 </since_tizen>
128 /// The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise).
130 /// <since_tizen> 3 </since_tizen>
140 /// The time the wheel is being rolled.
142 /// <since_tizen> 3 </since_tizen>
143 public uint TimeStamp
151 private Wheel.WheelType type
155 Wheel.WheelType ret = (Wheel.WheelType)Interop.Wheel.TypeGet(swigCPtr);
156 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
161 private int direction
165 int ret = Interop.Wheel.DirectionGet(swigCPtr);
166 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
171 private uint modifiers
175 uint ret = Interop.Wheel.ModifiersGet(swigCPtr);
176 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
181 private Vector2 point
185 global::System.IntPtr cPtr = Interop.Wheel.PointGet(swigCPtr);
186 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
187 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
196 int ret = Interop.Wheel.DeltaGet(swigCPtr);
197 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
202 private uint timeStamp
206 uint ret = Interop.Wheel.TimeStampGet(swigCPtr);
207 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
214 /// Checks to see if the Shift key modifier has been supplied.
216 /// <returns>True if Shift modifier.</returns>
217 /// <since_tizen> 3 </since_tizen>
218 public bool IsShiftModifier()
220 bool ret = Interop.Wheel.IsShiftModifier(swigCPtr);
221 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
226 /// Checks to see if Ctrl (control) key modifier has been supplied.
228 /// <returns>True if Ctrl modifier.</returns>
229 /// <since_tizen> 3 </since_tizen>
230 public bool IsCtrlModifier()
232 bool ret = Interop.Wheel.IsCtrlModifier(swigCPtr);
233 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
238 /// Checks to see if Alt key modifier has been supplied.
240 /// <returns>True if Alt modifier.</returns>
241 /// <since_tizen> 3 </since_tizen>
242 public bool IsAltModifier()
244 bool ret = Interop.Wheel.IsAltModifier(swigCPtr);
245 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
249 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Wheel obj)
251 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
254 internal static Wheel GetWheelFromPtr(global::System.IntPtr cPtr)
256 Wheel ret = new Wheel(cPtr, false);
257 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
261 /// This will not be public opened.
262 [EditorBrowsable(EditorBrowsableState.Never)]
263 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
265 Interop.Wheel.DeleteWheel(swigCPtr);