示例#1
0
        void ConnectEvents()
        {
            mInputDriver = new CarbonInput();
            EventTypeSpec[] eventTypes = new EventTypeSpec[]
            {
                new EventTypeSpec(EventClass.Window, WindowEventKind.WindowClose),
                new EventTypeSpec(EventClass.Window, WindowEventKind.WindowClosed),
                new EventTypeSpec(EventClass.Window, WindowEventKind.WindowBoundsChanged),
                new EventTypeSpec(EventClass.Window, WindowEventKind.WindowActivate),
                new EventTypeSpec(EventClass.Window, WindowEventKind.WindowDeactivate),
                //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),
            };
            MacOSEventHandler handler = EventHandler;

            uppHandler = API.NewEventHandlerUPP(handler);
            API.InstallWindowEventHandler(window.WindowRef, uppHandler, eventTypes, window.WindowRef, IntPtr.Zero);
            Application.WindowEventHandler = this;
        }
示例#2
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),
            };

            uppHandler = API.NewEventHandlerUPP(handler);
            API.InstallApplicationEventHandler(
                uppHandler, eventTypes, IntPtr.Zero, IntPtr.Zero);
            mInitialized = true;
        }
示例#3
0
 private void ConnectEvents()
 {
     this.mInputDriver = new CarbonInput();
     EventTypeSpec[] eventTypes = new EventTypeSpec[5]
     {
         new EventTypeSpec(EventClass.Window, WindowEventKind.WindowClose),
         new EventTypeSpec(EventClass.Window, WindowEventKind.WindowClosed),
         new EventTypeSpec(EventClass.Window, WindowEventKind.WindowBoundsChanged),
         new EventTypeSpec(EventClass.Window, WindowEventKind.WindowActivate),
         new EventTypeSpec(EventClass.Window, WindowEventKind.WindowDeactivate)
     };
     this.uppHandler = API.NewEventHandlerUPP(new MacOSEventHandler(CarbonGLNative.EventHandler));
     API.InstallWindowEventHandler(this.window.WindowRef, this.uppHandler, eventTypes, this.window.WindowRef, IntPtr.Zero);
     Application.WindowEventHandler = this;
 }