internal void OnMouseLeave(EventArgs e) { if (MouseLeave != null) { MouseLeave.Invoke(this, e); } }
/// <summary> /// マウスがでた時の処理です /// </summary> /// <param name="mouseEvent"></param> protected void OnMouseLeave(MouseEvent mouseEvent) { if (MouseLeave != null) { MouseLeave.Invoke(this, mouseEvent); } }
protected virtual void OnLeave(MouseMoveActionInfo info) { State = ControlState.Normal; if (MouseLeave != null) { MouseLeave.Invoke(this, info); } }
private void OnDelayMouseLeaveEventTimerTick(object sender, EventArgs e) { if (_notifyIconMousePosition != Control.MousePosition) { if (MouseLeave != null) { MouseLeave.Invoke(); } _delayMouseLeaveEventTimer.Stop(); } }
public virtual void OnMouseLeave() { if (!_Enabled) { return; } if (MouseLeave != null) { MouseLeave.Invoke(this, EventArgs.Empty); } }
protected virtual void OnMouseLeave() { if (!_enabled) { return; } Redraw(); if (MouseLeave != null) { MouseLeave.Invoke(this, EventArgs.Empty); } }
/// <summary> /// Invoca o evento mouse move. /// </summary> /// <param name="_event"></param> protected virtual void OnMouseLeave(EngineEventArgs args) { MouseLeave?.Invoke(this, args); }
public bool PropagateMouse(Point mousePosition) { if (Visibility == Visibility.Hidden) { return(false); } if (mousePosition.X >= AbsolutePosition.X && mousePosition.X <= AbsolutePosition.X + Width && mousePosition.Y >= AbsolutePosition.Y && mousePosition.Y <= AbsolutePosition.Y + Height) { if (Children.Count > 0) { bool ret = false; for (int i = Children.Count - 1; i >= 0; i--) { LogicalNode child = Children[i]; if (child.PropagateMouse(mousePosition)) { ret = true; } if (ret) { break; } } if (ret == false) { bool mEnter = false, mPressed = false, mLPressed = false, mRPressed = false, mReleased = false, mLReleased = false, mRReleased = false; MouseOver?.Invoke(this, null); if (!mouseOver) { mouseOver = true; MouseEnter?.Invoke(this, null); mEnter = true; } if ((Mouse.GetState().LeftButton == ButtonState.Pressed && !leftMousePressed)) { LeftMouseDown?.Invoke(this, null); leftMousePressed = true; mLPressed = true; } else if ((Mouse.GetState().LeftButton == ButtonState.Released && leftMousePressed)) { LeftMouseUp?.Invoke(this, null); leftMousePressed = false; mLReleased = true; } if ((Mouse.GetState().RightButton == ButtonState.Pressed && !rightMousePressed)) { RightMouseDown?.Invoke(this, null); rightMousePressed = true; mRPressed = true; } else if ((Mouse.GetState().RightButton == ButtonState.Released && rightMousePressed)) { RightMouseUp?.Invoke(this, null); rightMousePressed = false; mRReleased = true; } foreach (MenuEvent ev in events.Values) { if (ev.EventType == MenuEvent.Type.MouseEnter && mEnter) { ev.Trigger(this); } if (ev.EventType == MenuEvent.Type.MouseDown && mPressed) { ev.Trigger(this); } if (ev.EventType == MenuEvent.Type.MouseUp && mReleased) { ev.Trigger(this); } if (ev.EventType == MenuEvent.Type.LeftMouseDown && mLPressed) { ev.Trigger(this); } if (ev.EventType == MenuEvent.Type.LeftMouseUp && mLReleased) { ev.Trigger(this); } if (ev.EventType == MenuEvent.Type.RightMouseDown && mRPressed) { ev.Trigger(this); } if (ev.EventType == MenuEvent.Type.RightMouseUp && mRReleased) { ev.Trigger(this); } } return(true); } else { if (mouseOver) { mouseOver = false; MouseLeave?.Invoke(this, null); foreach (MenuEvent ev in events.Values) { if (ev.EventType == MenuEvent.Type.MouseLeave) { ev.Trigger(this); } } } return(true); } } else { bool mEnter = false, mPressed = false, mLPressed = false, mRPressed = false, mReleased = false, mLReleased = false, mRReleased = false; MouseOver?.Invoke(this, null); if (!mouseOver) { mouseOver = true; MouseEnter?.Invoke(this, null); mEnter = true; } if ((Mouse.GetState().LeftButton == ButtonState.Pressed && !leftMousePressed)) { LeftMouseDown?.Invoke(this, null); leftMousePressed = true; mLPressed = true; } else if ((Mouse.GetState().LeftButton == ButtonState.Released && leftMousePressed)) { LeftMouseUp?.Invoke(this, null); leftMousePressed = false; mLReleased = true; } if ((Mouse.GetState().RightButton == ButtonState.Pressed && !rightMousePressed)) { RightMouseDown?.Invoke(this, null); rightMousePressed = true; mRPressed = true; } else if ((Mouse.GetState().RightButton == ButtonState.Released && rightMousePressed)) { RightMouseUp?.Invoke(this, null); rightMousePressed = false; mRReleased = true; } foreach (MenuEvent ev in events.Values) { if (ev.EventType == MenuEvent.Type.MouseEnter && mEnter) { ev.Trigger(this); } if (ev.EventType == MenuEvent.Type.MouseDown && mPressed) { ev.Trigger(this); } if (ev.EventType == MenuEvent.Type.MouseUp && mReleased) { ev.Trigger(this); } if (ev.EventType == MenuEvent.Type.LeftMouseDown && mLPressed) { ev.Trigger(this); } if (ev.EventType == MenuEvent.Type.LeftMouseUp && mLReleased) { ev.Trigger(this); } if (ev.EventType == MenuEvent.Type.RightMouseDown && mRPressed) { ev.Trigger(this); } if (ev.EventType == MenuEvent.Type.RightMouseUp && mRReleased) { ev.Trigger(this); } } return(true); } } else { if (mouseOver) { mouseOver = false; MouseLeave?.Invoke(this, null); foreach (MenuEvent ev in events.Values) { if (ev.EventType == MenuEvent.Type.MouseLeave) { ev.Trigger(this); } } } foreach (LogicalNode child in Children) { child.PropagateMouse(mousePosition); } return(false); } }
/// <summary> /// Raises mouse events /// </summary> /// <param name="ptr">Pointer's location</param> /// <param name="leftButton">Is left button is pressed?</param> public void UpdateMouseState(Point ptr, bool leftButton, bool rightButton) { bool hovered = Bounds.Contains(ptr); if (hovered && !Hovered) // Hovered now but wasn't earlier { Hovered = true; MouseEnter?.Invoke(); MouseMove?.Invoke(); } else if (hovered && Hovered) // Hovered now and was earlier { MouseMove?.Invoke(); } else if (!hovered && Hovered) // Unhovered now but was earlier { Hovered = false; MouseLeave?.Invoke(); } if (hovered && leftButton && !lastLeft) // Hovered and left button clicked (but wasn't clicked earlier) { PressedL = true; MouseDownLeft?.Invoke(); } else if (lastLeft && !leftButton && hovered) // If left button was pressed but not now and hovered { PressedL = false; MouseClickLeft?.Invoke(); MouseUpLeft?.Invoke(); } else if (!leftButton) // If button is not pressed now { if (lastLeft) { MouseUpLeft?.Invoke(); } PressedL = false; } if (hovered && rightButton && !lastRight) // Hovered and left button clicked (but wasn't clicked earlier) { PressedR = true; MouseDownRight?.Invoke(); } else if (lastRight && !rightButton && hovered) // If left button was pressed but not now and hovered { PressedR = false; MouseClickRight?.Invoke(); MouseUpRight?.Invoke(); } else if (!rightButton) // If button is not pressed now { if (lastRight) { MouseUpRight?.Invoke(); } PressedR = false; } lastLeft = leftButton; lastRight = rightButton; }
/// <summary> /// Invokes the MouseLeave event. /// </summary> /// <param name="v">Location of the mouse.</param> /// <param name="b">The current state of the mouse buttons.</param> internal void DoMouseLeave(Vec2 v, MouseButtons b) { MouseLeave.Invoke(v, b); }
internal virtual void OnMouseLeave() { IsHovering = false; MouseLeave?.Invoke(this, new EventArgs()); }
internal Menu() { fading.ChangeOpacity += Fading_ChangeOpacity; void Fading_ChangeOpacity(object sender, double newOpacity) { if (!IsDisposed && !Disposing) { Opacity = newOpacity; } } fading.Show += Fading_Show; void Fading_Show() { if (Level == 0) { try { isShowing = true; Visible = true; isShowing = false; } catch (ObjectDisposedException) { Visible = false; isShowing = false; Log.Info($"Could not open menu, old menu was disposing," + $" IsDisposed={IsDisposed}"); } if (Visible) { Activate(); textBoxSearch.Focus(); NativeMethods.User32ShowInactiveTopmost(this); NativeMethods.ForceForegroundWindow(Handle); } } else { NativeMethods.User32ShowInactiveTopmost(this); textBoxSearch.Focus(); } } fading.Hide += Hide; InitializeComponent(); pictureBoxSearch.Paint += PictureBoxSearch_Paint; void PictureBoxSearch_Paint(object sender, PaintEventArgs e) { e.Graphics.DrawIcon( Search, new Rectangle(0, 0, pictureBoxSearch.Width, pictureBoxSearch.Height)); } SetDoubleBuffer(dgv, true); Color foreColor = Color.Black; Color backColor = Color.White; if (Config.IsDarkMode()) { foreColor = Color.White; labelTitle.ForeColor = foreColor; labelTitle.BackColor = AppColors.DarkModeBackColor1; backColor = AppColors.DarkModeBackColor2; tableLayoutPanel.BackColor = backColor; dgv.BackgroundColor = backColor; textBoxSearch.ForeColor = foreColor; textBoxSearch.BackColor = AppColors.DarkModeBackColor3; pictureBoxSearch.BackColor = AppColors.DarkModeBackColor3; tableLayoutPanelSearch.BackColor = AppColors.DarkModeBackColor3; } DataGridViewCellStyle dgvCellStyle = new DataGridViewCellStyle { SelectionForeColor = foreColor, ForeColor = foreColor, BackColor = backColor, }; dgv.DefaultCellStyle = dgvCellStyle; VScrollBar scrollBar = dgv.Controls.OfType <VScrollBar>().First(); scrollBar.MouseWheel += DgvMouseWheel; scrollBar.MouseEnter += ControlsMouseEnter; dgv.MouseEnter += ControlsMouseEnter; labelTitle.MouseEnter += ControlsMouseEnter; void ControlsMouseEnter(object sender, EventArgs e) { MouseEnter?.Invoke(); } scrollBar.MouseLeave += ControlsMouseLeave; dgv.MouseLeave += ControlsMouseLeave; labelTitle.MouseLeave += ControlsMouseLeave; void ControlsMouseLeave(object sender, EventArgs e) { MouseLeave?.Invoke(); } }
protected virtual void OnMouseLeave(GameTime g, MouseState m) => MouseLeave?.Invoke(this, g, m);
/// <summary> /// Raise the event <see cref="MouseLeave"/>. /// </summary> protected virtual void OnMouseLeave() { MouseLeave?.Invoke(this, new NativeWindowEventArgs(DeviceContext, GLContext)); }
public virtual void OnMouseLeave() { MouseLeave?.Invoke(); }
/// <summary> /// Handles the Mouse leave on the port /// </summary> /// <param name="parameter">The parameter.</param> private void OnRectangleMouseLeave(object parameter) { MouseLeave?.Invoke(parameter, null); }
internal Menu() { fading.ChangeOpacity += Fading_ChangeOpacity; void Fading_ChangeOpacity(object sender, double newOpacity) { Opacity = newOpacity; } fading.Show += Fading_Show; void Fading_Show() { if (Level == 0) { try { isShowing = true; Visible = true; isShowing = false; } catch (ObjectDisposedException) { Visible = false; isShowing = false; Log.Info($"Could not open menu, old menu was disposing," + $" IsDisposed={IsDisposed}"); } if (Visible) { Activate(); textBoxSearch.Focus(); NativeMethods.User32ShowInactiveTopmost(this); NativeMethods.ForceForegroundWindow(Handle); SetTitleColorActive(); } } else { NativeMethods.User32ShowInactiveTopmost(this); textBoxSearch.Focus(); } } fading.Hide += Hide; InitializeComponent(); pictureBoxSearch.Paint += PictureBoxSearch_Paint; void PictureBoxSearch_Paint(object sender, PaintEventArgs e) { e.Graphics.DrawIcon(Properties.Resources.search2, new Rectangle(0, 0, pictureBoxSearch.Width, pictureBoxSearch.Height)); } SetDoubleBuffer(dgv, true); DataGridViewCellStyle dgvCellStyle = new DataGridViewCellStyle { SelectionBackColor = MenuDefines.ColorSelectedItem, SelectionForeColor = Color.Black }; dgv.DefaultCellStyle = dgvCellStyle; VScrollBar scrollBar = dgv.Controls.OfType <VScrollBar>().First(); scrollBar.MouseWheel += dgv_MouseWheel; scrollBar.MouseEnter += ControlsMouseEnter; dgv.MouseEnter += ControlsMouseEnter; labelTitle.MouseEnter += ControlsMouseEnter; void ControlsMouseEnter(object sender, EventArgs e) { MouseEnter.Invoke(); } scrollBar.MouseLeave += ControlsMouseLeave; dgv.MouseLeave += ControlsMouseLeave; labelTitle.MouseLeave += ControlsMouseLeave; void ControlsMouseLeave(object sender, EventArgs e) { MouseLeave.Invoke(); } }
void TextArea_MouseLeave(object sender, EventArgs e) { MouseLeave?.Invoke(sender, e); }
public void OnMessage(Message message) { if (message.IsHandled) { return; } var msg = message as MouseMessage; if (msg == null) { return; } switch (msg.Type) { case MessageType.MouseMove: var isHover = mIsHovered; mIsHovered = mTargetRect.Contains(msg.Position); if (mIsHovered) { msg.IsHandled = true; } if (mIsHovered && !isHover) { if (MouseEnter != null) { MouseEnter.Invoke(this); } } if (mIsHovered == false && isHover) { if (MouseLeave != null) { MouseLeave.Invoke(this); } } break; case MessageType.MouseDown: mIsClicked = mTargetRect.Contains(msg.Position); if (mIsClicked) { msg.IsHandled = true; } break; case MessageType.MouseUp: if (mIsClicked && mTargetRect.Contains(msg.Position)) { if (OnClick != null) { OnClick.Invoke(this); } } if (mTargetRect.Contains(msg.Position)) { msg.IsHandled = true; } mIsClicked = false; break; } }
private void RegisterWindowCallbacks() { if (_callbackRegistered) { return; } _callbackRegistered = true; // [NOTE] // Do not register callback to GLFW as lambda or method. (That cannot work) // Put delegate on a field and register it to GLFW. _posCallback = (wnd, x, y) => { if (wnd != _window) { return; } _location = new Vector2i(x, y); Move?.Invoke(this, new WindowPositionEventArgs(x, y)); }; GLFW.SetWindowPosCallback(_window, _posCallback); _sizeCallback = (wnd, width, height) => { if (wnd != _window) { return; } GLFW.GetWindowFrameSize(_window, out var left, out var top, out var right, out var bottom); _clientSize = new Vector2i(width, height); _size = new Vector2i(_clientSize.X + left + right, _clientSize.Y + top + bottom); Resize?.Invoke(this, new ResizeEventArgs(width, height)); }; GLFW.SetWindowSizeCallback(_window, _sizeCallback); _frameBufferSizeCallback = (wnd, width, height) => { if (wnd != _window) { return; } _frameBufferSize = new Vector2i(width, height); FrameBufferSizeChanged?.Invoke(this, _frameBufferSize); }; GLFW.SetFramebufferSizeCallback(_window, _frameBufferSizeCallback); _closeCallback = wnd => { if (wnd != _window) { return; } var cancel = false; var e = new CancelEventArgs(&cancel); Closing?.Invoke(this, e); if (e.Cancel) { GLFW.SetWindowShouldClose(_window, false); } }; GLFW.SetWindowCloseCallback(_window, _closeCallback); _iconifyCallback = (wnd, minimized) => { if (wnd != _window) { return; } Minimized?.Invoke(this, new MinimizedEventArgs(minimized)); }; GLFW.SetWindowIconifyCallback(_window, _iconifyCallback); _focusCallback = (wnd, focused) => { if (wnd != _window) { return; } FocusedChanged?.Invoke(this, new FocusedChangedEventArgs(focused)); }; GLFW.SetWindowFocusCallback(_window, _focusCallback); _charCallback = (wnd, unicode) => { if (wnd != _window) { return; } CharInput?.Invoke(this, new CharInputEventArgs(unicode)); }; GLFW.SetCharCallback(_window, _charCallback); _keyCallback = (wnd, glfwKey, scanCode, action, glfwMods) => { if (wnd != _window) { return; } var e = new KeyboardKeyEventArgs(glfwKey, scanCode, glfwMods, action == GlfwInputAction.Repeat); if (action == GlfwInputAction.Release) { KeyUp?.Invoke(this, e); } else { KeyDown?.Invoke(this, e); } }; GLFW.SetKeyCallback(_window, _keyCallback); _cursorEnterCallback = (wnd, entered) => { if (wnd != _window) { return; } if (entered) { MouseEnter?.Invoke(this); } else { MouseLeave?.Invoke(this); } }; GLFW.SetCursorEnterCallback(_window, _cursorEnterCallback); _mouseButtonCallback = (wnd, button, action, mods) => { if (wnd != _window) { return; } var e = new MouseButtonEventArgs(button, action, mods); if (action == GlfwInputAction.Release) { MouseUp?.Invoke(this, e); } else { MouseDown?.Invoke(this, e); } }; GLFW.SetMouseButtonCallback(_window, _mouseButtonCallback); _cursorPosCallback = (wnd, posX, posY) => { if (wnd != _window) { return; } var e = new MouseMoveEventArgs(new Vector2((int)posX, (int)posY)); MouseMove?.Invoke(this, e); }; GLFW.SetCursorPosCallback(_window, _cursorPosCallback); _scrollCallback = (wnd, offsetX, offsetY) => { if (wnd != _window) { return; } var e = new MouseWheelEventArgs((float)offsetX, (float)offsetY); MouseWheel?.Invoke(this, e); }; GLFW.SetScrollCallback(_window, _scrollCallback); _dropCallback = (wnd, count, paths) => { if (wnd != _window) { return; } var e = new FileDropEventArgs(count, paths); FileDrop?.Invoke(this, e); }; GLFW.SetDropCallback(_window, _dropCallback); _joystickCallback = (joystick, state) => { var e = new JoystickConnectionEventArgs(joystick, state == GlfwConnectedState.Connected); JoystickConnectionChanged?.Invoke(this, e); }; GLFW.SetJoystickCallback(_joystickCallback); _monitorCallback = (monitor, state) => { var e = new MonitorConnectionEventArgs(monitor, state == GlfwConnectedState.Connected); MonitorConnectionChanged?.Invoke(this, e); }; GLFW.SetMonitorCallback(_monitorCallback); _refreshCallback = wnd => { if (wnd != _window) { return; } Refresh?.Invoke(this); }; GLFW.SetWindowRefreshCallback(_window, _refreshCallback); }
public void PerformMouseLeave(EventArgs e) { MouseLeave?.Invoke(null, e); }
private void Edit_MouseLeave(object sender, EventArgs e) { MouseLeave?.Invoke(this, e); }
internal void Internal_OnMouseLeave() { MouseLeave?.Invoke(); GUI.OnMouseLeave(); }
protected virtual void OnMouseLeave(object sender, UIEventArgs e) { MouseLeave?.Invoke(sender, e); }
void IEventListener.ListenMouseLeave(UIMouseLeaveEventArgs e) { MouseLeave?.Invoke(this, e); }
protected virtual void OnMouseLeave(MouseMoveEventArgs data) { MouseLeave?.Invoke(this, (MouseEventArgs)data); _mouseDown = false; }
protected virtual void OnMouseLeave(double x, double y, Input.MouseEventsContext context) { IsMouseOver = false; MouseLeave?.Invoke(this, new Input.MouseEventArgs(context.MouseButtons, context.Clicks, x, y, context.Delta)); System.Diagnostics.Debug.WriteLine($"{this} OnMouseLeave"); }
public virtual void OnMouseLeave(MouseMoveEventArgs args) => MouseLeave?.Invoke(this, args);
protected void OnMouseLeave() { MouseLeave?.Invoke(); }
internal Menu() { fading.ChangeOpacity += Fading_ChangeOpacity; void Fading_ChangeOpacity(object sender, double newOpacity) { if (!IsDisposed && !Disposing) { Opacity = newOpacity; } } fading.Show += Fading_Show; void Fading_Show() { try { isShowing = true; Visible = true; isShowing = false; } catch (ObjectDisposedException) { Visible = false; isShowing = false; Log.Info($"Could not open menu, old menu was disposing," + $" IsDisposed={IsDisposed}"); } if (Visible) { if (Level == 0) { Activate(); textBoxSearch.Focus(); NativeMethods.User32ShowInactiveTopmost(this); NativeMethods.ForceForegroundWindow(Handle); } else { NativeMethods.User32ShowInactiveTopmost(this); textBoxSearch.Focus(); } } } fading.Hide += Hide; InitializeComponent(); pictureBoxSearch.Paint += PictureBoxSearch_Paint; void PictureBoxSearch_Paint(object sender, PaintEventArgs e) { e.Graphics.DrawIcon( Search, new Rectangle(0, 0, pictureBoxSearch.Width, pictureBoxSearch.Height)); } SetDoubleBuffer(dgv, true); Color foreColor = Color.Black; Color titleBackColor = AppColors.Title; Color backColor = AppColors.Background; Color backColorSearch = AppColors.SearchField; if (Config.IsDarkMode()) { foreColor = Color.White; labelTitle.ForeColor = foreColor; textBoxSearch.ForeColor = foreColor; titleBackColor = AppColors.DarkModeTitle; backColor = AppColors.DarkModeBackground; backColorSearch = AppColors.DarkModeSearchField; } if (backColor.R == 0) { backColor = Color.White; } labelTitle.BackColor = titleBackColor; tableLayoutPanelDgvAndScrollbar.BackColor = backColor; dgv.BackgroundColor = backColor; textBoxSearch.BackColor = backColorSearch; pictureBoxSearch.BackColor = backColorSearch; tableLayoutPanelSearch.BackColor = backColorSearch; dgv.DefaultCellStyle = new DataGridViewCellStyle { SelectionForeColor = foreColor, ForeColor = foreColor, BackColor = backColor, }; customScrollbar.GotFocus += CustomScrollbar_GotFocus; void CustomScrollbar_GotFocus(object sender, EventArgs e) { textBoxSearch.Focus(); } customScrollbar.Margin = new Padding(0); customScrollbar.Scroll += CustomScrollbar_Scroll; void CustomScrollbar_Scroll(object sender, EventArgs e) { decimal firstIndex = customScrollbar.Value * dgv.Rows.Count / (decimal)customScrollbar.Maximum; int firstIndexRounded = (int)Math.Round(firstIndex, 0, MidpointRounding.AwayFromZero); if (firstIndexRounded > -1 && firstIndexRounded < dgv.RowCount) { dgv.FirstDisplayedScrollingRowIndex = firstIndexRounded; } } customScrollbar.MouseEnter += ControlsMouseEnter; dgv.MouseEnter += ControlsMouseEnter; labelTitle.MouseEnter += ControlsMouseEnter; void ControlsMouseEnter(object sender, EventArgs e) { MouseEnter?.Invoke(); } customScrollbar.MouseLeave += ControlsMouseLeave; dgv.MouseLeave += ControlsMouseLeave; labelTitle.MouseLeave += ControlsMouseLeave; void ControlsMouseLeave(object sender, EventArgs e) { MouseLeave?.Invoke(); } }