public static void PrintFullSize(IScrollableControl c, string name) { int x = c.VisibleX; int y = c.VisibleY; c.VisibleX = 0; c.VisibleY = 0; Print(c, name, c.TotalClientWidth, c.TotalClientHeight); c.VisibleX = x; c.VisibleY = y; }
private bool InitDragToScroll(Control target, Vector2 globalPosition) { IScrollableControl scrollable = target as IScrollableControl; // HACK: Don't allow drag-to-scroll when pressing on interactive controls like buttons if ((target?.AcceptsMouseInput == true) && target.Enabled && (scrollable == null)) { if (DragToScrollTarget != null) { TeardownDragToScroll((Control)DragToScrollTarget, globalPosition); } DragToScrollTarget = null; return(false); } while (target != null) { if ( (scrollable != null) && // Some controls are scrollable but do not currently have any hidden content, so don't drag them (scrollable.MaxScrollOffset ?? scrollable.MinScrollOffset) != scrollable.MinScrollOffset ) { break; } if (!target.TryGetParent(out target)) { break; } scrollable = target as IScrollableControl; } if ( (scrollable == null) || !scrollable.AllowDragToScroll || ((scrollable.MaxScrollOffset ?? scrollable.MinScrollOffset) == scrollable.MinScrollOffset) ) { if (DragToScrollTarget != null) { TeardownDragToScroll((Control)DragToScrollTarget, globalPosition); } DragToScrollTarget = null; return(false); } DragToScrollInitialPosition = globalPosition; DragToScrollTarget = scrollable; DragToScrollInitialOffset = scrollable.ScrollOffset; FireEvent(UIEvents.DragToScrollStart, (Control)scrollable); return(true); }
/// <summary>TODO</summary> /// <param name="this">The <see cref="IScrollableControl"/> to be scrolled.</param> /// <param name="delta"></param> public static void RollHorizontal(this IScrollableControl @this, int delta) { @this.UnappliedScroll += new Size(delta, 0);// += delta; while (@this.UnappliedScroll.X >= MouseWheelStep) { @this.HScrollByOffset(+MouseWheelStep); @this.UnappliedScroll -= new Size(MouseWheelStep, 0); } while (@this.UnappliedScroll.X <= -MouseWheelStep) { @this.HScrollByOffset(-MouseWheelStep); @this.UnappliedScroll += new Size(MouseWheelStep, 0); } }
/// <summary>TODO</summary> /// <param name="this">The <see cref="IScrollableControl"/> to be scrolled.</param> /// <param name="delta"></param> public static void RollVertical(this IScrollableControl @this, int delta) { @this.UnappliedScroll += new Size(0, delta); while (@this.UnappliedScroll.Y >= MouseWheelStep) { @this.VScrollByOffset(+MouseWheelStep); @this.UnappliedScroll -= new Size(0, MouseWheelStep); } while (@this.UnappliedScroll.Y <= -MouseWheelStep) { @this.VScrollByOffset(-MouseWheelStep); @this.UnappliedScroll += new Size(0, MouseWheelStep); } }
internal HorizontalScrollBarView(IScrollableControl main) { this.main = main; }
internal VerticalScrollBarView(IScrollableControl main) { this.main = main; }
internal HorizontalScrollBarView(IScrollableControl main, float sfx) : base(main, sfx) { }
/// <summary>TODO</summary> public static void LineRight(this IScrollableControl @this) => @this.RollHorizontal(+1 * MouseWheelStep);
public static void ScrollPanel(this IScrollableControl @this, ScrollEventType type, ScrollOrientation orientation, int sign) => ScrollActions[ScrollActionIndex(type, orientation, sign)](@this);
/// <summary>TODO</summary> public static void LineDown(this IScrollableControl @this) => @this.RollVertical(+1 * MouseWheelStep);
/// <summary>TODO</summary> public static void PageRight(this IScrollableControl @this) => @this.RollHorizontal(+1 * @this.ScrollLargeChange.X);
/// <summary>TODO</summary> public static void PageDown(this IScrollableControl @this) => @this.RollVertical(+1 * @this.ScrollLargeChange.Y);
public static void PrintVisibleSize(IScrollableControl c, string name) { Print(c, name, c.ClientWidth, c.ClientHeight); }
/// <summary>TODO</summary> /// <param name="this">The <see cref="IScrollableControl"/> to be scrolled.</param> /// <param name="delta">The amount to be scrolled.</param> public static void VScrollByOffset(this IScrollableControl @this, int delta) => @this.AutoScrollPosition = new Point([email protected], [email protected] + delta);
internal VerticalScrollBarView(IScrollableControl main, float sfx) : base(main, sfx) { }
public static void PrintVisibleSize(IScrollableControl c, string name) { Print(c, name, c.Width1, c.Height1); }
internal ScrollBarView(IScrollableControl main, float sfx) { this.main = main; this.sfx = sfx; }