ViewportSettings.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. [Flags]
  6. public enum ViewportSettings
  7. {
  8. /// <summary>
  9. /// No settings.
  10. /// </summary>
  11. None = 0,
  12. /// <summary>
  13. /// If set, <see cref="View.Viewport"/><c>.X</c> can be set to negative values enabling scrolling beyond the left of
  14. /// the
  15. /// content area.
  16. /// <para>
  17. /// When not set, <see cref="View.Viewport"/><c>.X</c> is constrained to positive values.
  18. /// </para>
  19. /// </summary>
  20. AllowNegativeX = 1,
  21. /// <summary>
  22. /// If set, <see cref="View.Viewport"/><c>.Y</c> can be set to negative values enabling scrolling beyond the top of the
  23. /// content area.
  24. /// <para>
  25. /// When not set, <see cref="View.Viewport"/><c>.Y</c> is constrained to positive values.
  26. /// </para>
  27. /// </summary>
  28. AllowNegativeY = 2,
  29. /// <summary>
  30. /// If set, <see cref="View.Viewport"/><c>.Size</c> can be set to negative coordinates enabling scrolling beyond the
  31. /// top-left of the
  32. /// content area.
  33. /// <para>
  34. /// When not set, <see cref="View.Viewport"/><c>.Size</c> is constrained to positive coordinates.
  35. /// </para>
  36. /// </summary>
  37. AllowNegativeLocation = AllowNegativeX | AllowNegativeY,
  38. /// <summary>
  39. /// If set, <see cref="View.Viewport"/><c>.X</c> can be set values greater than <see cref="View.GetContentSize ()"/>
  40. /// <c>.Width</c> enabling scrolling beyond the right
  41. /// of the content area.
  42. /// <para>
  43. /// When not set, <see cref="View.Viewport"/><c>.X</c> is constrained to <see cref="View.GetContentSize ()"/>
  44. /// <c>.Width - 1</c>.
  45. /// This means the last column of the content will remain visible even if there is an attempt to scroll the
  46. /// Viewport past the last column.
  47. /// </para>
  48. /// <para>
  49. /// The practical effect of this is that the last column of the content will always be visible.
  50. /// </para>
  51. /// </summary>
  52. AllowXGreaterThanContentWidth = 4,
  53. /// <summary>
  54. /// If set, <see cref="View.Viewport"/><c>.Y</c> can be set values greater than <see cref="View.GetContentSize ()"/>
  55. /// <c>.Height</c> enabling scrolling beyond the right
  56. /// of the content area.
  57. /// <para>
  58. /// When not set, <see cref="View.Viewport"/><c>.Y</c> is constrained to <see cref="View.GetContentSize ()"/>
  59. /// <c>.Height - 1</c>.
  60. /// This means the last row of the content will remain visible even if there is an attempt to scroll the Viewport
  61. /// past the last row.
  62. /// </para>
  63. /// <para>
  64. /// The practical effect of this is that the last row of the content will always be visible.
  65. /// </para>
  66. /// </summary>
  67. AllowYGreaterThanContentHeight = 8,
  68. /// <summary>
  69. /// If set, <see cref="View.Viewport"/><c>.Size</c> can be set values greater than <see cref="View.GetContentSize ()"/>
  70. /// enabling scrolling beyond the bottom-right
  71. /// of the content area.
  72. /// <para>
  73. /// When not set, <see cref="View.Viewport"/> is constrained to <see cref="View.GetContentSize ()"/><c> -1</c>.
  74. /// This means the last column and row of the content will remain visible even if there is an attempt to
  75. /// scroll the Viewport past the last column or row.
  76. /// </para>
  77. /// </summary>
  78. AllowLocationGreaterThanContentSize = AllowXGreaterThanContentWidth | AllowYGreaterThanContentHeight,
  79. /// <summary>
  80. /// By default, clipping is applied to the <see cref="View.Viewport"/>. Setting this flag will cause clipping to be
  81. /// applied to the visible content area.
  82. /// </summary>
  83. ClipContentOnly = 16,
  84. /// <summary>
  85. /// If set <see cref="View.Clear()"/> will clear only the portion of the content
  86. /// area that is visible within the <see cref="View.Viewport"/>. This is useful for views that have a
  87. /// content area larger than the Viewport and want the area outside the content to be visually distinct.
  88. /// <see cref="ClipContentOnly"/> must be set for this setting to work (clipping beyond the visible area must be
  89. /// disabled).
  90. /// </summary>
  91. ClearContentOnly = 32,
  92. /// <summary>
  93. /// If set, the vertical scroll bar (see <see cref="View.HorizontalScrollBar"/>) will be enabled and automatically made visible
  94. /// when the dimension of the <see cref="View.Viewport"/> is smaller than the dimension of <see cref="View.GetContentSize()"/>.
  95. /// </summary>
  96. EnableHorizontalScrollBar = 64,
  97. /// <summary>
  98. /// If set, the vertical scroll bar (see <see cref="View.VerticalScrollBar"/>) will be enabled and automatically made visible
  99. /// when the dimension of the <see cref="View.Viewport"/> is smaller than the dimension of <see cref="View.GetContentSize()"/>.
  100. /// </summary>
  101. EnableVerticalScrollBar = 128,
  102. /// <summary>
  103. /// If set, the horizontal and vertical scroll bars (see cref="View.HorizontalScrollBar"/> and <see cref="View.VerticalScrollBar"/>)
  104. /// will be enabled and automatically made visible when the dimension of the <see cref="View.Viewport"/> is smaller than the
  105. /// dimension of <see cref="View.GetContentSize()"/>.
  106. /// </summary>
  107. EnableScrollBars = EnableHorizontalScrollBar | EnableVerticalScrollBar
  108. }