Example #1
0
        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");
            }
        }
Example #2
0
 public void SetEventSource(CGEventSource eventSource)
 {
     if (eventSource == null)
     {
         throw new ArgumentNullException("eventSource");
     }
     CGEventSetSource(handle, eventSource.Handle);
 }
Example #3
0
 public void SetEventSource(CGEventSource eventSource)
 {
     if (eventSource is null)
     {
         throw new ArgumentNullException(nameof(eventSource));
     }
     CGEventSetSource(Handle, eventSource.Handle);
 }
Example #4
0
 public CGEvent(CGEventSource source, CGEventType mouseType, CGPoint mouseCursorPosition, CGMouseButton mouseButton)
 {
     handle = CGEventCreateMouseEvent(source == null ? IntPtr.Zero : source.Handle, mouseType, mouseCursorPosition, mouseButton);
 }
Example #5
0
 public CGEvent(CGEventSource eventSource)
 {
     handle = CGEventCreate(eventSource == null ? IntPtr.Zero : eventSource.Handle);
 }
Example #6
0
 public CGEvent(CGEventSource source, ushort virtualKey, bool keyDown)
 {
     handle = CGEventCreateKeyboardEvent(source == null ? IntPtr.Zero : source.Handle, virtualKey, keyDown);
 }
Example #7
0
 public CGEvent(CGEventSource source, CGScrollEventUnit units, params int []  wheel)
     : base(Create(source, units, wheel), true)
 {
 }