Details for an event that discovers the rectangle that the mouse has to leave to begin dragging.
Inheritance: System.EventArgs
Exemple #1
0
 /// <summary>
 /// Raises the ButtonDragRectangle event.
 /// </summary>
 /// <param name="e">An ButtonDragRectangleEventArgs containing the event args.</param>
 protected virtual void OnButtonDragRectangle(ButtonDragRectangleEventArgs e)
 {
     if (ButtonDragRectangle != null)
     {
         ButtonDragRectangle(this, e);
     }
 }
Exemple #2
0
        /// <summary>
        /// Mouse button has been pressed in the view.
        /// </summary>
        /// <param name="c">Reference to the source control instance.</param>
        /// <param name="pt">Mouse position relative to control.</param>
        /// <param name="button">Mouse button pressed down.</param>
        /// <returns>True if capturing input; otherwise false.</returns>
        public virtual bool MouseDown(Control c, Point pt, MouseButtons button)
        {
            // Is the controller allowed to track/click
            if (IsOperating)
            {
                // If the button is not enabled then we do nothing on a mouse down
                if (_target.Enabled)
                {
                    // Only interested in left mouse pressing down
                    if (button == MouseButtons.Left)
                    {
                        // Capturing mouse input
                        _captured        = true;
                        _draggingAttempt = false;

                        // Use event to discover the rectangle that causes dragging to begin
                        ButtonDragRectangleEventArgs args = new ButtonDragRectangleEventArgs(pt);
                        OnButtonDragRectangle(args);
                        _dragRect      = args.DragRect;
                        _preDragOffset = args.PreDragOffset;

                        if (!_fixedPressed)
                        {
                            // Update the visual state
                            UpdateTargetState(pt);

                            // Do we become fixed in the pressed state until RemoveFixed is called?
                            if (BecomesFixed)
                            {
                                _fixedPressed = true;
                            }

                            // Indicate that the mouse wants to select the elment
                            OnMouseSelect(new MouseEventArgs(MouseButtons.Left, 1, pt.X, pt.Y, 0));

                            // Generate a click event if we generate click on mouse down
                            if (ClickOnDown)
                            {
                                OnClick(new MouseEventArgs(MouseButtons.Left, 1, pt.X, pt.Y, 0));

                                // If we need to perform click repeats then use a timer...
                                if (Repeat)
                                {
                                    _repeatTimer          = new Timer();
                                    _repeatTimer.Interval = SystemInformation.DoubleClickTime;
                                    _repeatTimer.Tick    += new EventHandler(OnRepeatTimer);
                                    _repeatTimer.Start();
                                }
                            }
                        }
                    }
                    else if (button == MouseButtons.Right)
                    {
                        if (!_fixedPressed)
                        {
                            // Do we become fixed in the pressed state until RemoveFixed is called?
                            if (BecomesRightFixed)
                            {
                                _fixedPressed = true;
                            }

                            // Indicate the right mouse was used on the button
                            OnRightClick(new MouseEventArgs(MouseButtons.Right, 1, pt.X, pt.Y, 0));
                        }
                    }
                }
            }

            return(_captured);
        }
        private void OnCheckButtonDragRect(object sender, ButtonDragRectangleEventArgs e)
        {
            // Cast incoming reference to the actual button view
            INavCheckItem reorderItem = (INavCheckItem)sender;

            e.PreDragOffset = (Navigator.AllowPageReorder && reorderItem.Page.AreFlagsSet(KryptonPageFlags.AllowPageReorder));
            Rectangle dragRect = Rectangle.Union(e.DragRect, _layoutBarViewport.ClientRectangle);
            dragRect.Inflate(new Size(10, 10));
            e.DragRect = dragRect;
        }
Exemple #4
0
 /// <summary>
 /// Raises the ButtonDragRectangle event.
 /// </summary>
 /// <param name="e">An ButtonDragRectangleEventArgs containing the event args.</param>
 protected virtual void OnButtonDragRectangle(ButtonDragRectangleEventArgs e)
 {
     ButtonDragRectangle?.Invoke(this, e);
 }
 private void OnButtonDragRectangle(object sender, ButtonDragRectangleEventArgs e)
 {
     if (ButtonDragRectangle != null)
         ButtonDragRectangle(this, e);
 }
 /// <summary>
 /// Raises the ButtonDragRectangle event.
 /// </summary>
 /// <param name="e">An ButtonDragRectangleEventArgs containing the event args.</param>
 protected virtual void OnButtonDragRectangle(ButtonDragRectangleEventArgs e)
 {
     if (ButtonDragRectangle != null)
         ButtonDragRectangle(this, e);
 }
        /// <summary>
        /// Mouse button has been pressed in the view.
        /// </summary>
        /// <param name="c">Reference to the source control instance.</param>
        /// <param name="pt">Mouse position relative to control.</param>
        /// <param name="button">Mouse button pressed down.</param>
        /// <returns>True if capturing input; otherwise false.</returns>
        public virtual bool MouseDown(Control c, Point pt, MouseButtons button)
        {
            // Is the controller allowed to track/click
            if (IsOperating)
            {
                // If the button is not enabled then we do nothing on a mouse down
                if (_target.Enabled)
                {
                    // Only interested in left mouse pressing down
                    if (button == MouseButtons.Left)
                    {
                        // Capturing mouse input
                        _captured = true;
                        _draggingAttempt = false;

                        // Use event to discover the rectangle that causes dragging to begin
                        ButtonDragRectangleEventArgs args = new ButtonDragRectangleEventArgs(pt);
                        OnButtonDragRectangle(args);
                        _dragRect = args.DragRect;
                        _preDragOffset = args.PreDragOffset;

                        if (!_fixedPressed)
                        {
                            // Update the visual state
                            UpdateTargetState(pt);

                            // Do we become fixed in the pressed state until RemoveFixed is called?
                            if (BecomesFixed)
                                _fixedPressed = true;

                            // Indicate that the mouse wants to select the elment
                            OnMouseSelect(new MouseEventArgs(MouseButtons.Left, 1, pt.X, pt.Y, 0));

                            // Generate a click event if we generate click on mouse down
                            if (ClickOnDown)
                            {
                                OnClick(new MouseEventArgs(MouseButtons.Left, 1, pt.X, pt.Y, 0));

                                // If we need to perform click repeats then use a timer...
                                if (Repeat)
                                {
                                    _repeatTimer = new Timer();
                                    _repeatTimer.Interval = SystemInformation.DoubleClickTime;
                                    _repeatTimer.Tick += new EventHandler(OnRepeatTimer);
                                    _repeatTimer.Start();
                                }
                            }
                        }
                    }
                    else if (button == MouseButtons.Right)
                    {
                        if (!_fixedPressed)
                        {
                            // Do we become fixed in the pressed state until RemoveFixed is called?
                            if (BecomesRightFixed)
                                _fixedPressed = true;

                            // Indicate the right mouse was used on the button
                            OnRightClick(new MouseEventArgs(MouseButtons.Right, 1, pt.X, pt.Y, 0));
                        }
                    }
                }
            }

            return _captured;
        }