示例#1
0
 public override void OnMouseUp(MouseWithKeysEventArgs e)
 {
     base.OnMouseUp(e);
     State = ButtonState.Normal;
     Redraw();
     RaiseMouseUp(e);
 }
示例#2
0
 public override void OnMouseDown(MouseWithKeysEventArgs e)
 {
     base.OnMouseUp(e);
     State = ButtonState.Pushed;
     Redraw();
     RaiseMouseDown(e);
 }
示例#3
0
        /// <summary>
        /// Finds and selects a new control to focus based on
        /// where the mouse has clicked
        /// </summary>
        /// <returns>true if anything has been changed</returns>
        private bool FindFocusedControl(MouseWithKeysEventArgs e)
        {
            if (!e.IsLeftButtonPressed)
            {
                return false;
            }
            Control clickedControl = this.FindControlAtPoint(e.X, e.Y);

            if (clickedControl != null
                && clickedControl != this.FocusControl)
            {
                if (clickedControl.CanGetFocus)
                {
                    clickedControl.SetFocus();
                    return true;
                }
                else
                {
                    clickedControl = clickedControl.FindNearestFocusableParent();
                    if (clickedControl != null
                        && clickedControl != this.FocusControl
                        && clickedControl.CanGetFocus)
                    {
                        clickedControl.SetFocus();
                        return true;
                    }
                }
            }

            return false;
        }
示例#4
0
 public override void OnMouseDown(MouseWithKeysEventArgs e)
 {
     using (RedrawAccumulator a = new RedrawAccumulator(this))
     {
         base.OnMouseDown(e);
         FindFocusedControl(e);
     }
 }
示例#5
0
        public override void OnDoubleClick(MouseWithKeysEventArgs e)
        {
            if (this.IsFocused)
            {
                this.SetSelection(0, this.TextLength);
                AfterCaretChanged();
            }

            RaiseDoubleClick(e);
        }
示例#6
0
        public override void OnMouseMove(MouseWithKeysEventArgs e)
        {
            base.OnMouseMove(e);

            // TODO: Saska: Commenting selection out
            // for a stable build
            #if false
            if (e.IsLeftButtonPressed)
            {
                Control clickedControl = this.FindControlAtPoint(e.X, e.Y);
                if (clickedControl != null && !(clickedControl is RootControl)) clickedControl.OnMouseMove(e);
                Redraw();
            }
            #endif
        }
        public override void OnClick(MouseWithKeysEventArgs e)
        {
            DefaultMouseHandler = ShapeToForwardMouseEventTo(e);
            if (DefaultMouseHandler != null)
            {
                DefaultMouseHandler.OnClick(e);
            }

            if (e.Handled)
            {
                return;
            }

            RaiseClick(e);
        }
示例#8
0
        public override void OnMouseDown(MouseWithKeysEventArgs e)
        {
            WasMouseDown = true;

            bool shouldPositionCaret =
                e.Button == System.Windows.Forms.MouseButtons.Left
                || (e.Button == System.Windows.Forms.MouseButtons.Right
                    && this.SelectionLength == 0);

            if (shouldPositionCaret)
            {
                int newCaretPosition = CursorStringPosition(e.X);
                if (CaretPosition != newCaretPosition)
                {
                    CaretPosition = newCaretPosition;

                    if (!e.IsShiftPressed)
                    {
                        ResetSelection();
                    }

                    AfterCaretChanged();
                    SetFocus();
                    //e.Handled = true;
                }
                else if (this.SelectionLength != 0)
                {
                    ResetSelection();
                    AfterCaretChanged();
                    SetFocus();
                    //e.Handled = true;
                }
            }

            // commenting this out because we always want the
            // event to propagate to the root
            // (for drag & drop purposes)
            //if (!e.Handled)
            //{
                RaiseMouseDown(e);
            //}
        }
        public override void OnMouseDown(MouseWithKeysEventArgs e)
        {
            if (Capture != null)
            {
                Capture.OnMouseDown(e);
            }
            else
            {
                IShape clicked = ShapeToForwardMouseEventTo(e);
                DefaultMouseHandler = clicked;
                if (DefaultMouseHandler != null)
                {
                    Capture = clicked;
                    DefaultMouseHandler.OnMouseDown(e);
                }
            }

            if (e.Handled)
            {
                return;
            }

            RaiseMouseDown(e);
        }
示例#10
0
 public override void OnDoubleClick(MouseWithKeysEventArgs e)
 {
     base.OnDoubleClick(e);
     RaiseDoubleClick(e);
 }
示例#11
0
 protected void RaiseMouseWheel(MouseWithKeysEventArgs e)
 {
     if (MouseWheel != null)
     {
         MouseWheel(e);
     }
 }
示例#12
0
 protected void RaiseMouseUp(MouseWithKeysEventArgs e)
 {
     if (MouseUp != null)
     {
         MouseUp(e);
     }
 }
示例#13
0
 protected void RaiseMouseHover(MouseWithKeysEventArgs e)
 {
     if (MouseHover != null)
     {
         MouseHover(e);
     }
 }
示例#14
0
 protected void RaiseMouseDown(MouseWithKeysEventArgs e)
 {
     if (MouseDown != null)
     {
         MouseDown(e);
     }
 }
示例#15
0
 protected override void OnDoubleClick(MouseWithKeysEventArgs MouseInfo)
 {
     ShouldShowCompletion();
 }
示例#16
0
 public override void OnMouseWheel(MouseWithKeysEventArgs e)
 {
     base.OnMouseWheel(e);
     RaiseMouseWheel(e);
 }
示例#17
0
 public override void OnMouseUp(MouseWithKeysEventArgs e)
 {
     if (this.State == ButtonState.Normal)
     {
         return;
     }
     using (RedrawAccumulator a = new RedrawAccumulator(this.Root))
     {
         this.State = ButtonState.Normal;
         base.OnMouseUp(e);
         RaisePushed();
     }
 }
示例#18
0
 private void CollapseButton_MouseDown(MouseWithKeysEventArgs MouseInfo)
 {
     ToggleCollapse(true);
 }
示例#19
0
 void mHMembers_DoubleClick(MouseWithKeysEventArgs MouseInfo)
 {
     this.ToggleCollapse(true);
 }
示例#20
0
        protected override void OnMouseUp(MouseWithKeysEventArgs e)
        {
            if (e.Handled == true)
            {
                return;
            }

            bool shouldShowPopupMenu = e.IsRightButtonPressed;

            using (Redrawer r = new Redrawer(Root))
            {
                if (DragState != null)
                {
                    if (DragState.Result != null)
                    {
                        DragState.Query.ShouldCopyInsteadOfMove = e.IsCtrlPressed;
                        DragState.Result.DropTargetContainer.AcceptBlocks(
                            DragState.Query,
                            DragState.Result);
                        shouldShowPopupMenu = false;
                        e.Handled = true;
                    }
                    else
                    {
                        if (DragState.DragStarted)
                        {
                            shouldShowPopupMenu = false;
                            e.Handled = true;
                        }
                    }
                    DragState = null;
                }

                if (shouldShowPopupMenu && e.IsRightButtonPressed)
                {
                    Block rightClicked = FindBlockAtPoint(e.X, e.Y);
                    if (rightClicked != null
                        && rightClicked.Menu != null
                        && rightClicked.MyControl.HitTest(e.X, e.Y))
                    {
                        if (rightClicked.CanGetFocus)
                        {
                            rightClicked.SetFocus();
                        }
                        MyRootControl.ShowPopupMenu(rightClicked.Menu, e.Location);
                        e.Handled = true;
                    }
                }
            }
        }
示例#21
0
        protected override void OnMouseMove(MouseWithKeysEventArgs e)
        {
            if (DragState != null)
            {
                if (!e.IsRightButtonPressed)
                {
                    DragState = null;
                    Redraw();
                    return;
                }

                DragState.Query.DropPoint.Set(e.X, e.Y);
                DragState.Query.ShouldCopyInsteadOfMove = e.IsCtrlPressed;

                if (!DragState.Query.DragStartpoint.PointWithinDragSize(e.X, e.Y)
                    || DragState.DragStarted)
                {
                    DragState.Result = FindDropTarget();
                    DragState.DragStarted = true;
                }
                Redraw();
            }
        }
示例#22
0
        protected override void OnMouseDown(MouseWithKeysEventArgs e)
        {
            if (e.Handled == true)
            {
                return;
            }
            Block block = FindDraggableBlock(e.X, e.Y);

            if (e.IsRightButtonPressed
                && block != null
                && block.Draggable)
            {
                DragState = new DragInfo(block, e.X, e.Y);
                block.SetFocus();
            }
            else
            {
                DragState = null;
            }
        }
 /// <summary>
 ///		Tests if a point is inside this shape or its children
 /// </summary>
 /// <param name="HitPoint"></param>
 ///		The point to check
 /// <returns>
 ///		Reference to a child in which the point is (recursive),
 ///		this, if the point is inside this shape but inside none of the children
 ///		null else
 /// </returns>
 //public override IShape HitTestShapeList(int x, int y)
 //{
 //    if (!this.Bounds.HitTest(x, y)
 //        || !this.Visible
 //        || !this.Enabled)
 //    {
 //        return null;
 //    }
 //    IShape foundChild = HitTestChildrenOnly(x, y);
 //    return foundChild != null ? foundChild : this;
 //}
 /// <summary>
 /// Finds a subchild that contains a point
 /// </summary>
 /// <param name="x">x-coordinate of a hit test point</param>
 /// <param name="y">y-coordinate of a hit test point</param>
 /// <returns>Found child. null if none found.</returns>
 //public IShape HitTestChildrenOnlyShapeList(int x, int y)
 //{
 //    foreach (T s in Children.Reversed)
 //    {
 //        IShape found = s.HitTest(x, y);
 //        if (found != null) //  && found.Visible && found.Enabled
 //        {
 //            return found;
 //        }
 //    }
 //    return null;
 //}
 /// <summary>
 /// Different from HitTestChildrenOnly,
 /// it returns not the deepest child actually found
 /// but immediate child of this control which has the mouse
 /// </summary>
 /// <param name="e"></param>
 /// <returns></returns>
 private IShape ShapeToForwardMouseEventTo(MouseWithKeysEventArgs e)
 {
     return FindDirectChildAtPoint(e.X, e.Y);
 }
示例#24
0
 protected override void OnMouseDown(MouseWithKeysEventArgs e)
 {
     if (e.IsRightButtonPressed)
     {
         ShouldShowCompletion();
         SetFocus();
         e.Handled = true;
     }
 }
示例#25
0
 public override void OnMouseDown(MouseWithKeysEventArgs e)
 {
     using (RedrawAccumulator a = new RedrawAccumulator(this.Root))
     {
         this.State = ButtonState.Pushed;
         base.OnMouseDown(e);
     }
 }
示例#26
0
        public override void OnMouseMove(MouseWithKeysEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left
                && WasMouseDown)
            {
                int newCaretPosition = CursorStringPosition(e.X);
                if (CaretPosition != newCaretPosition)
                {
                    CaretPosition = newCaretPosition;
                    AfterCaretChanged();
                    e.Handled = true;
                }
            }

            if (!e.Handled)
            {
                RaiseMouseMove(e);
            }
        }
示例#27
0
 protected void RaiseClick(MouseWithKeysEventArgs e)
 {
     if (Click != null)
     {
         Click(e);
     }
 }
示例#28
0
 protected void RaiseDoubleClick(MouseWithKeysEventArgs e)
 {
     if (DoubleClick != null)
     {
         DoubleClick(e);
     }
 }
示例#29
0
 protected override void OnDoubleClick(MouseWithKeysEventArgs e)
 {
     if (this.HasPoint(e.X, e.Y))
     {
         this.MyUniversalControl.ToggleCollapse(true);
         e.Handled = true;
     }
 }
示例#30
0
        public override void OnMouseWheel(MouseWithKeysEventArgs e)
        {
            if (VScroll.Scrolling)
            {
                return;
            }

            // size of one logical "line" in Windows
            const int WheelAmount = 25;

            // number of logical units in one mouse wheel rotation, typically 120
            int Delta = System.Windows.Forms.SystemInformation.MouseWheelScrollDelta;

            // number of lines to scroll with each mouse wheel rotation
            int Lines = System.Windows.Forms.SystemInformation.MouseWheelScrollLines;

            // scroll WheelAmount * Lines pixels
            int FinalAmount = (int)((double)-e.Delta * WheelAmount * Lines / Delta);
            ScrollContentSmooth(
                (int)Scrollable.VRange.Span.Pos + FinalAmount,
                ScrollContentY);
        }