public override bool ProcessMouse(SadConsole.Input.MouseConsoleState info) { if (Parent.CapturedControl == this) { if (info.Mouse.LeftButtonDown == false) { Parent.ReleaseControl(); } else { var location = this.TransformConsolePositionByControlPosition(info.ConsolePosition); //if (info.ConsolePosition.X >= Position.X && info.ConsolePosition.X < Position.X + Width) if (location.X >= 0 && location.X <= Width - 1 && location.Y > -4 && location.Y < Height + 3) { _selectedPosition = location.X; SelectedColorSafe = this[_selectedPosition, 0].Foreground; } IsDirty = true; } } return(base.ProcessMouse(info)); }
public override bool ProcessMouse(SadConsole.Input.MouseConsoleState info) { if (Parent.CapturedControl == this) { if (info.Mouse.LeftButtonDown == false) { Parent.ReleaseControl(); } else { var location = this.TransformConsolePositionByControlPosition(info.CellPosition); //if (info.ConsolePosition.X >= Position.X && info.ConsolePosition.X < Position.X + Width) if (location.X >= -6 && location.X <= Width + 5 && location.Y > -4 && location.Y < Height + 3) { this[_selectedColorPosition.X, _selectedColorPosition.Y].Glyph = 0; _selectedColorPosition = new Point(Microsoft.Xna.Framework.MathHelper.Clamp(location.X, 0, Width - 1), Microsoft.Xna.Framework.MathHelper.Clamp(location.Y, 0, Height - 1)); SelectedColorSafe = this[_selectedColorPosition.X, _selectedColorPosition.Y].Background; this[_selectedColorPosition.X, _selectedColorPosition.Y].Glyph = 4; } IsDirty = true; } } return(base.ProcessMouse(info)); }
protected override void OnMouseEnter(SadConsole.Input.MouseConsoleState state) { if (lastMouseState != null) { // _lastInfo.Cell.Effect = null; } base.OnMouseEnter(state); }
protected override void OnMouseExit(SadConsole.Input.MouseConsoleState state) { if (lastMouseState != null) { // _lastInfo.Cell.Effect = null; } DrawSelectedItemString(); base.OnMouseExit(state); }
protected override void OnLeftMouseClicked(SadConsole.Input.MouseConsoleState info) { var mousePosition = TransformConsolePositionByControlPosition(info.CellPosition); if (new Rectangle(0, 0, 16, 16).Contains(mousePosition)) { SelectedCharacter = this[mousePosition.ToIndex(16)].Glyph; } base.OnLeftMouseClicked(info); }
protected override void OnMouseLeftClicked(SadConsole.Input.MouseConsoleState state) { if (state.Cell != null && trackedRegion.Contains(state.ConsoleCellPosition.X, state.ConsoleCellPosition.Y)) { SelectedCharacterIndex = state.Cell.Glyph; } else if (state.ConsoleCellPosition.X == Width - 1 && state.ConsoleCellPosition.Y == 0) { Hide(); } base.OnMouseLeftClicked(state); }
public override bool ProcessMouse(SadConsole.Input.MouseConsoleState state) { // Check the scroll bar for mouse info first. If mouse not handled by scroll bar, then.. // Create a mouse state based on the controlsContainer if (!controlsContainer.ProcessMouse(new SadConsole.Input.MouseConsoleState(controlsContainer, state.Mouse))) { // Process this console normally. return(mainConsole.ProcessMouse(state)); } // If we get here, then the mouse was over the scroll bar. return(true); }
protected override void OnMouseIn(SadConsole.Input.MouseConsoleState info) { var mousePosition = TransformConsolePositionByControlPosition(info.CellPosition); if (new Rectangle(0, 0, 16, 16).Contains(mousePosition) && info.Mouse.LeftButtonDown) { if (!UseFullClick) { SelectedCharacter = this[mousePosition.ToIndex(16)].Glyph; } } base.OnMouseIn(info); }
protected override void OnMouseMove(SadConsole.Input.MouseConsoleState state) { if (state.Cell != null && trackedRegion.Contains(state.ConsoleCellPosition.X, state.ConsoleCellPosition.Y)) { // Draw the character index and value in the status area string[] items = new string[] { "Index: ", state.Cell.Glyph.ToString() + " ", ((char)state.Cell.Glyph).ToString() }; items[2] = items[2].PadRight(Width - 2 - (items[0].Length + items[1].Length)); var text = items[0].CreateColored(Color.LightBlue, Theme.WindowTheme.BorderStyle.Background, null) + items[1].CreateColored(Color.LightCoral, Color.Black, null) + items[2].CreateColored(Color.LightCyan, Color.Black, null); text.IgnoreBackground = true; text.IgnoreEffect = true; Print(1, Height - 2, text); // Set the special effect on the current known character and clear it on the last known if (lastMouseState == null) { } else if (lastMouseState.ConsoleCellPosition != state.ConsoleCellPosition) { SetEffect(lastMouseState.ConsoleCellPosition.X, lastMouseState.ConsoleCellPosition.Y, unhighlightEffect ); } SetEffect(state.ConsoleCellPosition.X, state.ConsoleCellPosition.Y, highlightedEffect); lastMouseState = state.Clone(); } else { DrawSelectedItemString(); // Clear the special effect on the last known character if (lastMouseState != null) { SetEffect(lastMouseState.ConsoleCellPosition.X, lastMouseState.ConsoleCellPosition.Y, unhighlightEffect); lastMouseState = null; } } base.OnMouseMove(state); }
protected override void OnMouseIn(SadConsole.Input.MouseConsoleState info) { base.OnMouseIn(info); if (Parent.CapturedControl == null) { if (info.Mouse.LeftButtonDown) { var location = this.TransformConsolePositionByControlPosition(info.CellPosition); _selectedPosition = location.X; SelectedColorSafe = this[_selectedPosition, 0].Foreground; IsDirty = true; Parent.CaptureControl(this); } } }
protected override void OnMouseMove(SadConsole.Input.MouseConsoleState state) { if (state.Cell != null && trackedRegion.Contains(state.ConsoleCellPosition.X, state.ConsoleCellPosition.Y)) { isHover = true; hoverGlyph = state.Cell.Glyph; // Set the special effect on the current known character and clear it on the last known if (lastMouseState == null) { } else if (lastMouseState.ConsoleCellPosition != state.ConsoleCellPosition) { SetEffect(lastMouseState.ConsoleCellPosition.X, lastMouseState.ConsoleCellPosition.Y, unhighlightEffect ); } SetEffect(state.ConsoleCellPosition.X, state.ConsoleCellPosition.Y, highlightedEffect); lastMouseState = state.Clone(); } else { isHover = false; // Clear the special effect on the last known character if (lastMouseState != null) { SetEffect(lastMouseState.ConsoleCellPosition.X, lastMouseState.ConsoleCellPosition.Y, unhighlightEffect); lastMouseState = null; } } base.OnMouseMove(state); IsDirty = true; }
public override bool ProcessMouse(SadConsole.Input.MouseConsoleState state) => base.ProcessMouse(state);
public override void ProcessMouse(SadConsole.Input.MouseConsoleState info) { }