public bool HandleMouse(MouseState Mouse, float dT) { int stillness = (Math.Abs(Mouse.X - PreviousMouseState.X)) + (Math.Abs(Mouse.Y - PreviousMouseState.Y)); int mousethreshold = 1; if (stillness > mousethreshold) { MouseStillSeconds = 0; } else { MouseStillSeconds += dT; } Window Window = GetWindow(Mouse.X, Mouse.Y); if (Window == null) { if (this.MovingWindow != null) { PreviousMouseState = Mouse; return(true); } if (this.MouseGrab != null) { PreviousMouseState = Mouse; return(true); } PreviousMouseState = Mouse; if (Modal != null) { return(true); } return(false); } Window.MouseMove(MouseX - Window.X, MouseY - Window.Y); bool MouseIsDown = Mouse.LeftButton == ButtonState.Pressed; if (MouseIsDown) { if (PreviousMouseState.LeftButton == ButtonState.Released) //the mouse was up last time { Window.MouseDown(MouseX - Window.X, MouseY - Window.Y); } } else { if (PreviousMouseState.LeftButton == ButtonState.Pressed) //the mouse was down last time { Window.MouseUp(MouseX - Window.X, MouseY - Window.Y); } if (this.MovingWindow != null) { this.MovingWindow = null; } } PreviousMouseState = Mouse; return(true); }
public void MouseMove(float X, float Y) { Window Window = this.GetWindow(X, Y); /* * if (Window == null) * { * this.ToolTip = null; * return; * } * //*/ Window.MouseMove(X - Window.X, Y - Window.Y); }