Clipping.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using System;
  2. using Terminal.Gui;
  3. namespace UICatalog {
  4. [ScenarioMetadata (Name: "Clipping", Description: "Used to test that things clip correctly")]
  5. [ScenarioCategory ("Bug Repro")]
  6. class Clipping : Scenario {
  7. public override void Init (Toplevel top)
  8. {
  9. Application.Init ();
  10. Top = top;
  11. if (Top == null) {
  12. Top = Application.Top;
  13. }
  14. Top.ColorScheme = Colors.Base;
  15. //Win = new TopLevel($"CTRL-Q to Close - Scenario: {GetName ()}") {
  16. // X = 0,
  17. // Y = 0,
  18. // Width = Dim.Fill (),
  19. // Height = Dim.Fill ()
  20. //};
  21. //Top.Add (Win);
  22. }
  23. public override void Setup ()
  24. {
  25. //Win.X = 1;
  26. //Win.Y = 2;
  27. //Win.Width = Dim.Fill () - 4;
  28. //Win.Height = Dim.Fill () - 2;
  29. var label = new Label ("ScrollView (new Rect (5, 5, 100, 60)) with a 200, 100 ContentSize...") {
  30. X = 0, Y = 0,
  31. ColorScheme = Colors.Dialog
  32. };
  33. Top.Add (label);
  34. var scrollView = new ScrollView (new Rect (3, 3, 50, 20));
  35. scrollView.ColorScheme = Colors.Menu;
  36. scrollView.ContentSize = new Size (100, 60);
  37. //ContentOffset = new Point (0, 0),
  38. scrollView.ShowVerticalScrollIndicator = true;
  39. scrollView.ShowHorizontalScrollIndicator = true;
  40. var embedded1 = new Window ("1") {
  41. X = 3,
  42. Y = 3,
  43. Width = Dim.Fill (3),
  44. Height = Dim.Fill (3),
  45. ColorScheme = Colors.Dialog
  46. };
  47. var embedded2 = new Window ("2") {
  48. X = 3,
  49. Y = 3,
  50. Width = Dim.Fill (3),
  51. Height = Dim.Fill (3),
  52. ColorScheme = Colors.Error
  53. };
  54. embedded1.Add (embedded2);
  55. var embedded3 = new Window ("3") {
  56. X = 3,
  57. Y = 3,
  58. Width = Dim.Fill (3),
  59. Height = Dim.Fill (3),
  60. ColorScheme = Colors.TopLevel
  61. };
  62. embedded2.Add (embedded3);
  63. scrollView.Add (embedded1);
  64. Top.Add (scrollView);
  65. }
  66. }
  67. }