ViewportSettings.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. namespace Terminal.Gui;
  2. /// <summary>
  3. /// Settings for how the <see cref="View.Viewport"/> behaves relative to the View's Content area.
  4. /// </summary>
  5. /// <remarks>
  6. /// See the Layout Deep Dive for more information: <see href="https://gui-cs.github.io/Terminal.GuiV2Docs/docs/layout.html"/>
  7. /// </remarks>
  8. [Flags]
  9. public enum ViewportSettings
  10. {
  11. /// <summary>
  12. /// No settings.
  13. /// </summary>
  14. None = 0,
  15. /// <summary>
  16. /// If set, <see cref="View.Viewport"/><c>.X</c> can be set to negative values enabling scrolling beyond the left of
  17. /// the
  18. /// content area.
  19. /// <para>
  20. /// When not set, <see cref="View.Viewport"/><c>.X</c> is constrained to positive values.
  21. /// </para>
  22. /// </summary>
  23. AllowNegativeX = 1,
  24. /// <summary>
  25. /// If set, <see cref="View.Viewport"/><c>.Y</c> can be set to negative values enabling scrolling beyond the top of the
  26. /// content area.
  27. /// <para>
  28. /// When not set, <see cref="View.Viewport"/><c>.Y</c> is constrained to positive values.
  29. /// </para>
  30. /// </summary>
  31. AllowNegativeY = 2,
  32. /// <summary>
  33. /// If set, <see cref="View.Viewport"/><c>.Size</c> can be set to negative coordinates enabling scrolling beyond the
  34. /// top-left of the
  35. /// content area.
  36. /// <para>
  37. /// When not set, <see cref="View.Viewport"/><c>.Size</c> is constrained to positive coordinates.
  38. /// </para>
  39. /// </summary>
  40. AllowNegativeLocation = AllowNegativeX | AllowNegativeY,
  41. /// <summary>
  42. /// If set, <see cref="View.Viewport"/><c>.X</c> can be set values greater than <see cref="View.GetContentSize ()"/>
  43. /// <c>.Width</c> enabling scrolling beyond the right
  44. /// of the content area.
  45. /// <para>
  46. /// When not set, <see cref="View.Viewport"/><c>.X</c> is constrained to <see cref="View.GetContentSize ()"/>
  47. /// <c>.Width - 1</c>.
  48. /// This means the last column of the content will remain visible even if there is an attempt to scroll the
  49. /// Viewport past the last column.
  50. /// </para>
  51. /// <para>
  52. /// The practical effect of this is that the last column of the content will always be visible.
  53. /// </para>
  54. /// </summary>
  55. AllowXGreaterThanContentWidth = 4,
  56. /// <summary>
  57. /// If set, <see cref="View.Viewport"/><c>.Y</c> can be set values greater than <see cref="View.GetContentSize ()"/>
  58. /// <c>.Height</c> enabling scrolling beyond the right
  59. /// of the content area.
  60. /// <para>
  61. /// When not set, <see cref="View.Viewport"/><c>.Y</c> is constrained to <see cref="View.GetContentSize ()"/>
  62. /// <c>.Height - 1</c>.
  63. /// This means the last row of the content will remain visible even if there is an attempt to scroll the Viewport
  64. /// past the last row.
  65. /// </para>
  66. /// <para>
  67. /// The practical effect of this is that the last row of the content will always be visible.
  68. /// </para>
  69. /// </summary>
  70. AllowYGreaterThanContentHeight = 8,
  71. /// <summary>
  72. /// If set, <see cref="View.Viewport"/><c>.Size</c> can be set values greater than <see cref="View.GetContentSize ()"/>
  73. /// enabling scrolling beyond the bottom-right
  74. /// of the content area.
  75. /// <para>
  76. /// When not set, <see cref="View.Viewport"/> is constrained to <see cref="View.GetContentSize ()"/><c> -1</c>.
  77. /// This means the last column and row of the content will remain visible even if there is an attempt to
  78. /// scroll the Viewport past the last column or row.
  79. /// </para>
  80. /// </summary>
  81. AllowLocationGreaterThanContentSize = AllowXGreaterThanContentWidth | AllowYGreaterThanContentHeight,
  82. /// <summary>
  83. /// By default, clipping is applied to the <see cref="View.Viewport"/>. Setting this flag will cause clipping to be
  84. /// applied to the visible content area.
  85. /// </summary>
  86. ClipContentOnly = 16,
  87. /// <summary>
  88. /// If set <see cref="View.ClearViewport"/> will clear only the portion of the content
  89. /// area that is visible within the <see cref="View.Viewport"/>. This is useful for views that have a
  90. /// content area larger than the Viewport and want the area outside the content to be visually distinct.
  91. /// <para>
  92. /// <see cref="ClipContentOnly"/> must be set for this setting to work (clipping beyond the visible area must be
  93. /// disabled).
  94. /// </para>
  95. /// </summary>
  96. ClearContentOnly = 32
  97. }