Esempio n. 1
0
        void OnScrollEvent(object o, Gtk.ScrollEventArgs args)
        {
            var    evnt  = args.Event;
            double step  = 1;
            var    delta = new Vector();

            if (evnt.Direction == ScrollDirection.Down)
            {
                delta = new Vector(0, -step);
            }
            else if (evnt.Direction == ScrollDirection.Up)
            {
                delta = new Vector(0, step);
            }
            else if (evnt.Direction == ScrollDirection.Right)
            {
                delta = new Vector(-step, 0);
            }
            if (evnt.Direction == ScrollDirection.Left)
            {
                delta = new Vector(step, 0);
            }
            var e = new RawMouseWheelEventArgs(GtkMouseDevice.Instance, evnt.Time, _inputRoot, new Point(evnt.X, evnt.Y), delta, GetModifierKeys(evnt.State));

            Input(e);
        }
Esempio n. 2
0
        protected virtual MouseScrolledEventArgs GetScrollEventArgs(Gtk.ScrollEventArgs args)
        {
            var direction      = args.Event.Direction.ToXwtValue();
            var pointer_coords = EventsRootWidget.CheckPointerCoordinates(args.Event.Window, args.Event.X, args.Event.Y);

            return(new MouseScrolledEventArgs((long)args.Event.Time, pointer_coords.X, pointer_coords.Y, direction));
        }
Esempio n. 3
0
            public void HandleScrollEvent(object o, Gtk.ScrollEventArgs args)
            {
                var          p         = new PointF((float)args.Event.X, (float)args.Event.Y);
                Key          modifiers = args.Event.State.ToEtoKey();
                MouseButtons buttons   = args.Event.State.ToEtoMouseButtons();
                SizeF        delta;

                switch (args.Event.Direction)
                {
                case Gdk.ScrollDirection.Down:
                    delta = new SizeF(0f, -ScrollAmount);
                    break;

                case Gdk.ScrollDirection.Left:
                    delta = new SizeF(ScrollAmount, 0f);
                    break;

                case Gdk.ScrollDirection.Right:
                    delta = new SizeF(-ScrollAmount, 0f);
                    break;

                case Gdk.ScrollDirection.Up:
                    delta = new SizeF(0f, ScrollAmount);
                    break;

                default:
                    throw new NotSupportedException();
                }

                Handler.Widget.OnMouseWheel(new MouseEventArgs(buttons, modifiers, p, delta));
            }
Esempio n. 4
0
 void FlowsheetSurface_GTK_ScrollEvent(object o, Gtk.ScrollEventArgs args)
 {
     if (args.Event.Direction == Gdk.ScrollDirection.Down)
     {
         fsurface.Zoom += -5 / 100f;
     }
     else
     {
         fsurface.Zoom += 5 / 100f;
     }
     this.QueueDraw();
 }
Esempio n. 5
0
        void HandleScrollEvent(object o, Gtk.ScrollEventArgs args)
        {
            var direction = args.Event.Direction.ToXwtValue();

            var a = new MouseScrolledEventArgs((long)args.Event.Time, args.Event.X, args.Event.Y, direction);

            ApplicationContext.InvokeUserCode(delegate {
                EventSink.OnMouseScrolled(a);
            });
            if (a.Handled)
            {
                args.RetVal = true;
            }
        }
Esempio n. 6
0
        void HandleScrollEvent(object o, Gtk.ScrollEventArgs args)
        {
            var sc        = ConvertToScreenCoordinates(new Point(0, 0));
            var direction = Util.ConvertScrollDirection(args.Event.Direction);

            var a = new MouseScrolledEventArgs((long)args.Event.Time, args.Event.XRoot - sc.X, args.Event.YRoot - sc.Y, direction);

            Toolkit.Invoke(delegate {
                EventSink.OnMouseScrolled(a);
            });
            if (a.Handled)
            {
                args.RetVal = true;
            }
        }
Esempio n. 7
0
        void HandleScrollEvent(object o, Gtk.ScrollEventArgs args)
        {
            var a = GetScrollEventArgs(args);

            if (a == null)
            {
                return;
            }
            ApplicationContext.InvokeUserCode(delegate {
                EventSink.OnMouseScrolled(a);
            });
            if (a.Handled)
            {
                args.RetVal = true;
            }
        }
Esempio n. 8
0
 private void HandleScrollEvent(object sender, Gtk.ScrollEventArgs args)
 {
     //For right now we just disable fit mode and let the parent event handlers deal
     //with the real actions.
     this.Fit = false;
 }
Esempio n. 9
0
        protected virtual MouseScrolledEventArgs GetScrollEventArgs(Gtk.ScrollEventArgs args)
        {
            var direction = args.Event.Direction.ToXwtValue();

            return(new MouseScrolledEventArgs((long)args.Event.Time, args.Event.X, args.Event.Y, direction));
        }
Esempio n. 10
0
            public void HandleScrollableScrollEvent(object o, Gtk.ScrollEventArgs args)
            {
                var pos = new Point((int)args.Event.X, (int)args.Event.Y);

                Handler.Callback.OnScroll(Handler.Widget, new ScrollEventArgs(pos));
            }