Files
Terminal.Gui/UICatalog/Scenarios/BordersComparisons.cs
BDisp 49e2b95625 Fixes #1861. Border: Title property is preferable to Text. (#1862)
* Fixes #1861. Border Title property is preferable than the Text.

* Fixes #1866. Bug when scrolling text and type in a TextView. (#1868)

* Some fixes for the WebConsole support. (#1865)

* Invoking NotifyStopRunState for all situations.

* Added Clicked property to support web console.

* Changing to MoveDown to stay always visible.

* Fixes #1849. Wizard as non-popup is broken (#1853)

* trying to make it work

* Fixes #1849. Wizard as non-modal doesn't work

* Fixes #1855. Window and Frame content view without the margin frame.

* Fixing layout of non-modal

* WizardSTep is now a FrameView

* Now use Modal = false to set visual style automatically

* Removed Controls as an explicit construct. Now just Add to WizardStep

Co-authored-by: BDisp <bd.bdisp@gmail.com>

* Update docs with keybindings, global key event and designer (#1869)

* Added docs on keybinding and global key event

* Added TerminalGuiDesigner to showcases/examples

* Regenerated Docs (#1870)

* Fixed cancel logic. Title now shows for non-modal. (#1871)

* Fixes #1874. API docs on github are broken. (#1875)

* Fixes #1874. API docs on github are broken.

* Rebuild with docfx 2.59.3.0 version.

* Fixes Wizard cancel logic and updates docs (#1878)

* Fixed cancel logic. Title now shows for non-modal.

* trying to fix docs

* trying to fix docs

* Fixes #1867. Use Undo and Redo commands with WordWrap enabled. (#1877)

* Updated docs; regeneraged docs (#1881)

* Added a 'Read Only' to the Editor scenario Format menu. (#1882)

* Fixes #1883. Toplevel now propogates Loaded & Ready events to child Toplevel views.

* Updated API doc theme. Added Wizard Sample

* Tweaked API docs format and content. Fixed build warnings.

* Fixes #1889. Docs broken after org move.

* Regen API docs

* Fixes readme links to API docs

* Avoiding breaking change.

* Fixes typos.

* Passing string.Empty to Title from the default constructor.

* Initializes title with string.Empty instead of null.

Co-authored-by: Tig Kindel <tig@users.noreply.github.com>
Co-authored-by: Thomas Nind <31306100+tznind@users.noreply.github.com>
2022-08-01 16:06:15 -07:00

145 lines
3.9 KiB
C#

using Terminal.Gui;
namespace UICatalog.Scenarios {
[ScenarioMetadata (Name: "Borders Comparisons", Description: "Compares Window, Toplevel and FrameView borders.")]
[ScenarioCategory ("Layout")]
[ScenarioCategory ("Borders")]
public class BordersComparisons : Scenario {
public override void Init (Toplevel top, ColorScheme colorScheme)
{
top.Dispose ();
Application.Init ();
top = Application.Top;
var borderStyle = BorderStyle.Double;
var drawMarginFrame = false;
var borderThickness = new Thickness (1, 2, 3, 4);
var borderBrush = Colors.Base.HotFocus.Foreground;
var padding = new Thickness (1, 2, 3, 4);
var background = Colors.Base.HotNormal.Foreground;
var effect3D = true;
var win = new Window (new Rect (5, 5, 40, 20), "Test", 8,
new Border () {
BorderStyle = borderStyle,
DrawMarginFrame = drawMarginFrame,
BorderThickness = borderThickness,
BorderBrush = borderBrush,
Padding = padding,
Background = background,
Effect3D = effect3D
});
var tf1 = new TextField ("1234567890") { Width = 10 };
var button = new Button ("Press me!") {
X = Pos.Center (),
Y = Pos.Center (),
};
button.Clicked += () => MessageBox.Query (20, 7, "Hi", "I'm a Window?", "Yes", "No");
var label = new Label ("I'm a Window") {
X = Pos.Center (),
Y = Pos.Center () - 3,
};
var tv = new TextView () {
Y = Pos.AnchorEnd (2),
Width = 10,
Height = Dim.Fill (),
ColorScheme = Colors.Dialog,
Text = "1234567890"
};
var tf2 = new TextField ("1234567890") {
X = Pos.AnchorEnd (10),
Y = Pos.AnchorEnd (1),
Width = 10
};
win.Add (tf1, button, label, tv, tf2);
top.Add (win);
var top2 = new Border.ToplevelContainer (new Rect (50, 5, 40, 20),
new Border () {
BorderStyle = borderStyle,
DrawMarginFrame = drawMarginFrame,
BorderThickness = borderThickness,
BorderBrush = borderBrush,
Padding = padding,
Background = background,
Effect3D = effect3D,
Title = "Test2"
}) {
ColorScheme = Colors.Base,
};
var tf3 = new TextField ("1234567890") { Width = 10 };
var button2 = new Button ("Press me!") {
X = Pos.Center (),
Y = Pos.Center (),
};
button2.Clicked += () => MessageBox.Query (20, 7, "Hi", "I'm a Toplevel?", "Yes", "No");
var label2 = new Label ("I'm a Toplevel") {
X = Pos.Center (),
Y = Pos.Center () - 3,
};
var tv2 = new TextView () {
Y = Pos.AnchorEnd (2),
Width = 10,
Height = Dim.Fill (),
ColorScheme = Colors.Dialog,
Text = "1234567890"
};
var tf4 = new TextField ("1234567890") {
X = Pos.AnchorEnd (10),
Y = Pos.AnchorEnd (1),
Width = 10
};
top2.Add (tf3, button2, label2, tv2, tf4);
top.Add (top2);
var frm = new FrameView (new Rect (95, 5, 40, 20), "Test3", null,
new Border () {
BorderStyle = borderStyle,
DrawMarginFrame = drawMarginFrame,
BorderThickness = borderThickness,
BorderBrush = borderBrush,
Padding = padding,
Background = background,
Effect3D = effect3D
}) { ColorScheme = Colors.Base };
var tf5 = new TextField ("1234567890") { Width = 10 };
var button3 = new Button ("Press me!") {
X = Pos.Center (),
Y = Pos.Center (),
};
button3.Clicked += () => MessageBox.Query (20, 7, "Hi", "I'm a FrameView?", "Yes", "No");
var label3 = new Label ("I'm a FrameView") {
X = Pos.Center (),
Y = Pos.Center () - 3,
};
var tv3 = new TextView () {
Y = Pos.AnchorEnd (2),
Width = 10,
Height = Dim.Fill (),
ColorScheme = Colors.Dialog,
Text = "1234567890"
};
var tf6 = new TextField ("1234567890") {
X = Pos.AnchorEnd (10),
Y = Pos.AnchorEnd (1),
Width = 10
};
frm.Add (tf5, button3, label3, tv3, tf6);
top.Add (frm);
Application.Run ();
}
public override void Run ()
{
// Do nothing
}
}
}