public CGEvent(CGEventSource source, CGScrollEventUnit units, params int [] wheel) { IntPtr shandle = source == null ? IntPtr.Zero : source.Handle; switch (wheel.Length) { case 0: throw new ArgumentException("At least one wheel must be provided"); case 1: handle = CGEventCreateScrollWheelEvent(shandle, units, 1, wheel [0]); break; case 2: handle = CGEventCreateScrollWheelEvent(shandle, units, 2, wheel [0], wheel [1]); break; case 3: handle = CGEventCreateScrollWheelEvent(shandle, units, 3, wheel [0], wheel [1], wheel [2]); break; default: throw new ArgumentException("Only one to three wheels are supported on this constructor"); } }
public void SetEventSource(CGEventSource eventSource) { if (eventSource == null) { throw new ArgumentNullException("eventSource"); } CGEventSetSource(handle, eventSource.Handle); }
public void SetEventSource(CGEventSource eventSource) { if (eventSource is null) { throw new ArgumentNullException(nameof(eventSource)); } CGEventSetSource(Handle, eventSource.Handle); }
public CGEvent(CGEventSource source, CGEventType mouseType, CGPoint mouseCursorPosition, CGMouseButton mouseButton) { handle = CGEventCreateMouseEvent(source == null ? IntPtr.Zero : source.Handle, mouseType, mouseCursorPosition, mouseButton); }
public CGEvent(CGEventSource eventSource) { handle = CGEventCreate(eventSource == null ? IntPtr.Zero : eventSource.Handle); }
public CGEvent(CGEventSource source, ushort virtualKey, bool keyDown) { handle = CGEventCreateKeyboardEvent(source == null ? IntPtr.Zero : source.Handle, virtualKey, keyDown); }
public CGEvent(CGEventSource source, CGScrollEventUnit units, params int [] wheel) : base(Create(source, units, wheel), true) { }