diff --git a/UICatalog/Scenarios/ASCIICustomButton.cs b/UICatalog/Scenarios/ASCIICustomButton.cs deleted file mode 100644 index 92398ceb6..000000000 --- a/UICatalog/Scenarios/ASCIICustomButton.cs +++ /dev/null @@ -1,400 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Text; -using JetBrains.Annotations; -using Terminal.Gui; - -namespace UICatalog.Scenarios; - -[ScenarioMetadata ("ASCIICustomButtonTest", "ASCIICustomButton sample")] -[ScenarioCategory ("Controls")] -public class ASCIICustomButtonTest : Scenario -{ - private static bool _smallerWindow; - private MenuItem _miSmallerWindow; - private ScrollViewTestWindow _scrollViewTestWindow; - - public override void Main () - { - _smallerWindow = false; - - Application.Init (); - Toplevel top = new (); - - var menu = new MenuBar - { - Menus = - [ - new MenuBarItem ( - "_Window Size", - new [] - { - _miSmallerWindow = - new MenuItem ( - "Smaller Window", - "", - ChangeWindowSize - ) - { - CheckType = MenuItemCheckStyle - .Checked - }, - null, - new MenuItem ( - "Quit", - "", - () => Application.RequestStop (), - null, - null, - (KeyCode)Application.QuitKey - ) - } - ) - ] - }; - - _scrollViewTestWindow = new ScrollViewTestWindow { Y = Pos.Bottom (menu) }; - - top.Add (menu, _scrollViewTestWindow); - Application.Run (top); - top.Dispose (); - - Application.Shutdown (); - - return; - - void ChangeWindowSize () - { - _smallerWindow = (bool)(_miSmallerWindow.Checked = !_miSmallerWindow.Checked); - top.Remove (_scrollViewTestWindow); - _scrollViewTestWindow.Dispose (); - - _scrollViewTestWindow = new ScrollViewTestWindow (); - top.Add (_scrollViewTestWindow); - } - } - - public class ASCIICustomButton : Button - { - private FrameView _border; - private Label _fill; - public string Description => $"Description of: {Id}"; - - public void CustomInitialize () - { - _border = new FrameView { Width = Width, Height = Height }; - - var fillText = new StringBuilder (); - - for (var i = 0; i < Viewport.Height; i++) - { - if (i > 0) - { - fillText.AppendLine (""); - } - - for (var j = 0; j < Viewport.Width; j++) - { - fillText.Append ("█"); - } - } - - _fill = new Label { Visible = false, CanFocus = false, Text = fillText.ToString () }; - - var title = new Label { X = Pos.Center (), Y = Pos.Center (), Text = Text }; - - _border.MouseClick += This_MouseClick; - _fill.MouseClick += This_MouseClick; - title.MouseClick += This_MouseClick; - - Add (_border, _fill, title); - } - - protected override void OnHasFocusChanged (bool newHasFocus, [CanBeNull] View previousFocusedView, [CanBeNull] View focusedView) - { - if (newHasFocus) - { - _border.Visible = false; - _fill.Visible = true; - PointerEnter?.Invoke (this); - } - else - { - _border.Visible = true; - _fill.Visible = false; - } - } - - public event Action PointerEnter; - private void This_MouseClick (object sender, MouseEventArgs obj) { NewMouseEvent (obj); } - } - - public class ScrollViewTestWindow : Window - { - private const int BUTTON_HEIGHT = 3; - private const int BUTTON_WIDTH = 25; - private const int BUTTONS_ON_PAGE = 7; - - private readonly List