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