Clipping.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 (ColorScheme colorScheme)
  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. };
  36. var embedded2 = new Window ("2") {
  37. X = 3,
  38. Y = 3,
  39. Width = Dim.Fill (3),
  40. Height = Dim.Fill (3),
  41. ColorScheme = Colors.Error
  42. };
  43. embedded1.Add (embedded2);
  44. var embedded3 = new Window ("3") {
  45. X = 3,
  46. Y = 3,
  47. Width = Dim.Fill (3),
  48. Height = Dim.Fill (3),
  49. ColorScheme = Colors.TopLevel
  50. };
  51. var testButton = new Button (2, 2, "click me");
  52. testButton.Clicked += () => {
  53. MessageBox.Query (10, 5, "Test", "test message", "Ok");
  54. };
  55. embedded3.Add (testButton);
  56. embedded2.Add (embedded3);
  57. scrollView.Add (embedded1);
  58. Application.Top.Add (scrollView);
  59. }
  60. }
  61. }