void ChaosDisplayMouseScrolledEvent(object pSender, ScrollEventArgs pArguments) { //Todo: alter this to scale based on size, but probably on a linear ramp. if (!this.Rendering) { Gdk.EventScroll tmpEventInfo = pArguments.Event; switch (tmpEventInfo.Direction) { case Gdk.ScrollDirection.Up: this._ZoomFactor = Math.Min(this._ZoomFactor + 0.25, 100.0); //this.Write_To_Log ( "Zooming In To 1/"+this.Zoom_Factor.ToString() ); this.ChaosDisplayRefactorZoom(this._OutputChaosRenderingMachine._ZoomCenterpointX, this._OutputChaosRenderingMachine._ZoomCenterpointY); break; case Gdk.ScrollDirection.Down: this._ZoomFactor = Math.Max(this._ZoomFactor - 0.25, 1.0); //this.Write_To_Log ( "Zooming Out To 1/"+this.Zoom_Factor.ToString() ); this.ChaosDisplayRefactorZoom(this._OutputChaosRenderingMachine._ZoomCenterpointX, this._OutputChaosRenderingMachine._ZoomCenterpointY); break; } } pArguments.RetVal = true; }
internal void OnMouseWheel(object o, ScrollEventArgs args) { Gdk.EventScroll e = args.Event; if (e.Direction == Gdk.ScrollDirection.Down) { double newValue = dvDisplay.VScroll.Value + dvDisplay.VScroll.Adjustment.StepIncrement; if (newValue <= dvDisplay.VScroll.Adjustment.Upper - dvDisplay.VScroll.Adjustment.PageSize) { dvDisplay.VScroll.Value = newValue; } else { dvDisplay.VScroll.Value = dvDisplay.VScroll.Adjustment.Upper - dvDisplay.VScroll.Adjustment.PageSize; } } else if (e.Direction == Gdk.ScrollDirection.Up) { double newValue = dvDisplay.VScroll.Value - dvDisplay.VScroll.Adjustment.StepIncrement; if (newValue >= dvDisplay.VScroll.Adjustment.Lower) { dvDisplay.VScroll.Value = newValue; } else { dvDisplay.VScroll.Value = dvDisplay.VScroll.Adjustment.Lower; } } }
protected override bool OnScrollEvent(Gdk.EventScroll evnt) { bool res = base.OnScrollEvent(evnt); CreateEvent(evnt); return(res); }
void CreateEvent(Gdk.EventScroll refEvent) { int rx, ry; tree.BinWindow.GetOrigin(out rx, out ry); NativeEventScrollStruct nativeEvent = new NativeEventScrollStruct(); nativeEvent.type = refEvent.Type; nativeEvent.send_event = 1; nativeEvent.window = tree.BinWindow.Handle; nativeEvent.x = refEvent.XRoot - rx; nativeEvent.y = refEvent.YRoot - ry; nativeEvent.x_root = refEvent.XRoot; nativeEvent.y_root = refEvent.YRoot; nativeEvent.time = refEvent.Time; nativeEvent.direction = refEvent.Direction; nativeEvent.state = (uint)refEvent.State; nativeEvent.device = refEvent.Device.Handle; IntPtr ptr = GLib.Marshaller.StructureToPtrAlloc(nativeEvent); try { Gdk.EventScroll evnt = new Gdk.EventScroll(ptr); Gdk.EventHelper.Put(evnt); } finally { Marshal.FreeHGlobal(ptr); } }
protected override bool OnScrollEvent(Gdk.EventScroll evnt) { if (evnt.Direction == Gdk.ScrollDirection.Down || evnt.Direction == Gdk.ScrollDirection.Up) { double startX, startY; ScreenToDrawingCoords(evnt.X, evnt.Y, out startX, out startY); if (evnt.Direction == Gdk.ScrollDirection.Down) { scale *= SCROLL_FACTOR; } else { scale /= SCROLL_FACTOR; } double endX, endY; ScreenToDrawingCoords(evnt.X, evnt.Y, out endX, out endY); transformX += (endX - startX) * scale; transformY += (endY - startY) * scale; QueueDraw(); return(true); } return(false); }
public static void GetPageScrollPixelDeltas(this Gdk.EventScroll evt, double pageSizeX, double pageSizeY, out double deltaX, out double deltaY) { if (!GetEventScrollDeltas(evt, out deltaX, out deltaY)) { var direction = evt.Direction; deltaX = deltaY = 0; if (pageSizeY != 0 && (direction == Gdk.ScrollDirection.Down || direction == Gdk.ScrollDirection.Up)) { deltaY = System.Math.Pow(pageSizeY, 2.0 / 3.0); deltaX = 0.0; if (direction == Gdk.ScrollDirection.Up) { deltaY = -deltaY; } } else if (pageSizeX != 0) { deltaX = System.Math.Pow(pageSizeX, 2.0 / 3.0); deltaY = 0.0; if (direction == Gdk.ScrollDirection.Left) { deltaX = -deltaX; } } } }
protected override bool OnScrollEvent(Gdk.EventScroll evnt) { var s = GetRowByPosition((int)evnt.Y); Selection = s; return(base.OnScrollEvent(evnt)); }
/// <summary> /// Creates the mouse wheel event arguments. /// </summary> /// <param name="e">The scroll event args.</param> /// <returns>Mouse event arguments.</returns> private static OxyMouseWheelEventArgs GetMouseWheelEventArgs(Gdk.EventScroll e) { return(new OxyMouseWheelEventArgs { Delta = e.Direction == Gdk.ScrollDirection.Down ? -120 : 120, Position = new ScreenPoint(e.X, e.Y), ModifierKeys = ConverterExtensions.GetModifiers(e.State) }); }
protected override bool OnScrollEvent(Gdk.EventScroll evnt) { if (can_seek) { SeekValue += (evnt.Direction.Equals(Gdk.ScrollDirection.Down) ? -1 : 1) * 10000; // skip 10s OnSeekRequested(); } return(base.OnScrollEvent(evnt)); }
protected override bool OnScrollEvent(Gdk.EventScroll scroll) { if ((scroll.State & Gdk.ModifierType.ControlMask) != 0) { Zoom += (scroll.Direction == Gdk.ScrollDirection.Up) ? ZOOM_STEP : -ZOOM_STEP; return(true); } return(base.OnScrollEvent(scroll)); }
protected override bool OnScrollEvent(Gdk.EventScroll evnt) { if (evnt.Direction == Gdk.ScrollDirection.Down) { vscrollbar1.Value = vscrollbar1.Value + 1; } else if (evnt.Direction == Gdk.ScrollDirection.Up) { vscrollbar1.Value = vscrollbar1.Value - 1; } return(base.OnScrollEvent(evnt)); }
public static bool GetEventScrollDeltas(Gdk.EventScroll evt, out double deltaX, out double deltaY) { if (!scrollDeltasNotSupported) { try { return(gdk_event_get_scroll_deltas(evt.Handle, out deltaX, out deltaY)); } catch (EntryPointNotFoundException) { scrollDeltasNotSupported = true; } } deltaX = deltaY = 0; return(false); }
private bool InternalScrollEvent(Gdk.EventScroll evnt) { ScrollEventNativeDelegate unmanaged = class_abi.BaseOverride <ScrollEventNativeDelegate>(this.LookupGType(), "scroll_event"); if (unmanaged == null) { return(false); } bool __result = unmanaged(this.Handle, evnt == null ? IntPtr.Zero : evnt.Handle); return(__result); }
protected override bool OnScrollEvent(Gdk.EventScroll evnt) { Gdk.ModifierType state = Gtk.Accelerator.DefaultModMask & evnt.State; bool ret = base.OnScrollEvent(evnt); if (state == Gdk.ModifierType.Mod1Mask) { return(SwitchRuler(evnt.Direction == Gdk.ScrollDirection.Up) || ret); } else { return(Zoom(evnt.X, evnt.Y, evnt.Direction == Gdk.ScrollDirection.Up, evnt.State) || ret); } }
internal bool HandleScroll(Gdk.EventScroll args) { switch (args.Direction) { case Gdk.ScrollDirection.Up: case Gdk.ScrollDirection.Right: Value++; return(true); case Gdk.ScrollDirection.Down: case Gdk.ScrollDirection.Left: Value--; return(true); } return(false); }
private bool InternalScrollEvent(Gdk.EventScroll evnt) { ScrollEventNativeDelegate unmanaged = null; unsafe { IntPtr *raw_ptr = (IntPtr *)(((long)this.LookupGType().GetThresholdType().GetClassPtr()) + (long)class_abi.GetFieldOffset("scroll_event")); unmanaged = (ScrollEventNativeDelegate)Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(ScrollEventNativeDelegate)); } if (unmanaged == null) { return(false); } bool __result = unmanaged(this.Handle, evnt == null ? IntPtr.Zero : evnt.Handle); return(__result); }
protected override bool OnScrollEvent(Gdk.EventScroll evnt) { if (evnt.Type != Gdk.EventType.Scroll) { return(false); } if (evnt.Direction == Gdk.ScrollDirection.Up) { AdjustVolume(1); } else if (evnt.Direction == Gdk.ScrollDirection.Down) { AdjustVolume(-1); } return(true); }
protected override bool OnScrollEvent(Gdk.EventScroll evnt) { switch (evnt.Direction) { case Gdk.ScrollDirection.Up: if ((evnt.State & Gdk.ModifierType.ControlMask) != 0) { ServiceManager.PlayerEngine.Volume += PlayerEngine.VolumeDelta; } else if ((evnt.State & Gdk.ModifierType.ShiftMask) != 0) { ServiceManager.PlayerEngine.Position += PlayerEngine.SkipDelta; } else { ServiceManager.PlaybackController.Next(); } break; case Gdk.ScrollDirection.Down: if ((evnt.State & Gdk.ModifierType.ControlMask) != 0) { if (ServiceManager.PlayerEngine.Volume < PlayerEngine.VolumeDelta) { ServiceManager.PlayerEngine.Volume = 0; } else { ServiceManager.PlayerEngine.Volume -= PlayerEngine.VolumeDelta; } } else if ((evnt.State & Gdk.ModifierType.ShiftMask) != 0) { ServiceManager.PlayerEngine.Position -= PlayerEngine.SkipDelta; } else { ServiceManager.PlaybackController.Previous(); } break; } return(true); }
/// <summary> /// Creates the mouse wheel event arguments. /// </summary> /// <param name="e">The scroll event args.</param> /// <returns>Mouse event arguments.</returns> private static OxyMouseWheelEventArgs GetMouseWheelEventArgs(Gdk.EventScroll e) { int delta; #if NETSTANDARD2_0 if (e.Direction == Gdk.ScrollDirection.Smooth) { delta = e.DeltaY < 0 ? 120 : -120; } else #endif delta = e.Direction == Gdk.ScrollDirection.Down ? -120 : 120; return(new OxyMouseWheelEventArgs { Delta = delta, Position = new ScreenPoint(e.X, e.Y), ModifierKeys = ConverterExtensions.GetModifiers(e.State) }); }
protected virtual bool OnScrollEvent(Gdk.EventScroll evnt) { return(InternalScrollEvent(evnt)); }
protected override bool OnScrollEvent(Gdk.EventScroll evnt) { _editorScene.ZoomCamera(evnt.Direction == Gdk.ScrollDirection.Up); return(true); }
protected override bool OnScrollEvent(Gdk.EventScroll args) { return(HandleScroll(args)); }
protected override bool OnScrollEvent(Gdk.EventScroll e) { e.Direction = DetermineScrollDirection(e); return(base.OnScrollEvent(e)); }
private Gdk.ScrollDirection DetermineScrollDirection(Gdk.EventScroll e) { var nativeScrollEvent = (GdkNativeScrollStruct)System.Runtime.InteropServices.Marshal.PtrToStructure(e.Handle, typeof(GdkNativeScrollStruct)); return(nativeScrollEvent.delta_y > 0 ? Gdk.ScrollDirection.Down : Gdk.ScrollDirection.Up); }
protected override bool OnScrollEvent(Gdk.EventScroll evnt) { QueueDraw(); return(base.OnScrollEvent(evnt)); }
protected override bool OnScrollEvent(Gdk.EventScroll evnt) { return(entry.HandleScroll(evnt)); }
void CreateEvent (Gdk.EventScroll refEvent) { int rx, ry; tree.BinWindow.GetOrigin (out rx, out ry); NativeEventScrollStruct nativeEvent = new NativeEventScrollStruct (); nativeEvent.type = refEvent.Type; nativeEvent.send_event = 1; nativeEvent.window = tree.BinWindow.Handle; nativeEvent.x = refEvent.XRoot - rx; nativeEvent.y = refEvent.YRoot - ry; nativeEvent.x_root = refEvent.XRoot; nativeEvent.y_root = refEvent.YRoot; nativeEvent.time = refEvent.Time; nativeEvent.direction = refEvent.Direction; nativeEvent.state = (uint) refEvent.State; nativeEvent.device = refEvent.Device.Handle; IntPtr ptr = GLib.Marshaller.StructureToPtrAlloc (nativeEvent); try { Gdk.EventScroll evnt = new Gdk.EventScroll (ptr); Gdk.EventHelper.Put (evnt); } finally { Marshal.FreeHGlobal (ptr); } }