ViewExperiments.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. using Terminal.Gui;
  2. namespace UICatalog.Scenarios;
  3. [ScenarioMetadata ("View Experiments", "v2 View Experiments")]
  4. [ScenarioCategory ("Controls")]
  5. [ScenarioCategory ("Borders")]
  6. [ScenarioCategory ("Layout")]
  7. [ScenarioCategory ("Proof of Concept")]
  8. public class ViewExperiments : Scenario
  9. {
  10. public override void Main ()
  11. {
  12. Application.Init ();
  13. Window app = new ()
  14. {
  15. Title = GetQuitKeyAndName (),
  16. TabStop = TabBehavior.TabGroup
  17. };
  18. var view = new View
  19. {
  20. X = 2,
  21. Y = 2,
  22. Height = Dim.Auto (),
  23. Width = Dim.Auto (),
  24. Title = "View1",
  25. ColorScheme = Colors.ColorSchemes ["Base"],
  26. Id = "View1",
  27. ShadowStyle = ShadowStyle.Transparent,
  28. BorderStyle = LineStyle.Double,
  29. CanFocus = true, // Can't drag without this? BUGBUG
  30. TabStop = TabBehavior.TabGroup,
  31. Arrangement = ViewArrangement.Movable | ViewArrangement.Overlapped
  32. };
  33. Button button = new ()
  34. {
  35. Title = "Button_1",
  36. };
  37. view.Add (button);
  38. button = new ()
  39. {
  40. Y = Pos.Bottom (button),
  41. Title = "Button_2",
  42. };
  43. view.Add (button);
  44. //app.Add (view);
  45. view.BorderStyle = LineStyle.Double;
  46. var view2 = new View
  47. {
  48. X = Pos.Right (view),
  49. Y = Pos.Bottom (view),
  50. Height = Dim.Auto (),
  51. Width = Dim.Auto (),
  52. Title = "View2",
  53. ColorScheme = Colors.ColorSchemes ["Base"],
  54. Id = "View2",
  55. ShadowStyle = ShadowStyle.Transparent,
  56. BorderStyle = LineStyle.Double,
  57. CanFocus = true, // Can't drag without this? BUGBUG
  58. TabStop = TabBehavior.TabGroup,
  59. Arrangement = ViewArrangement.Movable | ViewArrangement.Overlapped
  60. };
  61. button = new ()
  62. {
  63. Title = "Button_3",
  64. };
  65. view2.Add (button);
  66. button = new ()
  67. {
  68. Y = Pos.Bottom (button),
  69. Title = "Button_4",
  70. };
  71. view2.Add (button);
  72. var editor = new AdornmentsEditor
  73. {
  74. X = 0,
  75. Y = 0,
  76. AutoSelectViewToEdit = true
  77. };
  78. app.Add (editor);
  79. button = new ()
  80. {
  81. Y = 0,
  82. X = Pos.X (view),
  83. Title = "Button_0",
  84. };
  85. app.Add (button);
  86. button = new ()
  87. {
  88. X = Pos.AnchorEnd (),
  89. Y = Pos.AnchorEnd (),
  90. Title = "Button_5",
  91. };
  92. view.X = 34;
  93. view.Y = 4;
  94. app.Add (view);
  95. app.Add (view2);
  96. app.Add (button);
  97. Application.Run (app);
  98. app.Dispose ();
  99. Application.Shutdown ();
  100. }
  101. }