示例#1
0
 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;
 }
示例#2
0
        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);
        }
示例#3
0
        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;
        }
示例#4
0
 /// <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);
     }
 }
示例#5
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)
 {
 }
示例#9
0
 internal VerticalScrollBarView(IScrollableControl main)
 {
     this.main = main;
 }
示例#10
0
 /// <summary>TODO</summary>
 public static void LineRight(this IScrollableControl @this)
 => @this.RollHorizontal(+1 * MouseWheelStep);
示例#11
0
 public static void ScrollPanel(this IScrollableControl @this, ScrollEventType type,
                                ScrollOrientation orientation, int sign)
 => ScrollActions[ScrollActionIndex(type, orientation, sign)](@this);
示例#12
0
 /// <summary>TODO</summary>
 public static void LineDown(this IScrollableControl @this)
 => @this.RollVertical(+1 * MouseWheelStep);
示例#13
0
 /// <summary>TODO</summary>
 public static void PageRight(this IScrollableControl @this)
 => @this.RollHorizontal(+1 * @this.ScrollLargeChange.X);
示例#14
0
 /// <summary>TODO</summary>
 public static void PageDown(this IScrollableControl @this)
 => @this.RollVertical(+1 * @this.ScrollLargeChange.Y);
示例#15
0
 public static void PrintVisibleSize(IScrollableControl c, string name)
 {
     Print(c, name, c.ClientWidth, c.ClientHeight);
 }
示例#16
0
 /// <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);
示例#17
0
 public static void PrintVisibleSize(IScrollableControl c, string name)
 {
     Print(c, name, c.ClientWidth, c.ClientHeight);
 }
 internal VerticalScrollBarView(IScrollableControl main, float sfx) : base(main, sfx)
 {
 }
示例#19
0
 public static void PrintVisibleSize(IScrollableControl c, string name)
 {
     Print(c, name, c.Width1, c.Height1);
 }
示例#20
0
 internal ScrollBarView(IScrollableControl main, float sfx)
 {
     this.main = main;
     this.sfx  = sfx;
 }
示例#21
0
 internal HorizontalScrollBarView(IScrollableControl main)
 {
     this.main = main;
 }
示例#22
0
 public static void PrintVisibleSize(IScrollableControl c, string name)
 {
     Print(c, name, c.Width1, c.Height1);
 }