|
@@ -12,19 +12,19 @@ public class VirtualScrolling : Scenario
|
|
{
|
|
{
|
|
private ViewDiagnosticFlags _diagnosticFlags;
|
|
private ViewDiagnosticFlags _diagnosticFlags;
|
|
|
|
|
|
- public class VirtualDemoView : View
|
|
|
|
|
|
+ public class VirtualDemoView : Window
|
|
{
|
|
{
|
|
public VirtualDemoView ()
|
|
public VirtualDemoView ()
|
|
{
|
|
{
|
|
- Text = "Virtual Demo View Text. This is long text.\nThe second line.\n3\n4\n5th line.";
|
|
|
|
|
|
+ Text = "Virtual Demo View Text. This is long text.\nThe second line.\n3\n4\n5th line\nLine 6. This is a longer line. fklasjf laspi fiolasjf liasdj flpasfjklas.";
|
|
CanFocus = true;
|
|
CanFocus = true;
|
|
Arrangement = ViewArrangement.Movable;
|
|
Arrangement = ViewArrangement.Movable;
|
|
- ColorScheme = Colors.ColorSchemes ["Toplevel"];
|
|
|
|
- BorderStyle = LineStyle.Rounded;
|
|
|
|
|
|
+ ColorScheme = Colors.ColorSchemes ["Error"];
|
|
|
|
+ BorderStyle = LineStyle.None;
|
|
|
|
|
|
// TODO: Add a way to set the scroll settings in the Scenario
|
|
// TODO: Add a way to set the scroll settings in the Scenario
|
|
ContentSize = new Size (100, 60);
|
|
ContentSize = new Size (100, 60);
|
|
- //ScrollSettings = ScrollSettings.NoRestrict;
|
|
|
|
|
|
+ ScrollSettings = ScrollSettings.NoRestrict;
|
|
|
|
|
|
// Things this view knows how to do
|
|
// Things this view knows how to do
|
|
AddCommand (Command.ScrollDown, () => ScrollVertical (1));
|
|
AddCommand (Command.ScrollDown, () => ScrollVertical (1));
|
|
@@ -102,59 +102,66 @@ public class VirtualScrolling : Scenario
|
|
|
|
|
|
var view = new VirtualDemoView { Title = "Virtual Scrolling" };
|
|
var view = new VirtualDemoView { Title = "Virtual Scrolling" };
|
|
|
|
|
|
- var tf1 = new TextField { X = 20, Y = 7, Width = 10, Text = "TextField" };
|
|
|
|
- var color = new ColorPicker { Title = "BG", BoxHeight = 1, BoxWidth = 1, X = Pos.AnchorEnd (11) };
|
|
|
|
- color.BorderStyle = LineStyle.RoundedDotted;
|
|
|
|
-
|
|
|
|
- color.ColorChanged += (s, e) =>
|
|
|
|
- {
|
|
|
|
- color.SuperView.ColorScheme = new (color.SuperView.ColorScheme)
|
|
|
|
- {
|
|
|
|
- Normal = new (
|
|
|
|
- color.SuperView.ColorScheme.Normal.Foreground,
|
|
|
|
- e.Color
|
|
|
|
- )
|
|
|
|
- };
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- var button = new Button { X = Pos.Center (), Y = Pos.Center (), Text = "Centered Button" };
|
|
|
|
-
|
|
|
|
- button.Accept += (s, e) =>
|
|
|
|
- MessageBox.Query (20, 7, "Hi", $"Am I a {view.GetType ().Name}?", "Yes", "No");
|
|
|
|
-
|
|
|
|
- var label = new TextView
|
|
|
|
- {
|
|
|
|
- X = Pos.Center (),
|
|
|
|
- Y = 10,
|
|
|
|
- Title = "Title",
|
|
|
|
- Text = "I have a 3 row top border.\nMy border inherits from the SuperView.",
|
|
|
|
- AllowsTab = false,
|
|
|
|
- Width = 42,
|
|
|
|
- Height = 6 // TODO: Use Dim.Auto
|
|
|
|
- };
|
|
|
|
- label.Border.Thickness = new (1, 3, 1, 1);
|
|
|
|
-
|
|
|
|
- var btnButtonInWindow = new Button { X = Pos.AnchorEnd (10), Y = Pos.AnchorEnd (1), Text = "Button" };
|
|
|
|
-
|
|
|
|
- var tv = new Label
|
|
|
|
- {
|
|
|
|
- AutoSize = false,
|
|
|
|
- Y = Pos.AnchorEnd (3),
|
|
|
|
- Width = 25,
|
|
|
|
- Height = Dim.Fill (),
|
|
|
|
- Text = "Label\nY=AnchorEnd(3),Height=Dim.Fill()"
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- view.Margin.Data = "Margin";
|
|
|
|
- view.Margin.Thickness = new (0);
|
|
|
|
-
|
|
|
|
- view.Border.Data = "Border";
|
|
|
|
- view.Border.Thickness = new (3);
|
|
|
|
-
|
|
|
|
- view.Padding.Data = "Padding";
|
|
|
|
- view.Padding.Thickness = new (3);
|
|
|
|
-
|
|
|
|
- view.Add (tf1, color, button, label, btnButtonInWindow, tv);
|
|
|
|
|
|
+ // var tf1 = new TextField { X = 20, Y = 7, Width = 10, Text = "TextField" };
|
|
|
|
+ //var color = new ColorPicker { Title = "BG", BoxHeight = 1, BoxWidth = 1, X = Pos.AnchorEnd (11) };
|
|
|
|
+ //color.BorderStyle = LineStyle.RoundedDotted;
|
|
|
|
+
|
|
|
|
+ //color.ColorChanged += (s, e) =>
|
|
|
|
+ // {
|
|
|
|
+ // color.SuperView.ColorScheme = new (color.SuperView.ColorScheme)
|
|
|
|
+ // {
|
|
|
|
+ // Normal = new (
|
|
|
|
+ // color.SuperView.ColorScheme.Normal.Foreground,
|
|
|
|
+ // e.Color
|
|
|
|
+ // )
|
|
|
|
+ // };
|
|
|
|
+ // };
|
|
|
|
+
|
|
|
|
+ //var button = new Button { X = Pos.Center (), Y = Pos.Center (), Text = "Centered Button" };
|
|
|
|
+
|
|
|
|
+ //button.Accept += (s, e) =>
|
|
|
|
+ // MessageBox.Query (20, 7, "Hi", $"Am I a {view.GetType ().Name}?", "Yes", "No");
|
|
|
|
+
|
|
|
|
+ //var label = new TextView
|
|
|
|
+ //{
|
|
|
|
+ // X = Pos.Center (),
|
|
|
|
+ // Y = 10,
|
|
|
|
+ // Title = "Title",
|
|
|
|
+ // Text = "I have a 3 row top border.\nMy border inherits from the SuperView.",
|
|
|
|
+ // AllowsTab = false,
|
|
|
|
+ // Width = 42,
|
|
|
|
+ // Height = 6 // TODO: Use Dim.Auto
|
|
|
|
+ //};
|
|
|
|
+ //label.Border.Thickness = new (1, 3, 1, 1);
|
|
|
|
+
|
|
|
|
+ //var btnButtonInWindow = new Button { X = Pos.AnchorEnd (10), Y = Pos.AnchorEnd (1), Text = "Button" };
|
|
|
|
+
|
|
|
|
+ //var tv = new Label
|
|
|
|
+ //{
|
|
|
|
+ // AutoSize = false,
|
|
|
|
+ // Y = Pos.AnchorEnd (3),
|
|
|
|
+ // Width = 25,
|
|
|
|
+ // Height = Dim.Fill (),
|
|
|
|
+ // Text = "Label\nY=AnchorEnd(3),Height=Dim.Fill()"
|
|
|
|
+ //};
|
|
|
|
+
|
|
|
|
+ //view.Margin.Data = "Margin";
|
|
|
|
+ //view.Margin.Thickness = new (0);
|
|
|
|
+
|
|
|
|
+ //view.Border.Data = "Border";
|
|
|
|
+ //view.Border.Thickness = new (3);
|
|
|
|
+
|
|
|
|
+ //view.Padding.Data = "Padding";
|
|
|
|
+ //view.Padding.Thickness = new (3);
|
|
|
|
+
|
|
|
|
+ //view.Add (tf1, color, button, label, btnButtonInWindow, tv);
|
|
|
|
+ //var label = new Label
|
|
|
|
+ //{
|
|
|
|
+ // X = 0,
|
|
|
|
+ // Y = 10,
|
|
|
|
+ // Text = "This is a virtual scrolling demo. Use the arrow keys to scroll the content."
|
|
|
|
+ //};
|
|
|
|
+ //view.Add (label);
|
|
|
|
|
|
var editor = new Adornments.AdornmentsEditor
|
|
var editor = new Adornments.AdornmentsEditor
|
|
{
|
|
{
|
|
@@ -172,7 +179,7 @@ public class VirtualScrolling : Scenario
|
|
|
|
|
|
view.Width = Dim.Fill ();
|
|
view.Width = Dim.Fill ();
|
|
view.Height = Dim.Fill ();
|
|
view.Height = Dim.Fill ();
|
|
- Application.Run (editor);
|
|
|
|
|
|
+ Application.Run (view);
|
|
editor.Dispose ();
|
|
editor.Dispose ();
|
|
Application.Shutdown ();
|
|
Application.Shutdown ();
|
|
}
|
|
}
|