/// <summary> /// Fire the MouseExit event (call the methods registered for that event) /// </summary> /// <param name="args"></param> public void OnMouseExit(MouseEventArgs args) { if (MouseExit != null) MouseExit(this, args); }
/// <summary> /// Fire the MouseClicked event (call the methods registered for that event) /// </summary> /// <param name="args"></param> public void OnMouseClicked(MouseEventArgs args) { if (MouseClicked != null) MouseClicked(this, args); }
/// <summary> /// Fire the MouseEnter event (call the methods registered for that event) /// </summary> /// <param name="args"></param> public void OnMouseEnter(MouseEventArgs args) { if (MouseEnter != null) MouseEnter(this, args); }
/// <summary> /// If the cursor is enabled, set our mouseAbs variables based /// on the data in mousePoint. If the cursor is disabled and /// we are using the hardware cursor, move the cursor back to the /// point where the cursor was disabled. /// </summary> /// <param name="mousePoint"></param> public void HandleMouseMoved(Point mousePoint) { // If we are using a hardware cursor, ignore the relative // data from the event, and regenerate the relative data // based on the current position and our previous position. if (this.CursorEnabled) { if (mouseAbsX != mousePoint.X || mouseAbsY != mousePoint.Y) { // Inject the mouse event that will go beyond our buffered data // to adjust the cursor to its current position. MouseData mouseData = new MouseData(); mouseData.x = mousePoint.X; mouseData.y = mousePoint.Y; mouseData.relativeX = mousePoint.X - mouseAbsX; mouseData.relativeY = mousePoint.Y - mouseAbsY; Axiom.Input.MouseEventArgs e = new Axiom.Input.MouseEventArgs(mouseData, modifiers); OnMouseMoved(e); } mouseAbsX = mousePoint.X; mouseAbsY = mousePoint.Y; // Now that the cursor size has been scaled to 32x32 in full // screen mode, I don't ever expect to not be able to rely on // the operating system to update the cursor. Nonetheless, // it's possible that there are still cases out there. Until // we encounter one of those cases though, I'm leaving this // ifdeffed out because I hate to waste the work updating the // cursor if I don't need to. #if UPDATE_CURSOR_MANUALLY // If we can't use the operating system to update our cursor, we will // need to do it ourselves. if (hardwareCursor) { Point screenPoint = control.PointToScreen(mousePoint); Root.Instance.RenderSystem.SetCursorPosition(screenPoint.X, screenPoint.Y); } #endif } else { if (HasFocus()) { if (hardwareCursor && control != null && control.Capture) { log.DebugFormat("Restoring cursor to: {0}", cursorDisabledPosition); Cursor.Position = control.PointToScreen(cursorDisabledPosition); } else if (hardwareCursor && control != null) { // Our app has focus, but doesn't have mouse capture (and should).. grab it. control.Capture = true; log.DebugFormat("Restoring cursor (and recapturing) to: {0}", cursorDisabledPosition); Cursor.Position = control.PointToScreen(cursorDisabledPosition); } else { log.DebugFormat("Cannot restore cursor; control {0}; {1}", control, (control == null) ? false : control.Capture); } } } }