internal void OnMouseDown(NSEvent e)
        {
            MessageMouseEventFlag flags = MessageMouseEventFlag.None;

            if (e.Type == NSEventType.RightMouseDown)
            {
                flags |= MessageMouseEventFlag.RightMouseButton;
            }
            if ((e.ModifierFlags & NSEventModifierMask.ShiftKeyMask) != 0)
            {
                flags |= MessageMouseEventFlag.ShiftIsHeld;
            }
            if ((e.ModifierFlags & NSEventModifierMask.AlternateKeyMask) != 0)
            {
                flags |= MessageMouseEventFlag.AltIsHeld;
            }
            if ((e.ModifierFlags & NSEventModifierMask.ControlKeyMask) != 0)
            {
                flags |= MessageMouseEventFlag.CtrlIsHeld;
            }
            if (e.ClickCount == 2)
            {
                flags |= MessageMouseEventFlag.DblClick;
            }
            else
            {
                flags |= MessageMouseEventFlag.SingleClick;
            }

            bool captureTheMouse;

            DrawingUtils.MouseDownHelper(
                presentationDataAccess,
                drawContext,
                ClientRectangle,
                viewEvents,
                InnerView.ConvertPointFromView(e.LocationInWindow, null).ToPoint(),
                flags,
                out captureTheMouse
                );
        }
Ejemplo n.º 2
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            this.Focus();
            bool captureTheMouse = true;

            MessageMouseEventFlag flags = MessageMouseEventFlag.None;

            if (e.Button == MouseButtons.Right)
            {
                flags |= MessageMouseEventFlag.RightMouseButton;
            }
            if (Control.ModifierKeys == Keys.Shift)
            {
                flags |= MessageMouseEventFlag.ShiftIsHeld;
            }
            if (Control.ModifierKeys == Keys.Alt)
            {
                flags |= MessageMouseEventFlag.AltIsHeld;
            }
            if (Control.ModifierKeys == Keys.Control)
            {
                flags |= MessageMouseEventFlag.CtrlIsHeld;
            }
            if (e.Clicks == 2)
            {
                flags |= MessageMouseEventFlag.DblClick;
            }
            else
            {
                flags |= MessageMouseEventFlag.SingleClick;
            }

            DrawingUtils.MouseDownHelper(presentationDataAccess, drawContext, ClientRectangle, viewEvents, e.Location, flags, out captureTheMouse);

            base.OnMouseDown(e);

            this.Capture = captureTheMouse;
        }