/// <summary> /// Checks for collision with cursor and invokes events based on user actions. /// </summary> public virtual void Update() { Container.SetPosition(new Vector2(CollRectangle.X, CollRectangle.Y)); Container.Color = CurrentColor; Rectangle mouse = InputSystem.GetMouseInUi(); if (mouse.Intersects(CollRectangle)) { MouseHover?.Invoke(); if (InputSystem.IsLeftMousePressed()) { _wasPressed = true; _wasReleased = false; } if (InputSystem.IsLeftMouseReleased() && _wasPressed) { _wasReleased = true; } if (_wasPressed && _wasReleased) { MouseClicked?.Invoke(this); _wasReleased = false; _wasPressed = false; } } else { MouseOut?.Invoke(); } }
/// <summary> /// Raises the <see cref="E:MouseOut"/> event. /// </summary> /// <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param> protected virtual void OnMouseOut(MouseEventArgs e) { MouseOut?.Invoke(this, e); }
/// <summary> /// Invokes MouseOut event. /// </summary> /// <param name="args">Event arguments.</param> internal void InvokeMouseOut(MouseEventArgs args) { this.isMouseOver = false; MouseOut.Invoke(args); }
/// <summary> /// Asks children for their mouse status, and invokes MouseOut event /// for this control if necessary. /// </summary> /// <param name="args">Mouse event arguments.</param> /// <returns>Control asking for MouseOver event, otherwise null.</returns> internal UIComponent CheckMouseStatus(MouseEventArgs args) { UIComponent result = null; // Check if control can receive MouseOver and MouseOut events if (this.Visible) { // Check if MouseOut event should be invoked bool mouseOver = CheckCoordinates(args.Position.X, args.Position.Y); if (this.isMouseOver) { if (!mouseOver) { this.isMouseOver = false; MouseOut.Invoke(args); } } if (mouseOver) { float zTemp = 0.0f; // Ask each child to check its mouse status foreach (UIComponent control in this.controls) { // Keep track of highest z-order if (control.ZOrder >= zTemp) { UIComponent child = control.CheckMouseStatus(args); if (child != null) { // MouseOut last result if (result != null && result.IsMouseOver) { result.InvokeMouseOut(args); } // Set result and update highest z-order result = child; zTemp = control.ZOrder; } } } // If no child requires the event, see if this control can // take it. if (result == null && this.canHaveFocus) { result = this; } } else { // Ensure each control can receive MouseOut event foreach (UIComponent control in this.controls) { control.CheckMouseStatus(args); } } } return(result); }
private void OccurrenceIcon_MouseOut(object sender, RoutedEventArgs e) { MouseOut?.Invoke(this, e); }
private void Item_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e) { ToUnselectedView(); MouseOut?.Invoke(Ind); }
public void MouseOutCB(WindowEvent e) { MouseOut?.Invoke(e); }
//out protected void RaiseMouseOut(object sender, MouseArg args) { MouseOut?.Invoke(sender, args); }
private void Item_MouseLeave(object sender, MouseEventArgs e) { ToUnselectedView(); MouseOut?.Invoke(EnumType); }