Пример #1
0
 /// <summary>
 /// マウスが動いたときの処理です
 /// </summary>
 /// <param name="mouseEvent"></param>
 protected void OnMouseMove(MouseEvent mouseEvent)
 {
     if (MouseMove != null)
     {
         MouseMove.Invoke(this, mouseEvent);
     }
 }
Пример #2
0
 private void Base_MouseMove(object sender, MouseEventArgs e)
 {
     if (canClick)
     {
         MouseMove?.Invoke(this, e);
     }
 }
Пример #3
0
 private void Helper_MouseMove(object sender, MouseEventArgs e)
 {
     if (is_doing)
     {
         MouseMove?.Invoke(ctrl, e);
     }
 }
Пример #4
0
        private void OnInternalMouseMove(object sender, OpenTK.Input.MouseMoveEventArgs e)
        {
            var args = new MouseMoveEventArgs(e);

            OnMouseMove(this, args);
            MouseMove?.Invoke(this, args);
        }
Пример #5
0
 public DisplayPanelBox(PictureBox pBox, VScrollBar vs, HScrollBar hs)
 {
     pictureBox            = pBox;
     pictureBox.MouseDown += (s, e) =>
     {
         clicking = true;
         MouseDown.Invoke(e);
     };
     pictureBox.MouseMove += (s, e) =>
     {
         if (clicking)
         {
             MouseDrag.Invoke(e);
         }
         else
         {
             MouseMove.Invoke(e);
         }
     };
     pictureBox.MouseUp += (s, e) =>
     {
         clicking = false;
         MouseUp.Invoke(e);
     };
     vScroll = vs;
     hScroll = hs;
 }
Пример #6
0
        internal void Internal_OnMouseMove(ref Vector2 mousePos)
        {
            Vector2 pos = mousePos / _dpiScale;

            MouseMove?.Invoke(ref pos);
            GUI.OnMouseMove(pos);
        }
Пример #7
0
 /// <summary>
 /// Receives all MouseMove events, and checks if control is focused and
 /// should receive event.
 /// </summary>
 /// <param name="args">Mouse event arguments.</param>
 protected virtual void MouseMoveIntercept(MouseEventArgs args)
 {
     if (this.guiManager.GetFocus() == this)
     {
         MouseMove.Invoke(args);
     }
 }
Пример #8
0
        private void Viewport_MouseMove(Ray3 ray, System.Windows.Forms.MouseEventArgs e)
        {
            if (SurfaceMesh == null)
            {
                return;
            }

            List <Intersection> Intersections = new List <Intersection>();

            Intersections.AddRange(SurfaceMesh.Intersect(ray));

            if (Intersections.Count == 0 && IsMouseOver)
            {
                IsMouseOver = false;
                MouseLeave?.Invoke(this, e);
            }
            else if (Intersections.Count > 0)
            {
                Intersections.Sort((i1, i2) => i1.Distance.CompareTo(i2.Distance));

                if (!IsMouseOver)
                {
                    IsMouseOver = true;
                    MouseEnter?.Invoke(this, Intersections, e);
                }

                MouseMove?.Invoke(this, Intersections, e);
            }
        }
Пример #9
0
 internal void OnMouseMove(MouseEventArgs e)
 {
     if (MouseMove != null)
     {
         MouseMove.Invoke(this, e);
     }
 }
Пример #10
0
        public FileViewerInternal()
        {
            InitializeComponent();
            InitializeComplete();

            _currentViewPositionCache = new CurrentViewPositionCache(this);

            TextEditor.TextChanged += (s, e) => TextChanged?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.VScrollBar.ValueChanged += (s, e) => ScrollPosChanged?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.TextArea.KeyUp          += (s, e) => KeyUp?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.TextArea.DoubleClick    += (s, e) => DoubleClick?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.TextArea.MouseMove      += (s, e) => MouseMove?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.TextArea.MouseEnter     += (s, e) => MouseEnter?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.TextArea.MouseLeave     += (s, e) => MouseLeave?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.TextArea.MouseDown      += (s, e) =>
            {
                SelectedLineChanged?.Invoke(
                    this,
                    new SelectedLineEventArgs(
                        TextEditor.ActiveTextAreaControl.TextArea.TextView.GetLogicalLine(e.Y)));
            };

            HighlightingManager.Manager.DefaultHighlighting.SetColorFor("LineNumbers", new HighlightColor(Color.FromArgb(80, 0, 0, 0), Color.White, false, false));
            TextEditor.ActiveTextAreaControl.TextEditorProperties.EnableFolding = false;

            _lineNumbersControl = new DiffViewerLineNumberControl(TextEditor.ActiveTextAreaControl.TextArea);

            VRulerPosition = AppSettings.DiffVerticalRulerPosition;
        }
Пример #11
0
 protected virtual void Move(int x, int y, int xglobal, int yglobal, MButton mb)
 {
     if (PointOnControl(x, y))
     {
         MouseMove?.Invoke(x, y, mb);
     }
 }
Пример #12
0
 private void _vlcPlayer_PreviewMouseMove(object sender, System.Windows.Input.MouseEventArgs e)
 {
     if (MouseMove != null)
     {
         MouseMove.Invoke(sender, e);
     }
 }
Пример #13
0
        internal void Internal_OnMouseMove(ref Float2 mousePos)
        {
            var pos = mousePos / DpiScale;

            MouseMove?.Invoke(ref pos);
            GUI.OnMouseMove(pos);
        }
Пример #14
0
        /// <summary>
        /// Handles most events of the control
        /// </summary>
        /// <param name="eventName">Type of event to raise</param>
        /// <remarks></remarks>
        public void DoEvent(LightweightEvents eventName)
        {
            switch (eventName)
            {
            case LightweightEvents.Click:
                DoClick();
                break;

            case LightweightEvents.MouseDown:
                if (canClick)
                {
                    isPressed = true;
                    Redraw();
                }
                MouseDown?.Invoke(this, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));

                break;

            case LightweightEvents.MouseUp:
                if (canClick)
                {
                    isPressed = false;
                    Redraw();
                }
                MouseUp?.Invoke(this, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));

                break;

            case LightweightEvents.MouseEnter:
                Scrolling = true;
                MouseEnter?.Invoke(this, new EventArgs());

                break;

            case LightweightEvents.MouseLeave:
                Scrolling = false;
                MouseLeave?.Invoke(this, new EventArgs());

                break;

            case LightweightEvents.Update:
                Update?.Invoke(this, null);

                break;

            case LightweightEvents.DoubleClick:
                DoubleClick?.Invoke(this, new EventArgs());

                break;

            case LightweightEvents.MouseMove:
                MouseMove?.Invoke(this, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));

                break;

            default:
                throw new NotImplementedException("The requested event for this control does not exist");
            }
        }
Пример #15
0
        /// <param name="gameTime">Snapshot of the application's timing values.</param>
        /// <param name="state">Current mouse state.</param>
        /// <summary>
        /// Updates the mouse device.
        /// </summary>
        private void UpdateMouse(MouseState state, GameTime gameTime)
        {
            if ((state.X != mouseState.X) || (state.Y != mouseState.Y))
            {
                var e = new MouseEventArgs();


                var btn = MouseButton.None;
                if (state.LeftButton == ButtonState.Pressed)
                {
                    btn = MouseButton.Left;
                }
                else if (state.RightButton == ButtonState.Pressed)
                {
                    btn = MouseButton.Right;
                }
                else if (state.MiddleButton == ButtonState.Pressed)
                {
                    btn = MouseButton.Middle;
                }
                else if (state.XButton1 == ButtonState.Pressed)
                {
                    btn = MouseButton.XButton1;
                }
                else if (state.XButton2 == ButtonState.Pressed)
                {
                    btn = MouseButton.XButton2;
                }


                BuildMouseEvent(state, btn, ref e);
                if (MouseMove != null)
                {
                    MouseMove.Invoke(this, e);
                }
            }


// Mouse wheel position changed
            if (state.ScrollWheelValue != mouseState.ScrollWheelValue)
            {
                var e         = new MouseEventArgs();
                var direction = state.ScrollWheelValue < mouseState.ScrollWheelValue
                    ? MouseScrollDirection.Down
                    : MouseScrollDirection.Up;


                BuildMouseEvent(state, MouseButton.None, direction, ref e);


                MouseScroll?.Invoke(this, e);
            }


            UpdateButtons(state, gameTime);


            mouseState = state;
        }
Пример #16
0
        public virtual void OnMouseMove(MouseEventArgs e)
        {
            if (!_Enabled)
            {
                return;
            }


            if (Moving)
            {
                Point TempPoint = e.Location;
                if (TempPoint.Y >= Main.This.ClientSize.Height)
                {
                    TempPoint.Y = Main.This.ClientSize.Height - 1;
                }
                if (TempPoint.X >= Main.This.ClientSize.Width)
                {
                    TempPoint.X = Main.This.ClientSize.Width - 1;
                }
                if (TempPoint.X < 0)
                {
                    TempPoint.X = 0;
                }
                if (TempPoint.Y < 0)
                {
                    TempPoint.Y = 0;
                }
                Location = Functions.PointS(TempPoint, MovePoint);
                return;
            }

            if (Controls != null)
            {
                for (int I = Controls.Count - 1; I >= 0; I--)
                {
                    if (Controls[I].IsMouseOver(e.Location))
                    {
                        Controls[I].OnMouseMove(e);
                        return;
                    }
                }
            }

            /*  if (MouseControl != this)
             * {
             *    if (MouseControl != null)
             *        MouseControl.OnMouseLeave();
             *    OnMouseEnter();
             * }
             *
             * MouseControl = this;*/

            Highlight();

            if (MouseMove != null)
            {
                MouseMove.Invoke(this, e);
            }
        }
Пример #17
0
        private void _mouseListener_MouseMoved(object sender, MouseEventArgs e)
        {
            _scene?.FireMouseMove(e);
            MouseMove?.Invoke(sender, e);
#if DEBUG
            Logger.Log("Mouse moved.");
#endif
        }
Пример #18
0
        protected virtual void OnMouseMove(object sender, MouseMoveEventArgs e)
        {
            usingController.Value = false;

            Interlocked.Exchange(ref xy, ((long)e.X << 32) | (uint)e.Y);
            Interlocked.Exchange(ref currentWindow, (Display.Window)sender);
            MouseMove?.Invoke(sender, e);
        }
Пример #19
0
        /// <summary>
        /// Hook process messages.
        /// </summary>
        /// <param name="nCode"></param>
        /// <param name="wParam"></param>
        /// <param name="lParam"></param>
        /// <returns></returns>
        static IntPtr HookProcFunction(int nCode, IntPtr wParam, IntPtr lParam)
        {
            if (nCode == 0)
            {
                MSLLHOOKSTRUCT mhs = (MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MSLLHOOKSTRUCT));
                switch (wParam.ToInt32())
                {
                case WM_LBUTTONDOWN:
                    MouseDown?.Invoke(null, new MouseEventArgs(MouseButtons.Left, 1, mhs.pt.X, mhs.pt.Y, 0));
                    break;

                case WM_LBUTTONUP:
                    MouseUp?.Invoke(null, new MouseEventArgs(MouseButtons.Left, 1, mhs.pt.X, mhs.pt.Y, 0));
                    break;

                case WM_MBUTTONDOWN:
                    MouseDown?.Invoke(null, new MouseEventArgs(MouseButtons.Middle, 1, mhs.pt.X, mhs.pt.Y, 0));
                    break;

                case WM_MBUTTONUP:
                    MouseUp?.Invoke(null, new MouseEventArgs(MouseButtons.Middle, 1, mhs.pt.X, mhs.pt.Y, 0));
                    break;

                case WM_MOUSEMOVE:
                    MouseMove?.Invoke(null, new MouseEventArgs(MouseButtons.None, 1, mhs.pt.X, mhs.pt.Y, 0));
                    break;

                case WM_MOUSEWHEEL:
                    if (!localHook)
                    {
                        MouseMove?.Invoke(null, new MouseEventArgs(MouseButtons.None, mhs.time, mhs.pt.X, mhs.pt.Y, mhs.mouseData >> 16));
                    }
                    break;

                case WM_RBUTTONDOWN:
                    MouseDown?.Invoke(null, new MouseEventArgs(MouseButtons.Right, 1, mhs.pt.X, mhs.pt.Y, 0));
                    break;

                case WM_RBUTTONUP:
                    MouseUp?.Invoke(null, new MouseEventArgs(MouseButtons.Right, 1, mhs.pt.X, mhs.pt.Y, 0));
                    break;

                case WM_XBUTTONDOWN:
                    MouseDown?.Invoke(null, new MouseEventArgs(API.HIWORD(mhs.mouseData) == 1 ? MouseButtons.XButton1 : MouseButtons.XButton2, 1, mhs.pt.X, mhs.pt.Y, 0));
                    break;

                case WM_XBUTTONUP:
                    MouseUp?.Invoke(null, new MouseEventArgs(API.HIWORD(mhs.mouseData) == 1 ? MouseButtons.XButton1 : MouseButtons.XButton2, 1, mhs.pt.X, mhs.pt.Y, 0));
                    break;

                default:

                    break;
                }
            }

            return(API.CallNextHookEx(hHook, nCode, wParam, lParam));
        }
Пример #20
0
 private void OnTargetNotifyIconMouseMove(object sender, MouseEventArgs e)
 {
     _notifyIconMousePosition = Control.MousePosition;
     if (MouseMove != null)
     {
         MouseMove.Invoke();
     }
     _delayMouseLeaveEventTimer.Start();
 }
Пример #21
0
 static MouseInputManager()
 {
     InputHooks.MouseMove        += (o, e) => MouseMove?.Invoke(new MouseHookEventArgs(e.X, e.Y, (e.Button), e.Delta));
     InputHooks.MouseClick       += (o, e) => MouseClick?.Invoke(new MouseHookEventArgs(e.X, e.Y, (e.Button), e.Delta));
     InputHooks.MouseDown        += (o, e) => MouseDown?.Invoke(new MouseHookEventArgs(e.X, e.Y, (e.Button), e.Delta));
     InputHooks.MouseUp          += (o, e) => MouseUp?.Invoke(new MouseHookEventArgs(e.X, e.Y, (e.Button), e.Delta));
     InputHooks.MouseWheel       += (o, e) => MouseWheel?.Invoke(new MouseHookEventArgs(e.X, e.Y, (e.Button), e.Delta));
     InputHooks.MouseDoubleClick += (o, e) => MouseDoubleClick?.Invoke(new MouseHookEventArgs(e.X, e.Y, (e.Button), e.Delta));
 }
Пример #22
0
 public bool PreFilterMessage(ref Message m)
 {
     if (m.Msg == WM_MOUSEMOVE)
     {
         MouseMove?.Invoke(this, EventArgs.Empty);
     }
     // Always allow message to continue to the next filter control
     return(false);
 }
Пример #23
0
        internal void FireMouseMove(MouseEventArgs e)
        {
            OnMouseMove(e);
            MouseMove?.Invoke(this, e);

            foreach (var child in Children)
            {
                child.FireMouseMove(e.OffsetPosition(new Vector2(child.X, child.Y)));
            }
        }
Пример #24
0
 public WinFormsMouseInput(Control control)
 {
     control.MouseWheel += (sender, args) => MouseWheel?.Invoke(control, new MouseWheelEventArgs(args.Delta));
     control.MouseDown  += (sender, args) => MouseDown?.Invoke(
         control, new MouseButtonEventArgs(Convert(args.Button), new Point(args.X, args.Y), args.Clicks));
     control.MouseUp += (sender, args) => MouseUp?.Invoke(
         control, new MouseButtonEventArgs(Convert(args.Button), new Point(args.X, args.Y), args.Clicks));
     control.MouseMove += (sender, args) => MouseMove?.Invoke(
         control, new MouseMoveEventArgs(new Point(args.X, args.Y)));
 }
Пример #25
0
        protected virtual void OnMouseMove(GLMouseEventArgs e)
        {
            //System.Diagnostics.Debug.WriteLine("Over " + Name + " " + e.Location);
            MouseMove?.Invoke(this, e);

            if (InvalidateOnMouseMove)
            {
                Invalidate();
            }
        }
Пример #26
0
 public void Invoke(string EventName, Game CurrentGame, EventArguments Args)
 {
     if (EventName == "Closing")
     {
         Closing.Invoke(CurrentGame, Args);
     }
     if (EventName == "KeyDown")
     {
         KeyDown.Invoke(CurrentGame, Args);
     }
     if (EventName == "KeyUp")
     {
         KeyUp.Invoke(CurrentGame, Args);
     }
     if (EventName == "KeyPress")
     {
         KeyPress.Invoke(CurrentGame, Args);
     }
     if (EventName == "Load")
     {
         Load.Invoke(CurrentGame, Args);
     }
     if (EventName == "MouseDown")
     {
         MouseDown.Invoke(CurrentGame, Args);
     }
     if (EventName == "MouseUp")
     {
         MouseUp.Invoke(CurrentGame, Args);
     }
     if (EventName == "MouseClick")
     {
         MouseClick.Invoke(CurrentGame, Args);
     }
     if (EventName == "MouseMove")
     {
         MouseMove.Invoke(CurrentGame, Args);
     }
     if (EventName == "MouseWheel")
     {
         MouseWheel.Invoke(CurrentGame, Args);
     }
     if (EventName == "RenderFrame")
     {
         RenderFrame.Invoke(CurrentGame, Args);
     }
     if (EventName == "Resize")
     {
         Resize.Invoke(CurrentGame, Args);
     }
     if (EventName == "TimerTick")
     {
         TimerTick.Invoke(CurrentGame, Args);
     }
 }
        /// <summary>
        /// Desenha o controle de acordo com as coordenadas.
        /// </summary>
        public void Draw()
        {
            if (!Visible)
            {
                return;
            }

            State = 0;

            if (Enabled)
            {
                if (InsideButton())
                {
                    if (!move)
                    {
                        move = true;
                        MouseMove?.Invoke(this, EventArgs.Empty);
                    }

                    State = 1;

                    if (EngineCore.MouseDown)
                    {
                        State = 2;

                        if (!click)
                        {
                            MouseDown?.Invoke(this, EventArgs.Empty); click = true;
                        }
                    }
                    else
                    {
                        if (click)
                        {
                            MouseUp?.Invoke(this, EventArgs.Empty);
                        }
                        click = false;
                        State = 1;
                    }
                }
                else
                {
                    if (move)
                    {
                        move = false;
                        MouseLeave?.Invoke(this, EventArgs.Empty);
                    }
                }
            }

            EngineCore.SpriteDevice.Begin(SpriteFlags);
            EngineCore.SpriteDevice.Draw(Texture[State], new Color(Color.R, Color.G, Color.B, Transparency), SourceRect, new Vector3(0, 0, 0), new Vector3(Position.X, Position.Y, 0));
            EngineCore.SpriteDevice.End();
        }
Пример #28
0
        private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
        {
            int intw = (int)wParam;

            if (nCode >= 0 &&
                intw == WM_LBUTTONDOWN || intw == WM_RBUTTONDOWN ||
                intw == WM_LBUTTONUP || intw == WM_RBUTTONUP ||
                intw == WM_MOUSEWHEEL || intw == WM_MOUSEMOVE ||
                intw == WM_MBUTTONDOWN || intw == WM_MBUTTONUP)
            {
                var  hookStruct = Marshal.PtrToStructure <MSLLHOOKSTRUCT>(lParam);
                int  x = hookStruct.pt.x, y = hookStruct.pt.y;
                bool res = true;
                switch ((int)wParam)
                {
                case WM_LBUTTONDOWN:
                    res = MouseDown?.Invoke(MouseEventType.LEFT, x, y) ?? true;
                    break;

                case WM_RBUTTONDOWN:
                    res = MouseDown?.Invoke(MouseEventType.RIGHT, x, y) ?? true;
                    break;

                case WM_LBUTTONUP:
                    res = MouseUp?.Invoke(MouseEventType.LEFT, x, y) ?? true;
                    break;

                case WM_RBUTTONUP:
                    res = MouseUp?.Invoke(MouseEventType.RIGHT, x, y) ?? true;
                    break;

                case WM_MOUSEMOVE:
                    res = MouseMove?.Invoke(MouseEventType.NONE, x, y) ?? true;
                    break;

                case WM_MOUSEWHEEL:
                    res = MouseScroll?.Invoke((int)hookStruct.mouseData > 0 ? MouseScrollType.UP : MouseScrollType.DOWN) ?? true;
                    break;

                case WM_MBUTTONDOWN:
                    res = MouseDown?.Invoke(MouseEventType.WHEEL, x, y) ?? true;
                    break;

                case WM_MBUTTONUP:
                    res = MouseUp?.Invoke(MouseEventType.WHEEL, x, y) ?? true;
                    break;
                }
                if (!res)
                {
                    return((IntPtr)1);
                }
            }
            return(CallNextHookEx(_hookID, nCode, wParam, lParam));
        }
Пример #29
0
 void IEventListener.ListenMouseMove(UIMouseMoveEventArgs e)
 {
     if (e.IsDragging)
     {
         MouseDrag?.Invoke(this, e);
     }
     else
     {
         MouseMove?.Invoke(this, e);
     }
 }
Пример #30
0
        private void onMouseMove(object sender, MouseMoveEventArgs e)
        {
            _controllers.CurrentlyUsingController = false;

            _mouse.X = (double)e.X;
            _mouse.Y = (double)e.Y;

            _mouse.CurrentWindow = (Display.Window)sender;

            MouseMove?.Invoke(sender, e);
        }