View.Arrangement.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #nullable enable
  2. namespace Terminal.Gui.ViewBase;
  3. public partial class View
  4. {
  5. /// <summary>
  6. /// Gets or sets the user actions that are enabled for the arranging this view within it's <see cref="SuperView"/>.
  7. /// </summary>
  8. /// <remarks>
  9. /// <para>
  10. /// See the View Arrangement Deep Dive for more information: <see href="https://gui-cs.github.io/Terminal.Gui/docs/arrangement.html"/>
  11. /// </para>
  12. /// </remarks>
  13. /// <example>
  14. /// <para>
  15. /// This example demonstrates how to create a resizable splitter between two views using <see cref="ViewArrangement.LeftResizable"/>:
  16. /// </para>
  17. /// <code>
  18. /// // Create left pane that fills remaining space
  19. /// View leftPane = new ()
  20. /// {
  21. /// X = 0,
  22. /// Y = 0,
  23. /// Width = Dim.Fill (Dim.Func (_ => rightPane.Frame.Width)),
  24. /// Height = Dim.Fill (),
  25. /// CanFocus = true
  26. /// };
  27. ///
  28. /// // Create right pane with resizable left border (acts as splitter)
  29. /// View rightPane = new ()
  30. /// {
  31. /// X = Pos.Right (leftPane) - 1,
  32. /// Y = 0,
  33. /// Width = Dim.Fill (),
  34. /// Height = Dim.Fill (),
  35. /// Arrangement = ViewArrangement.LeftResizable,
  36. /// BorderStyle = LineStyle.Single,
  37. /// SuperViewRendersLineCanvas = true,
  38. /// CanFocus = true
  39. /// };
  40. /// rightPane.Border!.Thickness = new (1, 0, 0, 0); // Only left border
  41. ///
  42. /// container.Add (leftPane, rightPane);
  43. /// </code>
  44. /// <para>
  45. /// The right pane's left border acts as a draggable splitter. The left pane's width automatically adjusts
  46. /// to fill the remaining space using <c>Dim.Fill</c> with a function that subtracts the right pane's width.
  47. /// </para>
  48. /// </example>
  49. public ViewArrangement Arrangement { get; set; }
  50. }