2
0

ViewportSettings.cs 4.6 KB

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