/// <summary> /// マウスが動いたときの処理です /// </summary> /// <param name="mouseEvent"></param> protected void OnMouseMove(MouseEvent mouseEvent) { if (MouseMove != null) { MouseMove.Invoke(this, mouseEvent); } }
private void Base_MouseMove(object sender, MouseEventArgs e) { if (canClick) { MouseMove?.Invoke(this, e); } }
private void Helper_MouseMove(object sender, MouseEventArgs e) { if (is_doing) { MouseMove?.Invoke(ctrl, e); } }
private void OnInternalMouseMove(object sender, OpenTK.Input.MouseMoveEventArgs e) { var args = new MouseMoveEventArgs(e); OnMouseMove(this, args); MouseMove?.Invoke(this, args); }
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; }
internal void Internal_OnMouseMove(ref Vector2 mousePos) { Vector2 pos = mousePos / _dpiScale; MouseMove?.Invoke(ref pos); GUI.OnMouseMove(pos); }
/// <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); } }
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); } }
internal void OnMouseMove(MouseEventArgs e) { if (MouseMove != null) { MouseMove.Invoke(this, e); } }
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; }
protected virtual void Move(int x, int y, int xglobal, int yglobal, MButton mb) { if (PointOnControl(x, y)) { MouseMove?.Invoke(x, y, mb); } }
private void _vlcPlayer_PreviewMouseMove(object sender, System.Windows.Input.MouseEventArgs e) { if (MouseMove != null) { MouseMove.Invoke(sender, e); } }
internal void Internal_OnMouseMove(ref Float2 mousePos) { var pos = mousePos / DpiScale; MouseMove?.Invoke(ref pos); GUI.OnMouseMove(pos); }
/// <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"); } }
/// <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; }
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); } }
private void _mouseListener_MouseMoved(object sender, MouseEventArgs e) { _scene?.FireMouseMove(e); MouseMove?.Invoke(sender, e); #if DEBUG Logger.Log("Mouse moved."); #endif }
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); }
/// <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)); }
private void OnTargetNotifyIconMouseMove(object sender, MouseEventArgs e) { _notifyIconMousePosition = Control.MousePosition; if (MouseMove != null) { MouseMove.Invoke(); } _delayMouseLeaveEventTimer.Start(); }
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)); }
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); }
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))); } }
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))); }
protected virtual void OnMouseMove(GLMouseEventArgs e) { //System.Diagnostics.Debug.WriteLine("Over " + Name + " " + e.Location); MouseMove?.Invoke(this, e); if (InvalidateOnMouseMove) { Invalidate(); } }
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(); }
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)); }
void IEventListener.ListenMouseMove(UIMouseMoveEventArgs e) { if (e.IsDragging) { MouseDrag?.Invoke(this, e); } else { MouseMove?.Invoke(this, e); } }
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); }