protected internal override void MouseUp(MouseEventArgs e) { _isPressed = false; lock (RenderRule) { RenderRule.SetTextCursor( new Point( e.Location.X - RenderRule.Area.X, e.Location.Y - RenderRule.Area.Y)); } }
public override void mouseDown(object sender, MouseEventArgs e) { if (e.button_ == MouseButton.RIGHT) { GameEntity en = Locator.getComponentManager().pick(Locator.getShip().tiles, mouseTile_); if (en != null && en.tile != null && en.item != null && (en.spatial.w_translation - Locator.getPlayer().spatial.w_translation).Length() < interactRange) { changeState(new Removing(en)); } } }
protected override void OnLeftMouseClick(MouseEventArgs args) { base.OnLeftMouseClick(args); EventArgs e = new EventArgs(); OnExecuted(e); if (Executed != null) Executed(this, e); args.Handled = true; }
protected override void OnMouseMove(MouseEventArgs args) { if (args.MouseMode == MouseMode.Captured) { position += args.GlobalPosition; } output.Text = position.ToString(); base.OnMouseMove(args); }
protected internal override void MouseMove(MouseEventArgs e) { if (!_isPressed) { return; } lock (RenderRule) { RenderRule.SetTextCursor( new Point( e.Location.X - RenderRule.Area.X, e.Location.Y - RenderRule.Area.Y)); } }
/// <summary> /// Вызывает делегат входа мыши в контрол /// </summary> /// <param name="e"></param> protected internal virtual void OnMouseInput(MouseEventArgs e) { MouseInput?.Invoke(this, e); _isInputMouse = true; _isBlockedMouse = true; }
protected override void OnLeftMouseUp(MouseEventArgs args) { if (dragging) { dragging = false; args.Handled = true; } }
/// <summary> /// Вызывает делегат колесика /// </summary> /// <param name="e"></param> protected internal virtual void OnScrollDelta(MouseEventArgs e) { ScrollDelta?.Invoke(this, e); _isBlockedMouse = true; }
private void TextBox_MouseDown(Control sender, MouseEventArgs e) { Vector2 pos = e.Coord - DrawabledLocation; char ch; Vector2 sz = Vector2.Zero; int coretkaIndex = -1; for (int i = 0; i < Text.Length; i++) { ch = Text[i]; sz += Font.MeasureString(ch.ToString()); if (pos.X > sz.X) coretkaIndex = i; if (pos.X < sz.X) break; } _positionCoretka = coretkaIndex + 1; }
private void ExitGameClicked(Control sender, MouseEventArgs args) { _game.Exit(); }
protected override void OnRightMouseDown(MouseEventArgs args) { if (!IsActiveScreen) return; Manager.Player.InteractInput = true; args.Handled = true; }
protected virtual void OnMouseWheel(MouseEventArgs e) { var handler = MouseWheel; handler?.Invoke(this, e); }
protected override void OnLeftMouseDown(MouseEventArgs args) { mouseClickActive = true; }
protected override void OnLeftMouseUp(MouseEventArgs args) { mouseClickActive = false; }
/// <summary> /// This method is called when the <see cref="GuiItem.Click"/> event is raised. /// </summary> /// <param name="sender"> The <see cref="GuiItem"/> that raised the event. </param> /// <param name="e"> The current <see cref="MouseState"/>. </param> protected void OnClick(object sender, MouseEventArgs e) { if (IsSliding(GetRotatedMouse(e.State))) sliding = true; }
/// <summary> /// This method is called when the <see cref="MouseDown"/> event is raised. /// </summary> /// <param name="sender"> The <see cref="GuiItem"/> that raised the event. </param> /// <param name="e"> The current <see cref="MouseState"/>. </param> protected void OnMouseDown(object sender, MouseEventArgs e) { Vector2 offset = SliderBarDimentions.Position() + Position - GetRotatedMouse(e.State); if (oldOffset == Vector2.Zero) oldOffset = offset; else if (offset != oldOffset) { Rectangle newDim = SliderBarDimentions.Add(new Vector2(-offset.X - (SliderBarDimentions.Width >> 1), 0)); if (newDim.X + Position.X > Bounds.X && newDim.X + SliderBarDimentions.Width <= Bounds.Width) SliderBarDimentions = newDim; else if (newDim.X + Position.X > Bounds.X) SliderBarDimentions = new Rectangle(Bounds.Width - SliderBarDimentions.Width, 0, SliderBarDimentions.Width, SliderBarDimentions.Height); else SliderBarDimentions = new Rectangle(0, 0, SliderBarDimentions.Width, SliderBarDimentions.Height); oldOffset = offset; float ppp = 100f / Bounds.Width; bool overCenter = SliderBarDimentions.X * ppp >= 50; float percent = (SliderBarDimentions.X + (overCenter ? SliderBarDimentions.Width : 0)) * ppp; int old = Value; data.ChangeValue((int)percent); if (Value != old) ValueChanged.Invoke(this, new Args(old, Value)); } }
/// <summary> /// Вызывает делегат движения мыши /// </summary> /// <param name="e"></param> protected internal virtual void OnMouseMove(MouseEventArgs e) { MouseMove?.Invoke(this, e); _isBlockedMouse = true; }
private void Control_MouseUp(Control sender, MouseEventArgs e) { if (_isClick && Focused) Click?.Invoke(this, e); _isClick = false; }
private void Control_MouseDown(Control sender, MouseEventArgs e) { Focused = true; _isClick = true; }
protected override void OnLeftMouseDown(MouseEventArgs args) { if (!IsActiveScreen) return; Manager.Player.ApplyInput = true; args.Handled = true; }
private void TextBox_Click(GuiItem sender, MouseEventArgs e) { if (AutoFocus) { for (int i = 0; i < tabs.Length; i++) { GuiItemCollection controlls = tabs[i].Value; for (int j = 0; j < controlls.Count; j++) { TextBox txt; if ((txt = controlls[j] as TextBox) != null) { txt.Focused = txt.Name == sender.Name; txt.Refresh(); } } } } }
protected override void OnMouseMove(MouseEventArgs args) { if (!IsActiveScreen) return; if (args.MouseMode == MouseMode.Captured && IsActiveScreen) { Manager.Player.HeadInput = args.GlobalPosition.ToVector2() * mouseSpeed * new Vector2(1f, -1f); args.Handled = true; } }
protected internal override void MouseDoubleClick(MouseEventArgs e) { MouseDown(e); }
protected virtual void OnMouseDoubleClick(MouseEventArgs e) { var handler = MouseDoubleClick; handler?.Invoke(this, e); }
/// <summary> /// Констрктор для Базовой Инициализации /// </summary> /// <param name="window">Окно в котором будут Отображаться Контролы</param> internal static void ControlInicializer(IWindow window) { if (Graphics == null) Graphics = window.Graphics2D; if (Window == null) Window = window; _ticks = new TickEventArgs(Window, null); _mouseEventArgs = new MouseEventArgs(); _keyEventArgs = new KeyEventArgs(); }
private void Breturn_Click(object sender, MouseEventArgs e) { Game1.Instance.Scenes.Navigate("Harbor"); }
/// <summary> /// Вызывает делегат выхода мыши из контрола /// </summary> /// <param name="e"></param> protected internal virtual void OnMouseLeave(MouseEventArgs e) { MouseLeave?.Invoke(this, e); _isInputMouse = false; }
private void NewGameClicked(Control sender, MouseEventArgs args) { NextState = new StateTransition(() => new GameState(_game, _squidInputManager)); }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); if (ReadOnly && e.Button == MouseButton.Left) btnDown_Click(this, new MouseEventArgs()); }
protected override void OnLeftMouseDown(MouseEventArgs args) { if (Orientation == Orientation.Horizontal) { if (args.LocalPosition.X > ActualSplitterPosition && args.LocalPosition.X <= ActualSplitterPosition + SplitterSize) { dragging = true; args.Handled = true; } } else if (Orientation == Orientation.Vertical) { if (args.LocalPosition.Y > ActualSplitterPosition && args.LocalPosition.Y <= ActualSplitterPosition + SplitterSize) { dragging = true; args.Handled = true; } } }
void Input_MouseDown(object sender, MouseEventArgs e) { if (ReadOnly && (e.Position.X >= AbsoluteLeft && e.Position.X <= AbsoluteLeft + Width && e.Position.Y >= AbsoluteTop && e.Position.Y <= AbsoluteTop + Height)) return; if (lstCombo.Visible && (e.Position.X < lstCombo.AbsoluteLeft || e.Position.X > lstCombo.AbsoluteLeft + lstCombo.Width || e.Position.Y < lstCombo.AbsoluteTop || e.Position.Y > lstCombo.AbsoluteTop + lstCombo.Height) && (e.Position.X < btnDown.AbsoluteLeft || e.Position.X > btnDown.AbsoluteLeft + btnDown.Width || e.Position.Y < btnDown.AbsoluteTop || e.Position.Y > btnDown.AbsoluteTop + btnDown.Height)) { //lstCombo.Visible = false; btnDown_Click(sender, e); } }
protected override void OnMouseMove(MouseEventArgs args) { if (dragging) { if (Orientation == Orientation.Horizontal) SplitterPosition = args.LocalPosition.X; else if (Orientation == Orientation.Vertical) SplitterPosition = args.LocalPosition.Y; args.Handled = true; } }
/// <summary> /// Вызывает делегат отпускания кнопки мыши /// </summary> /// <param name="e"></param> protected internal virtual void OnMouseUp(MouseEventArgs e) { MouseUp?.Invoke(this, e); _isBlockedMouse = true; _isMouseDown = false; }