Esempio n. 1
0
        public override void AttachEvent(string id)
        {
            switch (id)
            {
            case Eto.Forms.Control.KeyDownEvent:
                EventControl.AddEvents((int)Gdk.EventMask.KeyPressMask);
                EventControl.KeyPressEvent += Connector.HandleWindowKeyPressEvent;
                break;

            case Window.ClosedEvent:
                HandleEvent(Window.ClosingEvent);
                break;

            case Window.ClosingEvent:
                Control.DeleteEvent += Connector.HandleDeleteEvent;
                break;

            case Eto.Forms.Control.ShownEvent:
                Control.Shown += Connector.HandleShownEvent;
                break;

            case Window.WindowStateChangedEvent:
                Connector.OldState        = WindowState;
                Control.WindowStateEvent += Connector.HandleWindowStateEvent;
                break;

            case Eto.Forms.Control.SizeChangedEvent:
                Control.SizeAllocated += Connector.HandleWindowSizeAllocated;
                break;

            case Window.LocationChangedEvent:
                Control.ConfigureEvent += Connector.HandleConfigureEvent;
                break;

            case Window.LogicalPixelSizeChangedEvent:
                // not supported on GTK, yet.
                break;

            default:
                base.AttachEvent(id);
                break;
            }
        }
Esempio n. 2
0
        public override void AttachEvent(string id)
        {
            switch (id)
            {
            case Eto.Forms.Control.KeyDownEvent:
                EventControl.AddEvents((int)Gdk.EventMask.KeyPressMask);
                EventControl.KeyPressEvent += Connector.HandleKeyPressEvent;
                break;

            case Eto.Forms.Control.KeyUpEvent:
                EventControl.AddEvents((int)Gdk.EventMask.KeyReleaseMask);
                EventControl.KeyReleaseEvent += Connector.HandleKeyReleaseEvent;
                break;

            case Eto.Forms.Control.SizeChangedEvent:
                EventControl.AddEvents((int)Gdk.EventMask.StructureMask);
                EventControl.SizeAllocated += Connector.HandleSizeAllocated;
                break;

            case Eto.Forms.Control.MouseDoubleClickEvent:
            case Eto.Forms.Control.MouseDownEvent:
                if (!mouseDownHandled)
                {
                    EventControl.AddEvents((int)Gdk.EventMask.ButtonPressMask);
                    EventControl.AddEvents((int)Gdk.EventMask.ButtonReleaseMask);
                    EventControl.ButtonPressEvent += Connector.HandleButtonPressEvent;
                    mouseDownHandled = true;
                }
                break;

            case Eto.Forms.Control.MouseUpEvent:
                EventControl.AddEvents((int)Gdk.EventMask.ButtonReleaseMask);
                EventControl.ButtonReleaseEvent += Connector.HandleButtonReleaseEvent;
                break;

            case Eto.Forms.Control.MouseEnterEvent:
                EventControl.AddEvents((int)Gdk.EventMask.EnterNotifyMask);
                EventControl.EnterNotifyEvent += Connector.HandleControlEnterNotifyEvent;
                break;

            case Eto.Forms.Control.MouseLeaveEvent:
                EventControl.AddEvents((int)Gdk.EventMask.LeaveNotifyMask);
                EventControl.LeaveNotifyEvent += Connector.HandleControlLeaveNotifyEvent;
                break;

            case Eto.Forms.Control.MouseMoveEvent:
                EventControl.AddEvents((int)Gdk.EventMask.ButtonMotionMask);
                EventControl.AddEvents((int)Gdk.EventMask.PointerMotionMask);
                //GtkControlObject.Events |= Gdk.EventMask.PointerMotionHintMask;
                EventControl.MotionNotifyEvent += Connector.HandleMotionNotifyEvent;
                break;

            case Eto.Forms.Control.MouseWheelEvent:
                EventControl.AddEvents((int)Gdk.EventMask.ScrollMask);
                EventControl.ScrollEvent += Connector.HandleScrollEvent;
                break;

            case Eto.Forms.Control.GotFocusEvent:
                EventControl.AddEvents((int)Gdk.EventMask.FocusChangeMask);
                EventControl.FocusInEvent += Connector.FocusInEvent;
                break;

            case Eto.Forms.Control.LostFocusEvent:
                EventControl.AddEvents((int)Gdk.EventMask.FocusChangeMask);
                EventControl.FocusOutEvent += Connector.FocusOutEvent;
                break;

            case Eto.Forms.Control.ShownEvent:
                EventControl.AddEvents((int)Gdk.EventMask.VisibilityNotifyMask);
                EventControl.VisibilityNotifyEvent += Connector.VisibilityNotifyEvent;
                break;

            default:
                base.AttachEvent(id);
                return;
            }
        }
Esempio n. 3
0
        public override void AttachEvent(string handler)
        {
            switch (handler)
            {
            case Eto.Forms.Control.KeyDownEvent:
                EventControl.AddEvents((int)Gdk.EventMask.KeyPressMask);
                EventControl.KeyPressEvent += GtkControlObject_KeyPressEvent;
                break;

            case Eto.Forms.Control.SizeChangedEvent:
                EventControl.AddEvents((int)Gdk.EventMask.StructureMask);
                EventControl.SizeAllocated += GtkControlObject_SizeAllocated;
                break;

            case Eto.Forms.Control.MouseDoubleClickEvent:
            case Eto.Forms.Control.MouseDownEvent:
                if (!mouseDownHandled)
                {
                    EventControl.AddEvents((int)Gdk.EventMask.ButtonPressMask);
                    EventControl.AddEvents((int)Gdk.EventMask.ButtonReleaseMask);
                    EventControl.ButtonPressEvent += GtkControlObject_ButtonPressEvent;
                    mouseDownHandled = true;
                }
                break;

            case Eto.Forms.Control.MouseUpEvent:
                EventControl.AddEvents((int)Gdk.EventMask.ButtonReleaseMask);
                EventControl.ButtonReleaseEvent += GtkControlObject_ButtonReleaseEvent;
                break;

            case Eto.Forms.Control.MouseEnterEvent:
                EventControl.AddEvents((int)Gdk.EventMask.EnterNotifyMask);
                EventControl.EnterNotifyEvent += HandleControlEnterNotifyEvent;
                break;

            case Eto.Forms.Control.MouseLeaveEvent:
                EventControl.AddEvents((int)Gdk.EventMask.LeaveNotifyMask);
                EventControl.LeaveNotifyEvent += HandleControlLeaveNotifyEvent;
                break;

            case Eto.Forms.Control.MouseMoveEvent:
                EventControl.AddEvents((int)Gdk.EventMask.ButtonMotionMask);
                EventControl.AddEvents((int)Gdk.EventMask.PointerMotionMask);
                //GtkControlObject.Events |= Gdk.EventMask.PointerMotionHintMask;
                EventControl.MotionNotifyEvent += GtkControlObject_MotionNotifyEvent;
                break;

            case Eto.Forms.Control.GotFocusEvent:
                EventControl.AddEvents((int)Gdk.EventMask.FocusChangeMask);
                EventControl.FocusInEvent += delegate {
                    Widget.OnGotFocus(EventArgs.Empty);
                };
                break;

            case Eto.Forms.Control.LostFocusEvent:
                EventControl.AddEvents((int)Gdk.EventMask.FocusChangeMask);
                EventControl.FocusOutEvent += delegate {
                    Widget.OnLostFocus(EventArgs.Empty);
                };
                break;

            case Eto.Forms.Control.ShownEvent:
                EventControl.AddEvents((int)Gdk.EventMask.VisibilityNotifyMask);
                EventControl.VisibilityNotifyEvent += (o, args) => {
                    if (args.Event.State == Gdk.VisibilityState.FullyObscured)
                    {
                        Widget.OnShown(EventArgs.Empty);
                    }
                };
                break;

            case Eto.Forms.Control.HiddenEvent:
                EventControl.AddEvents((int)Gdk.EventMask.VisibilityNotifyMask);
                EventControl.VisibilityNotifyEvent += (o, args) => {
                    if (args.Event.State != Gdk.VisibilityState.FullyObscured)
                    {
                        Widget.OnShown(EventArgs.Empty);
                    }
                };
                break;

            default:
                base.AttachEvent(handler);
                return;
            }
        }