ViewExperiments.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using System;
  2. using Terminal.Gui;
  3. namespace UICatalog.Scenarios;
  4. [ScenarioMetadata ("View Experiments", "v2 View Experiments")]
  5. [ScenarioCategory ("Controls")]
  6. [ScenarioCategory ("Borders")]
  7. [ScenarioCategory ("Layout")]
  8. [ScenarioCategory ("Proof of Concept")]
  9. public class ViewExperiments : Scenario
  10. {
  11. public override void Main ()
  12. {
  13. Application.Init ();
  14. Window app = new ()
  15. {
  16. Title = GetQuitKeyAndName (),
  17. TabStop = TabBehavior.TabGroup
  18. };
  19. var editor = new AdornmentsEditor
  20. {
  21. X = 0,
  22. Y = 0,
  23. TabStop = TabBehavior.NoStop
  24. };
  25. app.Add (editor);
  26. FrameView testFrame = new ()
  27. {
  28. Title = "_1 Test Frame",
  29. X = Pos.Right (editor),
  30. Width = Dim.Fill (),
  31. Height = Dim.Fill (),
  32. };
  33. app.Add (testFrame);
  34. Button button = new ()
  35. {
  36. X = 0,
  37. Y = 0,
  38. Title = $"TopButton _{GetNextHotKey ()}",
  39. };
  40. testFrame.Add (button);
  41. button = new ()
  42. {
  43. X = Pos.AnchorEnd (),
  44. Y = Pos.AnchorEnd (),
  45. Title = $"TopButton _{GetNextHotKey ()}",
  46. };
  47. testFrame.Add (button);
  48. editor.AutoSelectViewToEdit = true;
  49. editor.AutoSelectSuperView = testFrame;
  50. editor.AutoSelectAdornments = true;
  51. Application.Run (app);
  52. app.Dispose ();
  53. Application.Shutdown ();
  54. return;
  55. }
  56. private int _hotkeyCount;
  57. private char GetNextHotKey ()
  58. {
  59. return (char)((int)'A' + _hotkeyCount++);
  60. }
  61. }