Clipping.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 () {
  30. Title = "1",
  31. X = 3,
  32. Y = 3,
  33. Width = Dim.Fill (3),
  34. Height = Dim.Fill (3),
  35. ColorScheme = Colors.Dialog,
  36. Id = "1"
  37. };
  38. var embedded2 = new Window () {
  39. Title = "1",
  40. X = 3,
  41. Y = 3,
  42. Width = Dim.Fill (3),
  43. Height = Dim.Fill (3),
  44. ColorScheme = Colors.Error,
  45. Id = "2"
  46. };
  47. embedded1.Add (embedded2);
  48. var embedded3 = new Window () {
  49. Title = "3",
  50. X = 3,
  51. Y = 3,
  52. Width = Dim.Fill (3),
  53. Height = Dim.Fill (3),
  54. ColorScheme = Colors.TopLevel,
  55. Id = "3"
  56. };
  57. var testButton = new Button (2, 2, "click me");
  58. testButton.Clicked += (s,e) => {
  59. MessageBox.Query (10, 5, "Test", "test message", "Ok");
  60. };
  61. embedded3.Add (testButton);
  62. embedded2.Add (embedded3);
  63. scrollView.Add (embedded1);
  64. Application.Top.Add (scrollView);
  65. }
  66. }
  67. }