Skip to content

Commit

Permalink
renamed to Unicode and expanded scope
Browse files Browse the repository at this point in the history
  • Loading branch information
tig committed May 27, 2020
1 parent 05c9ec7 commit 22d423d
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 36 deletions.
3 changes: 2 additions & 1 deletion UICatalog/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"profiles": {
"UICatalog": {
"commandName": "Project"
"commandName": "Project",
"commandLineArgs": "\"Unicode\""
}
}
}
123 changes: 123 additions & 0 deletions UICatalog/Scenarios/Unicode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
using NStack;
using System.Collections.Generic;
using System.Text;
using Terminal.Gui;

namespace UICatalog {
[ScenarioMetadata (Name: "Unicode", Description: "Tries to test Unicode in all controls (#204)")]
[ScenarioCategory ("Text")]
[ScenarioCategory ("Controls")]
class UnicodeInMenu : Scenario {
public override void Setup ()
{
const int margin = 1;

var menu = new MenuBar (new MenuBarItem [] {
new MenuBarItem ("_Файл", new MenuItem [] {
new MenuItem ("_Создать", "Creates new file", null),
new MenuItem ("_Открыть", "", null),
new MenuItem ("Со_хранить", "", null),
new MenuItem ("_Выход", "", () => Application.RequestStop() )
}),
new MenuBarItem ("_Edit", new MenuItem [] {
new MenuItem ("_Copy", "", null),
new MenuItem ("C_ut", "", null),
new MenuItem ("_Paste", "", null)
})
});
Top.Add (menu);

var label = new Label ("Button:") { X = margin, Y = margin };
Win.Add (label);
var button = new Button (" ~  s  gui.cs   master ↑10") { X = 15, Y = Pos.Y (label) };
Win.Add (button);

label = new Label ("Button:") { X = Pos.X (label), Y = Pos.Bottom (label) + 1 };
Win.Add (label);
var button2 = new Button ("Со_хранить") { X = 15, Y = Pos.Y (label), Width = Dim.Percent (50) };
Win.Add (button2);

label = new Label ("CheckBox:") { X = Pos.X (label), Y = Pos.Bottom (label) + 1 };
Win.Add (label);
var checkBox = new CheckBox (" ~  s  gui.cs   master ↑10") { X = 15, Y = Pos.Y (label), Width = Dim.Percent (50) };
Win.Add (checkBox);

label = new Label ("ComboBox:") { X = Pos.X (label), Y = Pos.Bottom (label) + 1 };
Win.Add (label);
var comboBox = new ComboBox (1, 1, 30, 5, new List<string> () { "item #1", " ~  s  gui.cs   master ↑10", "Со_хранить" }) {
X = 15,
Y = Pos.Y (label),
Width = 30,
ColorScheme = Colors.Error
};
Win.Add (comboBox);
comboBox.Text = " ~  s  gui.cs   master ↑10";

label = new Label ("HexView:") { X = Pos.X (label), Y = Pos.Bottom (label) + 2 };
Win.Add (label);
var hexView = new HexView (new System.IO.MemoryStream (Encoding.ASCII.GetBytes (" ~  s  gui.cs   master ↑10 Со_хранить"))) {
X = 15,
Y = Pos.Y (label),
Width = Dim.Percent (60),
Height = 5
};
Win.Add (hexView);

label = new Label ("ListView:") { X = Pos.X (label), Y = Pos.Bottom (hexView) + 1 };
Win.Add (label);
var listView = new ListView (new List<string> () { "item #1", " ~  s  gui.cs   master ↑10", "Со_хранить" }) {
X = 15,
Y = Pos.Y (label),
Width = Dim.Percent (60),
Height = 3,
ColorScheme = Colors.Menu
};
Win.Add (listView);

label = new Label ("RadioGroup:") { X = Pos.X (label), Y = Pos.Bottom (listView) + 1 };
Win.Add (label);
var radioGroup = new RadioGroup (new [] { "item #1", " ~  s  gui.cs   master ↑10", "Со_хранить" }, selected: 0) {
X = 15,
Y = Pos.Y (label),
Width = Dim.Percent (60),
ColorScheme = Colors.Menu
};
Win.Add (radioGroup);

label = new Label ("TextField:") { X = Pos.X (label), Y = Pos.Bottom (radioGroup) + 1 };
Win.Add (label);
var textField = new TextField (" ~  s  gui.cs   master ↑10 = Со_хранить") { X = 15, Y = Pos.Y (label), Width = Dim.Percent (60) };
Win.Add (textField);

label = new Label ("TextView:") { X = Pos.X (label), Y = Pos.Bottom (textField) + 1 };
Win.Add (label);
var textView = new TextView () {
X = 15,
Y = Pos.Y (label),
Width = Dim.Percent (60),
Height = 3,
ColorScheme = Colors.Menu,
Text = " ~  s  gui.cs   master ↑10\nСо_хранить",
};
Win.Add (textView);

//label = new Label ("Charset:") {
// X = Pos.Percent(75) + 1,
// Y = 0,
//};
//Win.Add (label);
//var charset = new Label ("") {
// X = Pos.Percent(75) + 1,
// Y = Pos.Y (label) + 1,
// Width = Dim.Fill (1),
// Height = Dim.Fill (),
// ColorScheme = Colors.Dialog
//};
//Win.Add (charset);

// Move Win down to row 1, below menu
Win.Y = 1;
Top.LayoutSubviews ();
}
}
}
35 changes: 0 additions & 35 deletions UICatalog/Scenarios/UnicodeInMenu.cs

This file was deleted.

0 comments on commit 22d423d

Please sign in to comment.