예제 #1
0
        void OnMouseDown(object sender, MouseEventArgs args)
        {
            if (args.Button != MouseButton.Left || !Resizable)
            {
                return;
            }

            args.Consume();
            IsDragging = true;
            var hitPoint = args.Position;

            switch (Direction)
            {
            case Direction.Left:
                dragOffset = SplitterOffset - hitPoint.X;
                break;

            case Direction.Right:
                dragOffset = SplitterOffset + hitPoint.X;
                break;

            case Direction.Up:
                dragOffset = SplitterOffset - hitPoint.Y;
                break;

            case Direction.Down:
                dragOffset = SplitterOffset + hitPoint.Y;
                break;
            }
        }
예제 #2
0
        void OnMouseDragged(object sender, MouseEventArgs args)
        {
            if (!Resizable)
            {
                IsDragging = false;
                return;
            }

            if (IsDragging)
            {
                args.Consume();
                var hitPoint = args.Position;
                switch (Direction)
                {
                case Direction.Left:
                    SplitterOffset = dragOffset + hitPoint.X;
                    break;

                case Direction.Right:
                    SplitterOffset = dragOffset - hitPoint.X;
                    break;

                case Direction.Up:
                    SplitterOffset = dragOffset + hitPoint.Y;
                    break;

                case Direction.Down:
                    SplitterOffset = dragOffset - hitPoint.Y;
                    break;
                }
            }
        }
예제 #3
0
 void OnMouseClick(object sender, MouseEventArgs args)
 {
     if (args.Button == MouseButton.Left)
     {
         args.Consume();
         ActivateTab();
     }
 }
예제 #4
0
 void OnMouseClick(object sender, MouseEventArgs args)
 {
     args.Consume();
     if (Collapsable && Resizable)
     {
         ToggleCollapse();
     }
 }
예제 #5
0
        void OnMouseUp(object source, MouseEventArgs args)
        {
            if (args.Button != MouseButton.Left)
            {
                return;
            }

            args.Consume();
            pressed = false;
        }
예제 #6
0
        void OnMouseUp(object source, MouseEventArgs args)
        {
            if (args.Button != MouseButton.Left)
            {
                return;
            }

            args.Consume();
            OnActivateUp();
        }
        void OnMouseDragged(object source, MouseEventArgs args)
        {
            if (isDragging)
            {
                args.Consume();

                int  offset;
                Bias bias;
                if (Content.ViewToModel(args.Position, out offset, out bias))
                {
                    NavigateTo(offset, true);
                }
            }
        }
예제 #8
0
        void OnMouseDragged(object source, MouseEventArgs args)
        {
            if (pressed)
            {
                args.Consume();

                var progress = MousePositionToValue(args.Position.X);
                var newValue = MinValue + (int)Math.Floor(progress * (MaxValue - MinValue) / Step + 0.5f) * Step;

                if (Math.Abs(newValue - Value) > 0.005)
                {
                    Value = newValue;
                }
            }
        }
예제 #9
0
        void OnMouseWheel(object source, MouseEventArgs args)
        {
            args.Consume();

            var scrollWheelDelta = args.ScrollWheelDelta;

            if ((scrollWheelDelta < 0 && Offset >= MaximumVisibleOffset) || (scrollWheelDelta > 0 && Offset <= 0))
            {
                return;
            }

            var delta = (int)(-scrollWheelDelta * Math.Max(0, ScrollUnit));

            Scroll(delta);
        }
예제 #10
0
        void OnMouseDragged(object source, MouseEventArgs args)
        {
            if (isDragging)
            {
                args.Consume();

                var mouseDragPoint = args.Position;
                var mouseDragDelta = mouseDragPoint.Y - lastMouseDragPoint.Y;

                var borderRect = BorderRect;
                mouseOffset       += (float)mouseDragDelta * borderRect.Height / ScrollbarThumbHeight;
                lastMouseDragPoint = mouseDragPoint;
                ScrollTo(mouseOffset, true);
            }
        }
예제 #11
0
        void OnMouseDown(object source, MouseEventArgs args)
        {
            if (args.Button != MouseButton.Left)
            {
                return;
            }

            args.Consume();

            pressed = true;
            Tooltip?.DisplayNow();

            var progress = MousePositionToValue(args.Position.X);

            Value = MinValue + (int)Math.Floor(progress * (MaxValue - MinValue) / Step + 0.5f) * Step;
        }
예제 #12
0
            void OnMouseDragged(object sender, MouseEventArgs args)
            {
                if (DraggedTab != null)
                {
                    var deltaX = args.Position.X - DraggedTabEventOrigin;
                    if (Math.Abs(deltaX) > 5)
                    {
                        DragActive = true;
                    }

                    DraggedTabOffset = DraggedTabOffsetOrigin + deltaX;
                    parent.InvalidateLayout();

                    args.Consume();
                }
            }
예제 #13
0
            void OnMouseDown(object sender, MouseEventArgs args)
            {
                if (args.Button != MouseButton.Left || parent.AllowDragReorder == false)
                {
                    return;
                }

                DraggedTab = sender as NotebookTab;
                if (DraggedTab != null)
                {
                    DraggedTabOffsetOrigin = DraggedTab.LayoutRect.X;
                    DraggedTabEventOrigin  = args.Position.X;
                    DraggedTabOffset       = DraggedTab.LayoutRect.X;
                }
                args.Consume();
            }
예제 #14
0
        void OnMouseClick(object source, MouseEventArgs args)
        {
            args.Consume();
            var borderRect      = BorderRect;
            var scrollBarTop    = borderRect.Top + ScrollbarThumbOffset;
            var scrollbarBottom = borderRect.Top + ScrollbarThumbOffset + ScrollbarThumbHeight;

            if (args.Position.Y < scrollBarTop)
            {
                var x = Math.Max(1, borderRect.Height - ScrollbarThumbHeight) / 2;
                Scroll(-TranslateMouseOffsetToScrollOffset(x));
            }
            else if (args.Position.Y > scrollbarBottom)
            {
                var x = Math.Max(1, borderRect.Height - ScrollbarThumbHeight) / 2;
                Scroll(TranslateMouseOffsetToScrollOffset(x));
            }
        }
예제 #15
0
        void OnMouseDown(object source, MouseEventArgs args)
        {
            if (args.Button != MouseButton.Left)
            {
                return;
            }

            args.Consume();
            isDragging = true;

            int  offset;
            Bias bias;

            if (Content.ViewToModel(args.Position, out offset, out bias))
            {
                NavigateTo(offset, args.Flags.IsShiftDown());
            }
        }
예제 #16
0
            void OnMouseUp(object sender, MouseEventArgs args)
            {
                if (DraggedTab == null || DragActive == false)
                {
                    return;
                }

                args.Consume();

                var idx = parent.IndexOf(DraggedTab);

                if (idx == -1)
                {
                    DraggedTab = null;
                    return;
                }
                var insertIdx = FindInsertIndex();

                if (insertIdx != idx)
                {
                    var focused   = parent.Screen?.FocusManager?.FocusedWidget;
                    var activeTab = parent.ActiveTab;

                    parent.Remove(DraggedTab);
                    var newIndex = FindInsertIndex();
                    parent.Add(DraggedTab, newIndex);

                    if (focused != null)
                    {
                        parent.Screen.FocusManager.FocusedWidget = focused;
                    }
                    parent.ActiveTab = activeTab;
                    parent.InvalidateLayout();
                }

                DragActive             = false;
                DraggedTab             = null;
                DraggedTabOffset       = 0;
                DraggedTabOffsetOrigin = 0;
                DraggedTabEventOrigin  = 0;
            }
예제 #17
0
        void OnMouseDown(object source, MouseEventArgs args)
        {
            if (args.Button != MouseButton.Left)
            {
                return;
            }

            args.Consume();

            var borderRect      = BorderRect;
            var scrollBarTop    = borderRect.Top + ScrollbarThumbOffset;
            var scrollbarBottom = borderRect.Top + ScrollbarThumbOffset + ScrollbarThumbHeight;

            var inside = borderRect.Contains(args.Position);

            if ((inside && args.Position.Y >= scrollBarTop && args.Position.Y <= scrollbarBottom) || !inside)
            {
                isDragging         = true;
                lastMouseDragPoint = args.Position;
                mouseOffset        = Offset;
            }
        }
예제 #18
0
 void OnMouseDown(object sender, MouseEventArgs e)
 {
     this.RequestFocus();
     e.Consume();
 }
예제 #19
0
 void OnMouseClick(object source, MouseEventArgs args)
 {
     Click();
     args.Consume();
 }
예제 #20
0
 void OnMouseClick(object source, MouseEventArgs args)
 {
     selectionChangedSupport.Raise(this, ListSelectionEventArgs.Confirmed);
     args.Consume();
 }
예제 #21
0
 void OnMouseUp(object sender, MouseEventArgs args)
 {
     args.Consume();
     IsDragging = false;
 }