NewEventHandlerUPP() private method

private NewEventHandlerUPP ( MacOSEventHandler handler ) : IntPtr
handler MacOSEventHandler
return System.IntPtr
Ejemplo n.º 1
0
        static void ConnectEvents()
        {
            EventTypeSpec[] eventTypes = new EventTypeSpec[]
            {
                new EventTypeSpec(EventClass.Application, AppEventKind.AppActivated),
                new EventTypeSpec(EventClass.Application, AppEventKind.AppDeactivated),
                new EventTypeSpec(EventClass.Application, AppEventKind.AppQuit),

                new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseDown),
                new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseUp),
                new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseMoved),
                new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseDragged),
                new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseEntered),
                new EventTypeSpec(EventClass.Mouse, MouseEventKind.MouseExited),
                new EventTypeSpec(EventClass.Mouse, MouseEventKind.WheelMoved),

                new EventTypeSpec(EventClass.Keyboard, KeyboardEventKind.RawKeyDown),
                new EventTypeSpec(EventClass.Keyboard, KeyboardEventKind.RawKeyRepeat),
                new EventTypeSpec(EventClass.Keyboard, KeyboardEventKind.RawKeyUp),
                new EventTypeSpec(EventClass.Keyboard, KeyboardEventKind.RawKeyModifiersChanged),

                new EventTypeSpec(EventClass.AppleEvent, AppleEventKind.AppleEvent),
            };

            MacOSEventHandler handler = EventHandler;

            uppHandler = API.NewEventHandlerUPP(handler);

            API.InstallApplicationEventHandler(
                uppHandler, eventTypes, IntPtr.Zero, IntPtr.Zero);

            mInitialized = true;
        }