Clipping.cs 1.7 KB

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