Переглянути джерело

ContentSize -> GetContentSize()/SetContentSize()

Tig 1 рік тому
батько
коміт
41d86f7e15
46 змінених файлів з 253 додано та 245 видалено
  1. 1 1
      Terminal.Gui/View/Layout/Dim.cs
  2. 1 1
      Terminal.Gui/View/Layout/DimAuto.cs
  3. 4 4
      Terminal.Gui/View/Layout/DimAutoStyle.cs
  4. 2 2
      Terminal.Gui/View/Layout/DimPercent.cs
  5. 1 1
      Terminal.Gui/View/Layout/DimPercentMode.cs
  6. 2 2
      Terminal.Gui/View/Layout/Pos.cs
  7. 12 12
      Terminal.Gui/View/Layout/ViewLayout.cs
  8. 82 53
      Terminal.Gui/View/ViewContent.cs
  9. 6 6
      Terminal.Gui/View/ViewDrawing.cs
  10. 9 9
      Terminal.Gui/View/ViewText.cs
  11. 6 6
      Terminal.Gui/View/ViewportSettings.cs
  12. 3 3
      Terminal.Gui/Views/ColorPicker.cs
  13. 2 2
      Terminal.Gui/Views/ComboBox.cs
  14. 1 1
      Terminal.Gui/Views/DatePicker.cs
  15. 1 1
      Terminal.Gui/Views/ListView.cs
  16. 1 1
      Terminal.Gui/Views/Menu/MenuBar.cs
  17. 1 1
      Terminal.Gui/Views/MessageBox.cs
  18. 2 2
      Terminal.Gui/Views/RadioGroup.cs
  19. 19 26
      Terminal.Gui/Views/ScrollView.cs
  20. 1 1
      Terminal.Gui/Views/Slider.cs
  21. 1 1
      Terminal.Gui/Views/StatusBar.cs
  22. 1 1
      Terminal.Gui/Views/TabView.cs
  23. 2 2
      UICatalog/Scenarios/ASCIICustomButton.cs
  24. 1 1
      UICatalog/Scenarios/CharacterMap.cs
  25. 1 1
      UICatalog/Scenarios/Clipping.cs
  26. 8 14
      UICatalog/Scenarios/ContentScrolling.cs
  27. 1 1
      UICatalog/Scenarios/Scrolling.cs
  28. 1 1
      UnitTests/Application/MouseTests.cs
  29. 2 2
      UnitTests/View/DrawTests.cs
  30. 1 1
      UnitTests/View/FindDeepestViewTests.cs
  31. 13 13
      UnitTests/View/Layout/Dim.AutoTests.cs
  32. 1 1
      UnitTests/View/Layout/LayoutTests.cs
  33. 2 2
      UnitTests/View/Layout/ScreenToTests.cs
  34. 5 5
      UnitTests/View/Layout/ToScreenTests.cs
  35. 8 8
      UnitTests/View/Layout/ViewportTests.cs
  36. 9 9
      UnitTests/View/SubviewTests.cs
  37. 1 1
      UnitTests/View/TextTests.cs
  38. 1 1
      UnitTests/View/TitleTests.cs
  39. 2 2
      UnitTests/Views/ButtonTests.cs
  40. 15 15
      UnitTests/Views/ScrollViewTests.cs
  41. 4 4
      UnitTests/Views/SliderTests.cs
  42. 1 1
      UnitTests/Views/ToplevelTests.cs
  43. 2 2
      docfx/docs/dimauto.md
  44. 7 15
      docfx/docs/layout.md
  45. 5 5
      docfx/docs/migratingfromv1.md
  46. 1 1
      docfx/docs/newinv2.md

+ 1 - 1
Terminal.Gui/View/Layout/Dim.cs

@@ -187,7 +187,7 @@ public abstract class Dim
     ///     Gets a dimension that is anchored to a certain point in the layout.
     ///     This method is typically used internally by the layout system to determine the size of a View.
     /// </summary>
-    /// <param name="size">The width of the area where the View is being sized (Superview.ContentSize).</param>
+    /// <param name="size">The width of the area where the View is being sized (Superview.GetContentSize ()).</param>
     /// <returns>
     ///     An integer representing the calculated dimension. The way this dimension is calculated depends on the specific
     ///     subclass of Dim that is used. For example, DimAbsolute returns a fixed dimension, DimFactor returns a

+ 1 - 1
Terminal.Gui/View/Layout/DimAuto.cs

@@ -72,7 +72,7 @@ public class DimAuto () : Dim
             if (!us.ContentSizeTracksViewport)
             {
                 // ContentSize was explicitly set. Ignore subviews.
-                subviewsSize = dimension == Dimension.Width ? us.ContentSize.Width : us.ContentSize.Height;
+                subviewsSize = dimension == Dimension.Width ? us.GetContentSize ().Width : us.GetContentSize ().Height;
             }
             else
             {

+ 4 - 4
Terminal.Gui/View/Layout/DimAutoStyle.cs

@@ -10,9 +10,9 @@ namespace Terminal.Gui;
 public enum DimAutoStyle
 {
     /// <summary>
-    ///     The dimensions will be computed based on the View's <see cref="View.ContentSize"/> and/or <see cref="View.Subviews"/>.
+    ///     The dimensions will be computed based on the View's <see cref="View.GetContentSize ()"/> and/or <see cref="View.Subviews"/>.
     ///     <para>
-    ///         If <see cref="View.ContentSizeTracksViewport"/> is <see langword="true"/>, <see cref="View.ContentSize"/> will be used to determine the dimension.
+    ///         If <see cref="View.GetContentSize ()TracksViewport"/> is <see langword="true"/>, <see cref="View.GetContentSize ()"/> will be used to determine the dimension.
     ///     </para>
     ///     <para>
     ///         Otherwise, the Subview in <see cref="View.Subviews"/> with the largest corresponding position plus dimension
@@ -31,13 +31,13 @@ public enum DimAutoStyle
     ///         will be used to determine the dimension.
     ///     </para>
     ///     <para>
-    ///         The corresponding dimensions of <see cref="View.ContentSize"/> and/or <see cref="View.Subviews"/> will be ignored.
+    ///         The corresponding dimensions of <see cref="View.GetContentSize ()"/> and/or <see cref="View.Subviews"/> will be ignored.
     ///     </para>
     /// </summary>
     Text = 2,
 
     /// <summary>
-    ///     The dimension will be computed using the largest of the view's <see cref="View.Text"/>, <see cref="View.ContentSize"/>, and
+    ///     The dimension will be computed using the largest of the view's <see cref="View.Text"/>, <see cref="View.GetContentSize ()"/>, and
     ///     <see cref="View.Subviews"/> corresponding dimension
     /// </summary>
     Auto = Content | Text,

+ 2 - 2
Terminal.Gui/View/Layout/DimPercent.cs

@@ -11,7 +11,7 @@ namespace Terminal.Gui;
 /// <param name="percent">The percentage.</param>
 /// <param name="mode">
 ///     If <see cref="DimPercentMode.Position"/> the dimension is computed using the View's position (<see cref="View.X"/> or
-///     <see cref="View.Y"/>); otherwise, the dimension is computed using the View's <see cref="View.ContentSize"/>.
+///     <see cref="View.Y"/>); otherwise, the dimension is computed using the View's <see cref="View.GetContentSize ()"/>.
 /// </param>
 public class DimPercent (int percent, DimPercentMode mode = DimPercentMode.ContentSize) : Dim
 {
@@ -32,7 +32,7 @@ public class DimPercent (int percent, DimPercentMode mode = DimPercentMode.Conte
     public override string ToString () { return $"Percent({Percent},{Mode})"; }
 
     /// <summary>
-    ///     Gets whether the dimension is computed using the View's position or ContentSize.
+    ///     Gets whether the dimension is computed using the View's position or GetContentSize ().
     /// </summary>
     public DimPercentMode Mode { get; } = mode;
 

+ 1 - 1
Terminal.Gui/View/Layout/DimPercentMode.cs

@@ -15,7 +15,7 @@ public enum DimPercentMode
     Position = 0,
 
     /// <summary>
-    /// The dimension is computed using the View's <see cref="View.ContentSize"/>.
+    /// The dimension is computed using the View's <see cref="View.GetContentSize ()"/>.
     /// </summary>
     ContentSize = 1
 }

+ 2 - 2
Terminal.Gui/View/Layout/Pos.cs

@@ -296,12 +296,12 @@ public abstract class Pos
 
     /// <summary>
     ///     Gets the starting point of an element based on the size of the parent element (typically
-    ///     <c>Superview.ContentSize</c>).
+    ///     <c>Superview.GetContentSize ()</c>).
     ///     This method is meant to be overridden by subclasses to provide different ways of calculating the starting point.
     ///     This method is used
     ///     internally by the layout system to determine where a View should be positioned.
     /// </summary>
-    /// <param name="size">The size of the parent element (typically <c>Superview.ContentSize</c>).</param>
+    /// <param name="size">The size of the parent element (typically <c>Superview.GetContentSize ()</c>).</param>
     /// <returns>
     ///     An integer representing the calculated position. The way this position is calculated depends on the specific
     ///     subclass of Pos that is used. For example, PosAbsolute returns a fixed position, PosAnchorEnd returns a

+ 12 - 12
Terminal.Gui/View/Layout/ViewLayout.cs

@@ -13,10 +13,10 @@ public partial class View
     /// <summary>Gets or sets the absolute location and dimension of the view.</summary>
     /// <value>
     ///     The rectangle describing absolute location and dimension of the view, in coordinates relative to the
-    ///     <see cref="SuperView"/>'s Content, which is bound by <see cref="ContentSize"/>.
+    ///     <see cref="SuperView"/>'s Content, which is bound by <see cref="GetContentSize ()"/>.
     /// </value>
     /// <remarks>
-    ///     <para>Frame is relative to the <see cref="SuperView"/>'s Content, which is bound by <see cref="ContentSize"/>.</para>
+    ///     <para>Frame is relative to the <see cref="SuperView"/>'s Content, which is bound by <see cref="GetContentSize ()"/>.</para>
     ///     <para>
     ///         Setting Frame will set <see cref="X"/>, <see cref="Y"/>, <see cref="Width"/>, and <see cref="Height"/> to the
     ///         values of the corresponding properties of the <paramref name="value"/> parameter.
@@ -136,7 +136,7 @@ public partial class View
     /// <value>The <see cref="Pos"/> object representing the X position.</value>
     /// <remarks>
     ///     <para>
-    ///         The position is relative to the <see cref="SuperView"/>'s Content, which is bound by <see cref="ContentSize"/>.
+    ///         The position is relative to the <see cref="SuperView"/>'s Content, which is bound by <see cref="GetContentSize ()"/>.
     ///     </para>
     ///     <para>
     ///         If set to a relative value (e.g. <see cref="Pos.Center"/>) the value is indeterminate until the view has been
@@ -175,7 +175,7 @@ public partial class View
     /// <value>The <see cref="Pos"/> object representing the Y position.</value>
     /// <remarks>
     ///     <para>
-    ///         The position is relative to the <see cref="SuperView"/>'s Content, which is bound by <see cref="ContentSize"/>.
+    ///         The position is relative to the <see cref="SuperView"/>'s Content, which is bound by <see cref="GetContentSize ()"/>.
     ///     </para>
     ///     <para>
     ///         If set to a relative value (e.g. <see cref="Pos.Center"/>) the value is indeterminate until the view has been
@@ -213,7 +213,7 @@ public partial class View
     /// <value>The <see cref="Dim"/> object representing the height of the view (the number of rows).</value>
     /// <remarks>
     ///     <para>
-    ///         The dimension is relative to the <see cref="SuperView"/>'s Content, which is bound by <see cref="ContentSize"/>
+    ///         The dimension is relative to the <see cref="SuperView"/>'s Content, which is bound by <see cref="GetContentSize ()"/>
     ///         .
     ///     </para>
     ///     <para>
@@ -259,7 +259,7 @@ public partial class View
     /// <value>The <see cref="Dim"/> object representing the width of the view (the number of columns).</value>
     /// <remarks>
     ///     <para>
-    ///         The dimension is relative to the <see cref="SuperView"/>'s Content, which is bound by <see cref="ContentSize"/>
+    ///         The dimension is relative to the <see cref="SuperView"/>'s Content, which is bound by <see cref="GetContentSize ()"/>
     ///         .
     ///     </para>
     ///     <para>
@@ -649,7 +649,7 @@ public partial class View
 
         CheckDimAuto ();
 
-        var contentSize = ContentSize;
+        var contentSize = GetContentSize ();
         OnLayoutStarted (new (contentSize));
 
         LayoutAdornments ();
@@ -673,7 +673,7 @@ public partial class View
         {
             foreach ((View from, View to) in edges)
             {
-                LayoutSubview (to, from.ContentSize);
+                LayoutSubview (to, from.GetContentSize ());
             }
         }
 
@@ -726,8 +726,8 @@ public partial class View
         // Determine our container's ContentSize - 
         //  First try SuperView.Viewport, then Application.Top, then Driver.Viewport.
         //  Finally, if none of those are valid, use int.MaxValue (for Unit tests).
-        Size superViewContentSize = SuperView is { IsInitialized: true } ? SuperView.ContentSize :
-                           Application.Top is { } && Application.Top != this && Application.Top.IsInitialized ? Application.Top.ContentSize :
+        Size superViewContentSize = SuperView is { IsInitialized: true } ? SuperView.GetContentSize () :
+                           Application.Top is { } && Application.Top != this && Application.Top.IsInitialized ? Application.Top.GetContentSize () :
                            Application.Driver?.Screen.Size ?? new (int.MaxValue, int.MaxValue);
 
         SetTextFormatterSize ();
@@ -769,7 +769,7 @@ public partial class View
 
     /// <summary>
     ///     Adjusts <see cref="Frame"/> given the SuperView's ContentSize (nominally the same as
-    ///     <c>this.SuperView.ContentSize</c>)
+    ///     <c>this.SuperView.GetContentSize ()</c>)
     ///     and the position (<see cref="X"/>, <see cref="Y"/>) and dimension (<see cref="Width"/>, and
     ///     <see cref="Height"/>).
     /// </summary>
@@ -781,7 +781,7 @@ public partial class View
     ///     </para>
     /// </remarks>
     /// <param name="superviewContentSize">
-    ///     The size of the SuperView's content (nominally the same as <c>this.SuperView.ContentSize</c>).
+    ///     The size of the SuperView's content (nominally the same as <c>this.SuperView.GetContentSize ()</c>).
     /// </param>
     internal void SetRelativeLayout (Size superviewContentSize)
     {

+ 82 - 53
Terminal.Gui/View/ViewContent.cs

@@ -6,7 +6,34 @@ public partial class View
 
     internal Size? _contentSize;
 
-    private void SetContentSize (Size? contentSize)
+    /// <summary>
+    ///     Sets the size of the View's content.
+    /// </summary>
+    /// <remarks>
+    ///     <para>
+    ///         Negative sizes are not supported.
+    ///     </para>
+    ///     <para>
+    ///         If not explicitly set, and the View has no visible subviews, <see cref="GetContentSize ()"/> will return the
+    ///         size of
+    ///         <see cref="Viewport"/>.
+    ///     </para>
+    ///     <para>
+    ///         If not explicitly set, and the View has visible subviews, <see cref="GetContentSize ()"/> will return the
+    ///         maximum
+    ///         position + dimension of the Subviews, supporting <see cref="Dim.Auto"/> with the
+    ///         <see cref="DimAutoStyle.Content"/> flag set.
+    ///     </para>
+    ///     <para>
+    ///         If set <see cref="Viewport"/> describes the portion of the content currently visible to the user. This enables
+    ///         virtual scrolling.
+    ///     </para>
+    ///     <para>
+    ///         If set the behavior of <see cref="DimAutoStyle.Content"/> will be to use the ContentSize to determine the size
+    ///         of the view.
+    ///     </para>
+    /// </remarks>
+    public void SetContentSize (Size? contentSize)
     {
         if (contentSize is { } && (contentSize.Value.Width < 0 || contentSize.Value.Height < 0))
         {
@@ -23,8 +50,38 @@ public partial class View
     }
 
     /// <summary>
-    ///     Gets or sets a value indicating whether the <see cref="ContentSize"/> tracks the <see cref="Viewport"/>'s size or
-    ///     not.
+    ///     Gets the size of the View's content.
+    /// </summary>
+    /// <remarks>a>
+    ///     <para>
+    ///         If the content size was not explicitly set by <see cref="SetContentSize"/>, and the View has no visible subviews, <see cref="GetContentSize ()"/> will return the
+    ///         size of
+    ///         <see cref="Viewport"/>.
+    ///     </para>
+    ///     <para>
+    ///         If the content size was not explicitly set by <see cref="SetContentSize"/>, and the View has visible subviews, <see cref="GetContentSize ()"/> will return the
+    ///         maximum
+    ///         position + dimension of the Subviews, supporting <see cref="Dim.Auto"/> with the
+    ///         <see cref="DimAutoStyle.Content"/> flag set.
+    ///     </para>
+    ///     <para>
+    ///         If set <see cref="Viewport"/> describes the portion of the content currently visible to the user. This enables
+    ///         virtual scrolling.
+    ///     </para>
+    ///     <para>
+    ///         If set the behavior of <see cref="DimAutoStyle.Content"/> will be to use the ContentSize to determine the size
+    ///         of the view.
+    ///     </para>
+    /// </remarks>
+    /// <returns>
+    ///     If the content size was not explicitly set by <see cref="SetContentSize"/>, <see cref="GetContentSize ()"/> will
+    ///     return the size of the <see cref="Viewport"/> and <see cref="ContentSizeTracksViewport"/> will be <see langword="true"/>.
+    /// </returns>
+    public Size GetContentSize () { return _contentSize ?? Viewport.Size; }
+
+    /// <summary>
+    ///     Gets or sets a value indicating whether the view's content size tracks the <see cref="Viewport"/>'s
+    ///     size or not.
     /// </summary>
     /// <remarks>
     ///     <list type="bullet">
@@ -37,13 +94,14 @@ public partial class View
     ///             </term>
     ///             <description>
     ///                 <para>
-    ///                     <see cref="ContentSize"/> is tracking the <see cref="Viewport"/>'s size. Content scrolling will be
+    ///                     <see cref="GetContentSize ()"/> will return the <see cref="Viewport"/>'s size. Content scrolling
+    ///                     will be
     ///                     disabled.
     ///                 </para>
     ///                 <para>
     ///                     The behavior of <see cref="DimAutoStyle.Content"/> will be to use position and size of the Subviews
     ///                     to
-    ///                     determine the size of the view, ignoring <see cref="ContentSize"/>.
+    ///                     determine the size of the view, ignoring <see cref="GetContentSize ()"/>.
     ///                 </para>
     ///             </description>
     ///         </item>
@@ -53,12 +111,12 @@ public partial class View
     ///             </term>
     ///             <description>
     ///                 <para>
-    ///                     <see cref="ContentSize"/> is independent of <see cref="Viewport"/> and <see cref="Viewport"/>
-    ///                     describes the portion of the content currently visible to the user, bound by
-    ///                     <see cref="ContentSize"/>, enabling content scrolling.
+    ///                     The return value of <see cref="GetContentSize ()"/> is independent of <see cref="Viewport"/> and <see cref="Viewport"/>
+    ///                     describes the portion of the content currently visible to the user enabling content scrolling.
     ///                 </para>
     ///                 <para>
-    ///                     The behavior of <see cref="DimAutoStyle.Content"/> will be to use <see cref="ContentSize"/> to
+    ///                     The behavior of <see cref="DimAutoStyle.Content"/> will be to use <see cref="GetContentSize ()"/>
+    ///                     to
     ///                     determine the
     ///                     size of the view, ignoring the position and size of the Subviews.
     ///                 </para>
@@ -73,38 +131,7 @@ public partial class View
     }
 
     /// <summary>
-    ///     Gets the size of the View's content.
-    /// </summary>
-    /// <remarks>
-    ///     <para>
-    ///         Negative sizes are not supported.
-    ///     </para>
-    ///     <para>
-    ///         If not explicitly set, and the View has no visible subviews, <see cref="ContentSize"/> will track the size of
-    ///         <see cref="Viewport"/>.
-    ///     </para>
-    ///     <para>
-    ///         If not explicitly set, and the View has visible subviews, <see cref="ContentSize"/> will track the maximum
-    ///         position + dimension of the Subviews, supporting <see cref="Dim.Auto"/> with the
-    ///         <see cref="DimAutoStyle.Content"/> flag set.
-    ///     </para>
-    ///     <para>
-    ///         If set <see cref="Viewport"/> describes the portion of the content currently visible to the user. This enables
-    ///         virtual scrolling.
-    ///     </para>
-    ///     <para>
-    ///         If set the behavior of <see cref="DimAutoStyle.Content"/> will be to use the ContentSize to determine the size
-    ///         of the view.
-    ///     </para>
-    /// </remarks>
-    public Size ContentSize
-    {
-        get => _contentSize ?? Viewport.Size;
-        protected internal set => SetContentSize (value);
-    }
-
-    /// <summary>
-    ///     Called when <see cref="ContentSize"/> has changed.
+    ///     Called when <see cref="GetContentSize ()"/> has changed.
     /// </summary>
     /// <param name="e"></param>
     /// <returns></returns>
@@ -124,7 +151,7 @@ public partial class View
     }
 
     /// <summary>
-    ///     Event raised when the <see cref="ContentSize"/> changes.
+    ///     Event raised when the <see cref="GetContentSize ()"/> changes.
     /// </summary>
     public event EventHandler<SizeChangedEventArgs> ContentSizeChanged;
 
@@ -192,28 +219,30 @@ public partial class View
     /// <summary>
     ///     The location of the viewport into the view's content (0,0) is the top-left corner of the content. The Content
     ///     area's size
-    ///     is <see cref="ContentSize"/>.
+    ///     is <see cref="GetContentSize ()"/>.
     /// </summary>
     private Point _viewportLocation;
 
     /// <summary>
     ///     Gets or sets the rectangle describing the portion of the View's content that is visible to the user.
     ///     The viewport Location is relative to the top-left corner of the inner rectangle of <see cref="Padding"/>.
-    ///     If the viewport Size is the same as <see cref="ContentSize"/>, or <see cref="ContentSize"/> is
+    ///     If the viewport Size is the same as <see cref="GetContentSize ()"/>, or <see cref="GetContentSize ()"/> is
     ///     <see langword="null"/> the Location will be <c>0, 0</c>.
     /// </summary>
     /// <value>
     ///     The rectangle describing the location and size of the viewport into the View's virtual content, described by
-    ///     <see cref="ContentSize"/>.
+    ///     <see cref="GetContentSize ()"/>.
     /// </value>
     /// <remarks>
     ///     <para>
     ///         Positive values for the location indicate the visible area is offset into (down-and-right) the View's virtual
-    ///         <see cref="ContentSize"/>. This enables scrolling down and to the right (e.g. in a <see cref="ListView"/>.
+    ///         <see cref="GetContentSize ()"/>. This enables scrolling down and to the right (e.g. in a <see cref="ListView"/>
+    ///         .
     ///     </para>
     ///     <para>
     ///         Negative values for the location indicate the visible area is offset above (up-and-left) the View's virtual
-    ///         <see cref="ContentSize"/>. This enables scrolling up and to the left (e.g. in an image viewer that supports
+    ///         <see cref="GetContentSize ()"/>. This enables scrolling up and to the left (e.g. in an image viewer that
+    ///         supports
     ///         zoom
     ///         where the image stays centered).
     ///     </para>
@@ -294,9 +323,9 @@ public partial class View
         {
             if (!ViewportSettings.HasFlag (ViewportSettings.AllowXGreaterThanContentWidth))
             {
-                if (newViewport.X >= ContentSize.Width)
+                if (newViewport.X >= GetContentSize ().Width)
                 {
-                    newViewport.X = ContentSize.Width - 1;
+                    newViewport.X = GetContentSize ().Width - 1;
                 }
             }
 
@@ -311,9 +340,9 @@ public partial class View
 
             if (!ViewportSettings.HasFlag (ViewportSettings.AllowYGreaterThanContentHeight))
             {
-                if (newViewport.Y >= ContentSize.Height)
+                if (newViewport.Y >= GetContentSize ().Height)
                 {
-                    newViewport.Y = ContentSize.Height - 1;
+                    newViewport.Y = GetContentSize ().Height - 1;
                 }
             }
 
@@ -402,7 +431,7 @@ public partial class View
     /// <returns><see langword="true"/> if the <see cref="Viewport"/> was changed.</returns>
     public bool? ScrollVertical (int rows)
     {
-        if (ContentSize == Size.Empty || ContentSize == Viewport.Size)
+        if (GetContentSize () == Size.Empty || GetContentSize () == Viewport.Size)
         {
             return false;
         }
@@ -423,7 +452,7 @@ public partial class View
     /// <returns><see langword="true"/> if the <see cref="Viewport"/> was changed.</returns>
     public bool? ScrollHorizontal (int cols)
     {
-        if (ContentSize == Size.Empty || ContentSize == Viewport.Size)
+        if (GetContentSize () == Size.Empty || GetContentSize () == Viewport.Size)
         {
             return false;
         }

+ 6 - 6
Terminal.Gui/View/ViewDrawing.cs

@@ -106,7 +106,7 @@ public partial class View
 
         if (ViewportSettings.HasFlag (ViewportSettings.ClearContentOnly))
         {
-            Rectangle visibleContent = ViewportToScreen (new Rectangle (new (-Viewport.X, -Viewport.Y), ContentSize));
+            Rectangle visibleContent = ViewportToScreen (new Rectangle (new (-Viewport.X, -Viewport.Y), GetContentSize ()));
             toClear = Rectangle.Intersect (toClear, visibleContent);
         }
 
@@ -172,7 +172,7 @@ public partial class View
         if (ViewportSettings.HasFlag (ViewportSettings.ClipContentOnly))
         {
             // Clamp the Clip to the just content area that is within the viewport
-            Rectangle visibleContent = ViewportToScreen (new Rectangle (new (-Viewport.X, -Viewport.Y), ContentSize));
+            Rectangle visibleContent = ViewportToScreen (new Rectangle (new (-Viewport.X, -Viewport.Y), GetContentSize ()));
             clip = Rectangle.Intersect (clip, visibleContent);
         }
 
@@ -445,12 +445,12 @@ public partial class View
     ///     </para>
     ///     <para>
     ///         The <see cref="Viewport"/> Location and Size indicate what part of the View's content, defined
-    ///         by <see cref="ContentSize"/>, is visible and should be drawn. The coordinates taken by <see cref="Move"/> and
+    ///         by <see cref="GetContentSize ()"/>, is visible and should be drawn. The coordinates taken by <see cref="Move"/> and
     ///         <see cref="AddRune"/> are relative to <see cref="Viewport"/>, thus if <c>ViewPort.Location.Y</c> is <c>5</c>
     ///         the 6th row of the content should be drawn using <c>MoveTo (x, 5)</c>.
     ///     </para>
     ///     <para>
-    ///         If <see cref="ContentSize"/> is larger than <c>ViewPort.Size</c> drawing code should use <see cref="Viewport"/>
+    ///         If <see cref="GetContentSize ()"/> is larger than <c>ViewPort.Size</c> drawing code should use <see cref="Viewport"/>
     ///         to constrain drawing for better performance.
     ///     </para>
     ///     <para>
@@ -485,7 +485,7 @@ public partial class View
 
             // This should NOT clear 
             // TODO: If the output is not in the Viewport, do nothing
-            var drawRect = new Rectangle (ContentToScreen (Point.Empty), ContentSize);
+            var drawRect = new Rectangle (ContentToScreen (Point.Empty), GetContentSize ());
 
             TextFormatter?.Draw (
                                  drawRect,
@@ -594,7 +594,7 @@ public partial class View
     /// <remarks>
     ///     <para>
     ///         The location of <paramref name="region"/> is relative to the View's content, bound by <c>Size.Empty</c> and
-    ///         <see cref="ContentSize"/>.
+    ///         <see cref="GetContentSize ()"/>.
     ///     </para>
     ///     <para>
     ///         If the view has not been initialized (<see cref="IsInitialized"/> is <see langword="false"/>), the area to be

+ 9 - 9
Terminal.Gui/View/ViewText.cs

@@ -37,11 +37,11 @@ public partial class View
     ///         to <see cref="TextAlignment"/> and <see cref="TextDirection"/>.
     ///     </para>
     ///     <para>
-    ///         The text will word-wrap to additional lines if it does not fit horizontally. If <see cref="ContentSize"/>'s height
+    ///         The text will word-wrap to additional lines if it does not fit horizontally. If <see cref="GetContentSize ()"/>'s height
     ///         is 1, the text will be clipped.
     ///     </para>
     ///     <para>If <see cref="View.Width"/> or <see cref="View.Height"/> are using <see cref="DimAutoStyle.Text"/>,
-    ///     the <see cref="ContentSize"/> will be adjusted to fit the text.</para>
+    ///     the <see cref="GetContentSize ()"/> will be adjusted to fit the text.</para>
     ///     <para>When the text changes, the <see cref="TextChanged"/> is fired.</para>
     /// </remarks>
     public virtual string Text
@@ -84,7 +84,7 @@ public partial class View
     ///     redisplay the <see cref="View"/>.
     /// </summary>
     /// <remarks>
-    ///     <para> <see cref="View.Width"/> or <see cref="View.Height"/> are using <see cref="DimAutoStyle.Text"/>, the <see cref="ContentSize"/> will be adjusted to fit the text.</para>
+    ///     <para> <see cref="View.Width"/> or <see cref="View.Height"/> are using <see cref="DimAutoStyle.Text"/>, the <see cref="GetContentSize ()"/> will be adjusted to fit the text.</para>
     /// </remarks>
     /// <value>The text alignment.</value>
     public virtual Alignment TextAlignment
@@ -103,7 +103,7 @@ public partial class View
     ///     <see cref="View"/>.
     /// </summary>
     /// <remarks>
-    ///     <para> <see cref="View.Width"/> or <see cref="View.Height"/> are using <see cref="DimAutoStyle.Text"/>, the <see cref="ContentSize"/> will be adjusted to fit the text.</para>
+    ///     <para> <see cref="View.Width"/> or <see cref="View.Height"/> are using <see cref="DimAutoStyle.Text"/>, the <see cref="GetContentSize ()"/> will be adjusted to fit the text.</para>
     /// </remarks>
     /// <value>The text direction.</value>
     public virtual TextDirection TextDirection
@@ -127,7 +127,7 @@ public partial class View
     ///     the <see cref="View"/>.
     /// </summary>
     /// <remarks>
-    ///     <para> <see cref="View.Width"/> or <see cref="View.Height"/> are using <see cref="DimAutoStyle.Text"/>, the <see cref="ContentSize"/> will be adjusted to fit the text.</para>
+    ///     <para> <see cref="View.Width"/> or <see cref="View.Height"/> are using <see cref="DimAutoStyle.Text"/>, the <see cref="GetContentSize ()"/> will be adjusted to fit the text.</para>
     /// </remarks>
     /// <value>The vertical text alignment.</value>
     public virtual Alignment VerticalTextAlignment
@@ -179,8 +179,8 @@ public partial class View
         // We need to ensure TextFormatter is accurate by calling it here.
         UpdateTextFormatterText ();
 
-        // Default is to use ContentSize.
-        var size = ContentSize;
+        // Default is to use GetContentSize ().
+        var size = GetContentSize ();
 
         // TODO: This is a hack. Figure out how to move this into DimDimAuto
         // Use _width & _height instead of Width & Height to avoid debug spew
@@ -193,12 +193,12 @@ public partial class View
 
             if (widthAuto is null || !widthAuto.Style.FastHasFlags (DimAutoStyle.Text))
             {
-                size.Width = ContentSize.Width;
+                size.Width = GetContentSize ().Width;
             }
 
             if (heightAuto is null || !heightAuto.Style.FastHasFlags (DimAutoStyle.Text))
             {
-                size.Height = ContentSize.Height;
+                size.Height = GetContentSize ().Height;
             }
         }
 

+ 6 - 6
Terminal.Gui/View/ViewportSettings.cs

@@ -47,13 +47,13 @@ public enum ViewportSettings
     AllowNegativeLocation = AllowNegativeX | AllowNegativeY,
 
     /// <summary>
-    ///     If set, <see cref="View.Viewport"/><c>.X</c> can be set values greater than <see cref="View.ContentSize"/>
+    ///     If set, <see cref="View.Viewport"/><c>.X</c> can be set values greater than <see cref="View.GetContentSize ()"/>
     ///     <c>.Width</c> enabling scrolling beyond the right
     ///     of the content area.
     /// </summary>
     /// <remarks>
     ///     <para>
-    ///         When not set, <see cref="View.Viewport"/><c>.X</c> is constrained to <see cref="View.ContentSize"/>
+    ///         When not set, <see cref="View.Viewport"/><c>.X</c> is constrained to <see cref="View.GetContentSize ()"/>
     ///         <c>.Width - 1</c>.
     ///         This means the last column of the content will remain visible even if there is an attempt to scroll the
     ///         Viewport past the last column.
@@ -65,13 +65,13 @@ public enum ViewportSettings
     AllowXGreaterThanContentWidth = 4,
 
     /// <summary>
-    ///     If set, <see cref="View.Viewport"/><c>.Y</c> can be set values greater than <see cref="View.ContentSize"/>
+    ///     If set, <see cref="View.Viewport"/><c>.Y</c> can be set values greater than <see cref="View.GetContentSize ()"/>
     ///     <c>.Height</c> enabling scrolling beyond the right
     ///     of the content area.
     /// </summary>
     /// <remarks>
     ///     <para>
-    ///         When not set, <see cref="View.Viewport"/><c>.Y</c> is constrained to <see cref="View.ContentSize"/>
+    ///         When not set, <see cref="View.Viewport"/><c>.Y</c> is constrained to <see cref="View.GetContentSize ()"/>
     ///         <c>.Height - 1</c>.
     ///         This means the last row of the content will remain visible even if there is an attempt to scroll the Viewport
     ///         past the last row.
@@ -83,13 +83,13 @@ public enum ViewportSettings
     AllowYGreaterThanContentHeight = 8,
 
     /// <summary>
-    ///     If set, <see cref="View.Viewport"/><c>.Size</c> can be set values greater than <see cref="View.ContentSize"/>
+    ///     If set, <see cref="View.Viewport"/><c>.Size</c> can be set values greater than <see cref="View.GetContentSize ()"/>
     ///     enabling scrolling beyond the bottom-right
     ///     of the content area.
     /// </summary>
     /// <remarks>
     ///     <para>
-    ///         When not set, <see cref="View.Viewport"/> is constrained to <see cref="View.ContentSize"/><c> -1</c>.
+    ///         When not set, <see cref="View.Viewport"/> is constrained to <see cref="View.GetContentSize ()"/><c> -1</c>.
     ///         This means the last column and row of the content will remain visible even if there is an attempt to
     ///         scroll the Viewport past the last column or row.
     ///     </para>

+ 3 - 3
Terminal.Gui/Views/ColorPicker.cs

@@ -39,7 +39,7 @@ public class ColorPicker : View
 
         Width = Dim.Auto (minimumContentDim: _boxWidth * _cols);
         Height = Dim.Auto (minimumContentDim: _boxHeight * _rows);
-        ContentSize = new (_boxWidth * _cols, _boxHeight * _rows);
+        SetContentSize (new (_boxWidth * _cols, _boxHeight * _rows));
 
         MouseClick += ColorPicker_MouseClick;
     }
@@ -67,7 +67,7 @@ public class ColorPicker : View
                 _boxHeight = value;
                 Width = Dim.Auto (minimumContentDim: _boxWidth * _cols);
                 Height = Dim.Auto (minimumContentDim: _boxHeight * _rows);
-                ContentSize = new (_boxWidth * _cols, _boxHeight * _rows);
+                SetContentSize (new (_boxWidth * _cols, _boxHeight * _rows));
                 SetNeedsLayout ();
             }
         }
@@ -84,7 +84,7 @@ public class ColorPicker : View
                 _boxWidth = value;
                 Width = Dim.Auto (minimumContentDim: _boxWidth * _cols);
                 Height = Dim.Auto (minimumContentDim: _boxHeight * _rows);
-                ContentSize = new (_boxWidth * _cols, _boxHeight * _rows);
+                SetContentSize (new (_boxWidth * _cols, _boxHeight * _rows));
                 SetNeedsLayout ();
             }
         }

+ 2 - 2
Terminal.Gui/Views/ComboBox.cs

@@ -619,8 +619,8 @@ public class ComboBox : View
         {
             _search.Width = _listview.Width = _autoHide ? Viewport.Width - 1 : Viewport.Width;
             _listview.Height = CalculatetHeight ();
-            _search.SetRelativeLayout (ContentSize);
-            _listview.SetRelativeLayout (ContentSize);
+            _search.SetRelativeLayout (GetContentSize ());
+            _listview.SetRelativeLayout (GetContentSize ());
         }
     }
 

+ 1 - 1
Terminal.Gui/Views/DatePicker.cs

@@ -275,7 +275,7 @@ public class DatePicker : View
         Height = Dim.Auto (DimAutoStyle.Content);
 
         // BUGBUG: Remove when Dim.Auto(subviews) fully works
-        ContentSize = new (_calendar.Style.ColumnStyles.Sum (c => c.Value.MinWidth) + 7, _calendar.Frame.Height + 1);
+        SetContentSize (new (_calendar.Style.ColumnStyles.Sum (c => c.Value.MinWidth) + 7, _calendar.Frame.Height + 1));
 
         _dateField.DateChanged += DateField_DateChanged;
 

+ 1 - 1
Terminal.Gui/Views/ListView.cs

@@ -264,7 +264,7 @@ public class ListView : View
             }
             _source = value;
 
-            ContentSize = new Size (_source?.Length ?? Viewport.Width, _source?.Count ?? Viewport.Width);
+            SetContentSize (new Size (_source?.Length ?? Viewport.Width, _source?.Count ?? Viewport.Width));
             if (IsInitialized)
             {
                 Viewport = Viewport with { Y = 0 };

+ 1 - 1
Terminal.Gui/Views/Menu/MenuBar.cs

@@ -256,7 +256,7 @@ public class MenuBar : View
         X = 0;
         Y = 0;
         Width = Dim.Fill ();
-        Height = 1; // BUGBUG: Views should avoid setting Height as doing so implies Frame.Size == ContentSize
+        Height = 1; // BUGBUG: Views should avoid setting Height as doing so implies Frame.Size == GetContentSize ().
         Menus = new MenuBarItem [] { };
 
         //CanFocus = true;

+ 1 - 1
Terminal.Gui/Views/MessageBox.cs

@@ -405,7 +405,7 @@ public static class MessageBox
             Size GetWrapSize ()
             {
                 // A bit of a hack to get the height of the wrapped text.
-                messageLabel.TextFormatter.Size = d.ContentSize with { Height = 1000 };
+                messageLabel.TextFormatter.Size = d.GetContentSize () with { Height = 1000 };
                 return messageLabel.TextFormatter.FormatAndGetSize ();
             }
         }

+ 2 - 2
Terminal.Gui/Views/RadioGroup.cs

@@ -456,7 +456,7 @@ private void SetContentSize ()
                 width = Math.Max (s.GetColumns () + 2, width);
             }
 
-            ContentSize = new (width, _radioLabels.Count);
+            SetContentSize (new (width, _radioLabels.Count));
             break;
 
         case Orientation.Horizontal:
@@ -471,7 +471,7 @@ private void SetContentSize ()
                 length = _radioLabels [i].GetColumns () + 2 + (i < _radioLabels.Count - 1 ? _horizontalSpace : 0);
                 _horizontal.Add ((start, length));
             }
-            ContentSize = new (_horizontal.Sum (item => item.length), 1);
+            SetContentSize (new (_horizontal.Sum (item => item.length), 1));
             break;
     }
 }

+ 19 - 26
Terminal.Gui/Views/ScrollView.cs

@@ -21,7 +21,7 @@ namespace Terminal.Gui;
 ///     <para>
 ///         The subviews that are added to this <see cref="Gui.ScrollView"/> are offset by the
 ///         <see cref="ContentOffset"/> property.  The view itself is a window into the space represented by the
-///         <see cref="View.ContentSize"/>.
+///         <see cref="View.GetContentSize ()"/>.
 ///     </para>
 ///     <para>Use the</para>
 /// </remarks>
@@ -88,10 +88,10 @@ public class ScrollView : View
         AddCommand (Command.PageDown, () => ScrollDown (Viewport.Height));
         AddCommand (Command.PageLeft, () => ScrollLeft (Viewport.Width));
         AddCommand (Command.PageRight, () => ScrollRight (Viewport.Width));
-        AddCommand (Command.TopHome, () => ScrollUp (ContentSize.Height));
-        AddCommand (Command.BottomEnd, () => ScrollDown (ContentSize.Height));
-        AddCommand (Command.LeftHome, () => ScrollLeft (ContentSize.Width));
-        AddCommand (Command.RightEnd, () => ScrollRight (ContentSize.Width));
+        AddCommand (Command.TopHome, () => ScrollUp (GetContentSize ().Height));
+        AddCommand (Command.BottomEnd, () => ScrollDown (GetContentSize ().Height));
+        AddCommand (Command.LeftHome, () => ScrollLeft (GetContentSize ().Width));
+        AddCommand (Command.RightEnd, () => ScrollRight (GetContentSize ().Width));
 
         // Default keybindings for this view
         KeyBindings.Add (Key.CursorUp, Command.ScrollUp);
@@ -127,7 +127,7 @@ public class ScrollView : View
                            }
 
                            SetContentOffset (_contentOffset);
-                           _contentView.Frame = new Rectangle (ContentOffset, ContentSize);
+                           _contentView.Frame = new Rectangle (ContentOffset, GetContentSize ());
 
                            // PERF: How about calls to Point.Offset instead?
                            _vertical.ChangedPosition += delegate { ContentOffset = new Point (ContentOffset.X, _vertical.Position); };
@@ -136,13 +136,6 @@ public class ScrollView : View
         ContentSizeChanged += ScrollViewContentSizeChanged;
     }
 
-    [ObsoleteAttribute ("This method is obsolete and will be removed in v2.", false)]
-    public void SetContentSize (Size contentSize)
-    {
-        ContentSize = contentSize;
-    }
-
-
     private void ScrollViewContentSizeChanged (object sender, SizeChangedEventArgs e)
     {
         if (e.Size is null)
@@ -227,12 +220,12 @@ public class ScrollView : View
     //    get => ContentSize;
     //    set
     //    {
-    //        if (ContentSize != value)
+    //        if (GetContentSize () != value)
     //        {
     //            ContentSize = value;
     //            _contentView.Frame = new Rectangle (_contentOffset, value);
-    //            _vertical.Size = ContentSize.Height;
-    //            _horizontal.Size = ContentSize.Width;
+    //            _vertical.Size = GetContentSize ().Height;
+    //            _horizontal.Size = GetContentSize ().Width;
     //            SetNeedsDisplay ();
     //        }
     //    }
@@ -251,26 +244,26 @@ public class ScrollView : View
                 _horizontal.OtherScrollBarView.KeepContentAlwaysInViewport = value;
                 Point p = default;
 
-                if (value && -_contentOffset.X + Viewport.Width > ContentSize.Width)
+                if (value && -_contentOffset.X + Viewport.Width > GetContentSize ().Width)
                 {
                     p = new Point (
-                                   ContentSize.Width - Viewport.Width + (_showVerticalScrollIndicator ? 1 : 0),
+                                   GetContentSize ().Width - Viewport.Width + (_showVerticalScrollIndicator ? 1 : 0),
                                    -_contentOffset.Y
                                   );
                 }
 
-                if (value && -_contentOffset.Y + Viewport.Height > ContentSize.Height)
+                if (value && -_contentOffset.Y + Viewport.Height > GetContentSize ().Height)
                 {
                     if (p == default (Point))
                     {
                         p = new Point (
                                        -_contentOffset.X,
-                                       ContentSize.Height - Viewport.Height + (_showHorizontalScrollIndicator ? 1 : 0)
+                                       GetContentSize ().Height - Viewport.Height + (_showHorizontalScrollIndicator ? 1 : 0)
                                       );
                     }
                     else
                     {
-                        p.Y = ContentSize.Height - Viewport.Height + (_showHorizontalScrollIndicator ? 1 : 0);
+                        p.Y = GetContentSize ().Height - Viewport.Height + (_showHorizontalScrollIndicator ? 1 : 0);
                     }
                 }
 
@@ -614,7 +607,7 @@ public class ScrollView : View
     {
         // INTENT: Unclear intent. How about a call to Offset?
         _contentOffset = new Point (-Math.Abs (offset.X), -Math.Abs (offset.Y));
-        _contentView.Frame = new Rectangle (_contentOffset, ContentSize);
+        _contentView.Frame = new Rectangle (_contentOffset, GetContentSize ());
         int p = Math.Max (0, -_contentOffset.Y);
 
         if (_vertical.Position != p)
@@ -645,7 +638,7 @@ public class ScrollView : View
         bool v = false, h = false;
         var p = false;
 
-        if (ContentSize is { } && (Viewport.Height == 0 || Viewport.Height > ContentSize.Height))
+        if (GetContentSize () is { } && (Viewport.Height == 0 || Viewport.Height > GetContentSize ().Height))
         {
             if (ShowVerticalScrollIndicator)
             {
@@ -654,7 +647,7 @@ public class ScrollView : View
 
             v = false;
         }
-        else if (ContentSize is { } && Viewport.Height > 0 && Viewport.Height == ContentSize.Height)
+        else if (GetContentSize () is { } && Viewport.Height > 0 && Viewport.Height == GetContentSize ().Height)
         {
             p = true;
         }
@@ -668,7 +661,7 @@ public class ScrollView : View
             v = true;
         }
 
-        if (ContentSize is { } && (Viewport.Width == 0 || Viewport.Width > ContentSize.Width))
+        if (GetContentSize () is { } && (Viewport.Width == 0 || Viewport.Width > GetContentSize ().Width))
         {
             if (ShowHorizontalScrollIndicator)
             {
@@ -677,7 +670,7 @@ public class ScrollView : View
 
             h = false;
         }
-        else if (ContentSize is { } && Viewport.Width > 0 && Viewport.Width == ContentSize.Width && p)
+        else if (GetContentSize () is { } && Viewport.Width > 0 && Viewport.Width == GetContentSize ().Width && p)
         {
             if (ShowHorizontalScrollIndicator)
             {

+ 1 - 1
Terminal.Gui/Views/Slider.cs

@@ -464,7 +464,7 @@ public class Slider<T> : View
             CalcSpacingConfig (horizontal ? Viewport.Width : Viewport.Height);
         }
 
-        ContentSize = new (GetIdealWidth (), GetIdealHeight ());
+        SetContentSize (new (GetIdealWidth (), GetIdealHeight ()));
 
         return;
 

+ 1 - 1
Terminal.Gui/Views/StatusBar.cs

@@ -93,7 +93,7 @@ public class StatusBar : View
         X = 0;
         Y = Pos.AnchorEnd (1);
         Width = Dim.Fill ();
-        Height = 1; // BUGBUG: Views should avoid setting Height as doing so implies Frame.Size == ContentSize
+        Height = 1; // BUGBUG: Views should avoid setting Height as doing so implies Frame.Size == GetContentSize ().
         AddCommand (Command.Accept, InvokeItem);
     }
 

+ 1 - 1
Terminal.Gui/Views/TabView.cs

@@ -564,7 +564,7 @@ public class TabView : View
             _host = host;
 
             CanFocus = true;
-            Height = 1; // BUGBUG: Views should avoid setting Height as doing so implies Frame.Size == ContentSize
+            Height = 1; // BUGBUG: Views should avoid setting Height as doing so implies Frame.Size == GetContentSize ().
             Width = Dim.Fill ();
 
             _rightScrollIndicator = new View

+ 2 - 2
UICatalog/Scenarios/ASCIICustomButton.cs

@@ -270,7 +270,7 @@ public class ASCIICustomButtonTest : Scenario
                 case KeyCode.End:
                     _scrollView.ContentOffset = new Point (
                                                            _scrollView.ContentOffset.X,
-                                                           -(_scrollView.ContentSize.Height
+                                                           -(_scrollView.GetContentSize ().Height
                                                              - _scrollView.Frame.Height
                                                              + (_scrollView.ShowHorizontalScrollIndicator ? 1 : 0))
                                                           );
@@ -288,7 +288,7 @@ public class ASCIICustomButtonTest : Scenario
                                                            Math.Max (
                                                                      _scrollView.ContentOffset.Y
                                                                      - _scrollView.Frame.Height,
-                                                                     -(_scrollView.ContentSize.Height
+                                                                     -(_scrollView.GetContentSize ().Height
                                                                        - _scrollView.Frame.Height
                                                                        + (_scrollView.ShowHorizontalScrollIndicator
                                                                               ? 1

+ 1 - 1
UICatalog/Scenarios/CharacterMap.cs

@@ -328,7 +328,7 @@ internal class CharMap : View
         CanFocus = true;
         CursorVisibility = CursorVisibility.Default;
 
-        ContentSize = new (RowWidth, (MaxCodePoint / 16 + 2) * _rowHeight);
+        SetContentSize (new (RowWidth, (MaxCodePoint / 16 + 2) * _rowHeight));
 
         AddCommand (
                     Command.ScrollUp,

+ 1 - 1
UICatalog/Scenarios/Clipping.cs

@@ -23,7 +23,7 @@ public class Clipping : Scenario
         //Win.Height = Dim.Fill () - 2;
         var label = new Label
         {
-            X = 0, Y = 0, Text = "ScrollView (new Rectangle (3, 3, 50, 20)) with a 200, 100 ContentSize..."
+            X = 0, Y = 0, Text = "ScrollView (new Rectangle (3, 3, 50, 20)) with a 200, 100 GetContentSize ()..."
         };
         Top.Add (label);
 

+ 8 - 14
UICatalog/Scenarios/ContentScrolling.cs

@@ -5,7 +5,7 @@ using Terminal.Gui;
 
 namespace UICatalog.Scenarios;
 
-[ScenarioMetadata ("Content Scrolling", "Demonstrates using View.Viewport and View.ContentSize to scroll content.")]
+[ScenarioMetadata ("Content Scrolling", "Demonstrates using View.Viewport and View.GetContentSize () to scroll content.")]
 [ScenarioCategory ("Layout")]
 [ScenarioCategory ("Drawing")]
 [ScenarioCategory ("Scrolling")]
@@ -27,7 +27,7 @@ public class ContentScrolling : Scenario
             BorderStyle = LineStyle.Rounded;
             Arrangement = ViewArrangement.Fixed;
 
-            ContentSize = new (60, 40);
+            SetContentSize (new (60, 40));
             ViewportSettings |= ViewportSettings.ClearContentOnly;
             ViewportSettings |= ViewportSettings.ClipContentOnly;
 
@@ -52,12 +52,6 @@ public class ContentScrolling : Scenario
             MouseEvent += VirtualDemoView_MouseEvent;
         }
 
-        [ObsoleteAttribute ("This method is obsolete and will be removed in v2.", false)]
-        public void SetContentSize (Size contentSize)
-        {
-            ContentSize = contentSize;
-        }
-
         private void VirtualDemoView_MouseEvent (object sender, MouseEventEventArgs e)
         {
             if (e.MouseEvent.Flags == MouseFlags.WheeledDown)
@@ -93,7 +87,7 @@ public class ContentScrolling : Scenario
 
             if (status is { })
             {
-                status.Title = $"Frame: {Frame}\n\nViewport: {Viewport}, ContentSize = {ContentSize}";
+                status.Title = $"Frame: {Frame}\n\nViewport: {Viewport}, ContentSize = {GetContentSize ()}";
                 status.Width = Border.Frame.Width - status.Frame.X - Border.Thickness.Right;
                 status.Height = Border.Thickness.Top;
             }
@@ -237,7 +231,7 @@ public class ContentScrolling : Scenario
 
         Buttons.NumericUpDown<int> contentSizeWidth = new Buttons.NumericUpDown<int>
         {
-            Value = view.ContentSize.Width,
+            Value = view.GetContentSize ().Width,
             X = Pos.Right (labelContentSize) + 1,
             Y = Pos.Top (labelContentSize)
         };
@@ -252,7 +246,7 @@ public class ContentScrolling : Scenario
                 return;
             }
             // BUGBUG: set_ContentSize is supposed to be `protected`. 
-            view.SetContentSize (view.ContentSize with { Width = e.NewValue });
+            view.SetContentSize (view.GetContentSize () with { Width = e.NewValue });
         }
 
         var labelComma = new Label
@@ -264,7 +258,7 @@ public class ContentScrolling : Scenario
 
         Buttons.NumericUpDown<int> contentSizeHeight = new Buttons.NumericUpDown<int>
         {
-            Value = view.ContentSize.Height,
+            Value = view.GetContentSize ().Height,
             X = Pos.Right (labelComma) + 1,
             Y = Pos.Top (labelContentSize),
             CanFocus = false
@@ -280,7 +274,7 @@ public class ContentScrolling : Scenario
                 return;
             }
             // BUGBUG: set_ContentSize is supposed to be `protected`. 
-            view.SetContentSize (view.ContentSize with { Height = e.NewValue });
+            view.SetContentSize (view.GetContentSize () with { Height = e.NewValue });
         }
 
         var cbClearOnlyVisible = new CheckBox
@@ -362,7 +356,7 @@ public class ContentScrolling : Scenario
         {
             X = Pos.Center (),
             Y = Pos.Bottom (textView) + 1,
-            Width = Dim.Auto (DimAutoStyle.Content, maximumContentDim: Dim.Func (() => view.ContentSize.Width)),
+            Width = Dim.Auto (DimAutoStyle.Content, maximumContentDim: Dim.Func (() => view.GetContentSize ().Width)),
             Height = Dim.Auto (DimAutoStyle.Content, maximumContentDim: Dim.Percent (20)),
         };
 

+ 1 - 1
UICatalog/Scenarios/Scrolling.cs

@@ -48,7 +48,7 @@ public class Scrolling : Scenario
         scrollView.SetContentSize (new (120, 40));
         scrollView.Padding.Thickness = new (1);
 
-        label.Text = $"{scrollView}\nContentSize: {scrollView.ContentSize}\nContentOffset: {scrollView.ContentOffset}";
+        label.Text = $"{scrollView}\nContentSize: {scrollView.GetContentSize ()}\nContentOffset: {scrollView.ContentOffset}";
 
         const string rule = "0123456789";
 

+ 1 - 1
UnitTests/Application/MouseTests.cs

@@ -236,7 +236,7 @@ public class MouseTests
     {
         var tf = new TextField { Width = 10 };
         var sv = new ScrollView { Width = Dim.Fill (), Height = Dim.Fill () };
-        sv.ContentSize = new (100, 100);
+        sv.SetContentSize (new (100, 100));
 
         sv.Add (tf);
         var top = new Toplevel ();

+ 2 - 2
UnitTests/View/DrawTests.cs

@@ -921,7 +921,7 @@ public class DrawTests (ITestOutputHelper _output)
             Height = Dim.Fill (),
             ViewportSettings = ViewportSettings.ClipContentOnly
         };
-        view.ContentSize = new Size (10, 10);
+        view.SetContentSize (new Size (10, 10));
         view.Border.Thickness = new Thickness (1);
         view.BeginInit ();
         view.EndInit ();
@@ -953,7 +953,7 @@ public class DrawTests (ITestOutputHelper _output)
             Width = Dim.Fill (),
             Height = Dim.Fill (),
         };
-        view.ContentSize = new Size (10, 10);
+        view.SetContentSize (new Size (10, 10));
         view.Border.Thickness = new Thickness (1);
         view.BeginInit ();
         view.EndInit ();

+ 1 - 1
UnitTests/View/FindDeepestViewTests.cs

@@ -470,7 +470,7 @@ public class FindDeepestViewTests ()
         subview.Padding.Thickness = new (1);
 
         // Scroll the subview
-        subview.ContentSize = new (10, 10);
+        subview.SetContentSize (new (10, 10));
         subview.Viewport = subview.Viewport with { Location = new (1, 1) };
 
         // This subview will be at the bottom-right-corner of subview

+ 13 - 13
UnitTests/View/Layout/Dim.AutoTests.cs

@@ -83,7 +83,7 @@ public class DimAutoTests (ITestOutputHelper output)
             ValidatePosDim = true
         };
 
-        view.ContentSize = new (contentSize, 0);
+        view.SetContentSize (new (contentSize, 0));
 
         Assert.Equal (expected, view.Frame.Width);
     }
@@ -102,7 +102,7 @@ public class DimAutoTests (ITestOutputHelper output)
             ValidatePosDim = true
         };
 
-        view.ContentSize = new (contentSize, 0);
+        view.SetContentSize (new (contentSize, 0));
         view.SetRelativeLayout (new (100, 100));
 
         Assert.Equal (expected, view.Frame.Width);
@@ -124,7 +124,7 @@ public class DimAutoTests (ITestOutputHelper output)
             ValidatePosDim = true
         };
 
-        view.ContentSize = new (contentSize, 0);
+        view.SetContentSize (new (contentSize, 0));
         view.SetRelativeLayout (new (100, 100));
 
         Assert.Equal (expected, view.Frame.Width);
@@ -671,7 +671,7 @@ public class DimAutoTests (ITestOutputHelper output)
 
         superView.BeginInit ();
         superView.EndInit ();
-        superView.SetRelativeLayout (superView.ContentSize);
+        superView.SetRelativeLayout (superView.GetContentSize ());
 
         superView.LayoutSubviews ();
         Assert.Equal (expectedSubWidth, subView.Frame.Width);
@@ -720,7 +720,7 @@ public class DimAutoTests (ITestOutputHelper output)
 
         superView.BeginInit ();
         superView.EndInit ();
-        superView.SetRelativeLayout (superView.ContentSize);
+        superView.SetRelativeLayout (superView.GetContentSize ());
 
         superView.LayoutSubviews ();
         Assert.Equal (expectedSubWidth, subView.Frame.Width);
@@ -745,7 +745,7 @@ public class DimAutoTests (ITestOutputHelper output)
         super.Add (view);
 
         Rectangle expectedViewport = new (0, 0, 8, 1);
-        Assert.Equal (expectedViewport.Size, view.ContentSize);
+        Assert.Equal (expectedViewport.Size, view.GetContentSize ());
         Assert.Equal (expectedViewport, view.Frame);
         Assert.Equal (expectedViewport, view.Viewport);
 
@@ -766,7 +766,7 @@ public class DimAutoTests (ITestOutputHelper output)
         var view = new View ();
         view.Width = Auto (DimAutoStyle.Text);
         view.Height = Auto (DimAutoStyle.Text);
-        view.ContentSize = new (1, 1);
+        view.SetContentSize (new (1, 1));
         view.Text = text;
         Assert.Equal (new (expectedW, expectedH), view.TextFormatter.Size);
     }
@@ -943,19 +943,19 @@ public class DimAutoTests (ITestOutputHelper output)
         };
 
         Assert.Equal (new Rectangle (0, 0, 5, 1), view.Frame);
-        Assert.Equal (new Size (5, 1), view.ContentSize);
+        Assert.Equal (new Size (5, 1), view.GetContentSize ());
 
         // Change text to a longer string
         view.Text = "0123456789";
 
         Assert.Equal (new Rectangle (0, 0, 10, 1), view.Frame);
-        Assert.Equal (new Size (10, 1), view.ContentSize);
+        Assert.Equal (new Size (10, 1), view.GetContentSize ());
 
         // If ContentSize was reset, these should cause it to update
         view.Width = 5;
         view.Height = 1;
 
-        Assert.Equal (new Size (5, 1), view.ContentSize);
+        Assert.Equal (new Size (5, 1), view.GetContentSize ());
     }
 
     // DimAutoStyle.Content tests
@@ -963,7 +963,7 @@ public class DimAutoTests (ITestOutputHelper output)
     public void DimAutoStyle_Content_UsesContentSize_WhenSet ()
     {
         var view = new View ();
-        view.ContentSize = new (10, 5);
+        view.SetContentSize (new (10, 5));
 
         var dim = Dim.Auto (DimAutoStyle.Content);
 
@@ -979,7 +979,7 @@ public class DimAutoTests (ITestOutputHelper output)
         var subview = new View () {
                 Frame = new Rectangle (50, 50, 1, 1)
         };
-        view.ContentSize = new (10, 5);
+        view.SetContentSize (new (10, 5));
 
         var dim = Dim.Auto (DimAutoStyle.Content);
 
@@ -1315,7 +1315,7 @@ public class DimAutoTests (ITestOutputHelper output)
     public void DimAutoStyle_Content_UsesContentSize_If_No_Subviews ()
     {
         DimAutoTestView view = new (Auto (DimAutoStyle.Content), Auto (DimAutoStyle.Content));
-        view.ContentSize = new (5, 5);
+        view.SetContentSize (new (5, 5));
         view.SetRelativeLayout (new (10, 10));
 
         Assert.Equal (new (5, 5), view.Frame.Size);

+ 1 - 1
UnitTests/View/Layout/LayoutTests.cs

@@ -123,7 +123,7 @@ public class LayoutTests (ITestOutputHelper output)
             Width = 5,
             Height = 5,
         };
-        superView.ContentSize = new (10, 10);
+        superView.SetContentSize (new (10, 10));
         var view = new View ()
         {
             X = Pos.Center ()

+ 2 - 2
UnitTests/View/Layout/ScreenToTests.cs

@@ -108,7 +108,7 @@ public class ScreenToTests
             BorderStyle = LineStyle.Single,
         };
         var view = new View { X = viewX, Y = viewY, Width = 5, Height = 5 };
-        view.ContentSize = new (6, 6);
+        view.SetContentSize (new (6, 6));
         super.Add (view);
 
         view.Viewport = new (1, 1, 5, 5);
@@ -164,7 +164,7 @@ public class ScreenToTests
             X = viewX, Y = viewY, Width = 5, Height = 5,
             BorderStyle = LineStyle.Single,
         };
-        view.ContentSize = new (10, 10);
+        view.SetContentSize (new (10, 10));
         super.Add (view);
 
         view.Viewport = view.Viewport with { Location = new (1, 1) };

+ 5 - 5
UnitTests/View/Layout/ToScreenTests.cs

@@ -336,7 +336,7 @@ public class ToScreenTests (ITestOutputHelper output)
             Width = 10,
             Height = 10
         };
-        view.ContentSize = new (20, 20);
+        view.SetContentSize (new (20, 20));
 
         Point testPoint = new (0, 0);
         Assert.Equal (new Point (1, 1), view.ContentToScreen (testPoint));
@@ -362,7 +362,7 @@ public class ToScreenTests (ITestOutputHelper output)
 
         var view = new View ();
         view.Frame = frame;
-        view.ContentSize = new (20, 20);
+        view.SetContentSize (new (20, 20));
         view.BorderStyle = LineStyle.Single;
 
         // Act
@@ -403,7 +403,7 @@ public class ToScreenTests (ITestOutputHelper output)
 
         var view = new View ();
         view.Frame = frame;
-        view.ContentSize = new (20, 20);
+        view.SetContentSize (new (20, 20));
 
         superView.Add (view);
         superView.LayoutSubviews ();
@@ -608,7 +608,7 @@ public class ToScreenTests (ITestOutputHelper output)
 
     //    var view = new View ();
     //    view.Frame = frame;
-    //    view.ContentSize = new (11, 11);
+    //    view.SetContentSize (new (11, 11));
     //    view.Content = view.Content with { Location = new (1, 1) };
 
     //    superView.Add (view);
@@ -928,7 +928,7 @@ public class ToScreenTests (ITestOutputHelper output)
 
         var view = new View ();
         view.Frame = frame;
-        view.ContentSize = new (11, 11);
+        view.SetContentSize (new (11, 11));
         view.Viewport = view.Viewport with { Location = new (1, 1) };
 
         superView.Add (view);

+ 8 - 8
UnitTests/View/Layout/ViewportTests.cs

@@ -279,7 +279,7 @@ public class ViewportTests (ITestOutputHelper output)
     {
         // Arrange
         var view = new View ();
-        view.ContentSize = new (100, 100);
+        view.SetContentSize (new (100, 100));
         var newViewport = new Rectangle (0, 0, 200, 200);
         view.ViewportSettings = ViewportSettings.AllowLocationGreaterThanContentSize;
 
@@ -348,7 +348,7 @@ public class ViewportTests (ITestOutputHelper output)
             Height = 1
         };
         Assert.True (view.ContentSizeTracksViewport);
-        Assert.Equal (view.Viewport.Size, view.ContentSize);
+        Assert.Equal (view.Viewport.Size, view.GetContentSize ());
     }
 
     [Fact]
@@ -358,10 +358,10 @@ public class ViewportTests (ITestOutputHelper output)
         {
             Width = 1,
             Height = 1,
-            ContentSize = new Size (5, 5)
         };
+        view.SetContentSize (new Size (5, 5));
         Assert.False (view.ContentSizeTracksViewport);
-        Assert.NotEqual (view.Viewport.Size, view.ContentSize);
+        Assert.NotEqual (view.Viewport.Size, view.GetContentSize ());
     }
 
     [Fact]
@@ -371,11 +371,11 @@ public class ViewportTests (ITestOutputHelper output)
         {
             Width = 1,
             Height = 1,
-            ContentSize = new Size (5, 5)
         };
+        view.SetContentSize (new Size (5, 5));
         view.Viewport = new (0, 0, 10, 10);
         view.ContentSizeTracksViewport = true;
-        Assert.Equal (view.Viewport.Size, view.ContentSize);
+        Assert.Equal (view.Viewport.Size, view.GetContentSize ());
     }
 
 
@@ -386,11 +386,11 @@ public class ViewportTests (ITestOutputHelper output)
         {
             Width = 1,
             Height = 1,
-            ContentSize = new Size (5, 5)
         };
+        view.SetContentSize (new Size (5, 5));
         view.Viewport = new (0, 0, 10, 10);
         view.ContentSizeTracksViewport = false;
-        Assert.NotEqual (view.Viewport.Size, view.ContentSize);
+        Assert.NotEqual (view.Viewport.Size, view.GetContentSize ());
     }
 
     //[Theory]

+ 9 - 9
UnitTests/View/SubviewTests.cs

@@ -338,7 +338,7 @@ public class SubviewTests
     public void Add_Does_Not_Impact_ContentSize ()
     {
         var view = new View ();
-        view.ContentSize = new Size (1, 1);
+        view.SetContentSize (new Size (1, 1));
 
         var subview = new View ()
         {
@@ -346,16 +346,16 @@ public class SubviewTests
             Y = 10
         };
 
-        Assert.Equal (new Size (1, 1), view.ContentSize);
+        Assert.Equal (new Size (1, 1), view.GetContentSize ());
         view.Add (subview);
-        Assert.Equal (new Size (1, 1), view.ContentSize);
+        Assert.Equal (new Size (1, 1), view.GetContentSize ());
     }
 
     [Fact]
     public void Remove_Does_Not_Impact_ContentSize ()
     {
         var view = new View ();
-        view.ContentSize = new Size (1, 1);
+        view.SetContentSize (new Size (1, 1));
 
         var subview = new View ()
         {
@@ -363,14 +363,14 @@ public class SubviewTests
             Y = 10
         };
 
-        Assert.Equal (new Size (1, 1), view.ContentSize);
+        Assert.Equal (new Size (1, 1), view.GetContentSize ());
         view.Add (subview);
-        Assert.Equal (new Size (1, 1), view.ContentSize);
+        Assert.Equal (new Size (1, 1), view.GetContentSize ());
 
-        view.ContentSize = new Size (5, 5);
-        Assert.Equal (new Size (5, 5), view.ContentSize);
+        view.SetContentSize (new Size (5, 5));
+        Assert.Equal (new Size (5, 5), view.GetContentSize ());
 
         view.Remove (subview);
-        Assert.Equal (new Size (5, 5), view.ContentSize);
+        Assert.Equal (new Size (5, 5), view.GetContentSize ());
     }
 }

+ 1 - 1
UnitTests/View/TextTests.cs

@@ -32,7 +32,7 @@ public class TextTests (ITestOutputHelper output)
     public void TextFormatter_Size_Tracks_ContentSize (string text, int expectedW, int expectedH)
     {
         var view = new View ();
-        view.ContentSize = new (1,1);
+        view.SetContentSize (new (1,1));
         view.Text = text;
         Assert.Equal (new (expectedW, expectedH), view.TextFormatter.Size);
     }

+ 1 - 1
UnitTests/View/TitleTests.cs

@@ -102,7 +102,7 @@ public class TitleTests (ITestOutputHelper output)
         Assert.Equal (text, view.Text);
 
         // SetupFakeDriver only create a screen with 25 cols and 25 rows
-        Assert.Equal (new (text.Length, 1), view.ContentSize);
+        Assert.Equal (new (text.Length, 1), view.GetContentSize ());
 
         top.Dispose ();
     }

+ 2 - 2
UnitTests/Views/ButtonTests.cs

@@ -62,7 +62,7 @@ public class ButtonTests (ITestOutputHelper output)
 
         Assert.Equal (new Size (expectedWidth, expectedHeight), btn1.Frame.Size);
         Assert.Equal (new Size (expectedWidth, expectedHeight), btn1.Viewport.Size);
-        Assert.Equal (new Size (expectedWidth, expectedHeight), btn1.ContentSize);
+        Assert.Equal (new Size (expectedWidth, expectedHeight), btn1.GetContentSize ());
         Assert.Equal (new Size (expectedWidth, expectedHeight), btn1.TextFormatter.Size);
 
         btn1.Dispose ();
@@ -204,7 +204,7 @@ public class ButtonTests (ITestOutputHelper output)
         Assert.Equal ('_', btn.HotKeySpecifier.Value);
         Assert.Equal (10, btn.TextFormatter.Format ().Length);
         Assert.Equal (new (10, 1), btn.TextFormatter.Size);
-        Assert.Equal (new (10, 1), btn.ContentSize);
+        Assert.Equal (new (10, 1), btn.GetContentSize ());
         Assert.Equal (new (0, 0, 10, 1), btn.Viewport);
         Assert.Equal (new (0, 0, 10, 1), btn.Frame);
         Assert.Equal (KeyCode.T, btn.HotKey);

+ 15 - 15
UnitTests/Views/ScrollViewTests.cs

@@ -12,14 +12,14 @@ public class ScrollViewTests
     public void Adding_Views ()
     {
         var sv = new ScrollView { Width = 20, Height = 10 };
-        sv.ContentSize = new (30, 20);
+        sv.SetContentSize (new (30, 20));
 
         sv.Add (
                 new View { Width = 10, Height = 5 },
                 new View { X = 12, Y = 7, Width = 10, Height = 5 }
                );
 
-        Assert.Equal (new (30, 20), sv.ContentSize);
+        Assert.Equal (new (30, 20), sv.GetContentSize ());
         Assert.Equal (2, sv.Subviews [0].Subviews.Count);
     }
 
@@ -187,7 +187,7 @@ public class ScrollViewTests
             Height = 10,
             KeepContentAlwaysInViewport = false
         };
-        sv.ContentSize = new (23, 23);
+        sv.SetContentSize (new (23, 23));
         var bottomLabel = new Label { X = 15, Y = 15, Text = "At 15,15" };
         var top = new Toplevel ();
         top.Add (topLabel, sv, bottomLabel);
@@ -346,7 +346,7 @@ public class ScrollViewTests
         Assert.Equal (new Rectangle (0, 0, 0, 0), sv.Frame);
         Assert.Equal (Rectangle.Empty, sv.Frame);
         Assert.Equal (Point.Empty, sv.ContentOffset);
-        Assert.Equal (Size.Empty, sv.ContentSize);
+        Assert.Equal (Size.Empty, sv.GetContentSize ());
         Assert.True (sv.AutoHideScrollBars);
         Assert.True (sv.KeepContentAlwaysInViewport);
 
@@ -355,7 +355,7 @@ public class ScrollViewTests
         Assert.True (sv.CanFocus);
         Assert.Equal (new Rectangle (1, 2, 20, 10), sv.Frame);
         Assert.Equal (Point.Empty, sv.ContentOffset);
-        Assert.Equal (sv.Viewport.Size, sv.ContentSize);
+        Assert.Equal (sv.Viewport.Size, sv.GetContentSize ());
         Assert.True (sv.AutoHideScrollBars);
         Assert.True (sv.KeepContentAlwaysInViewport);
     }
@@ -378,7 +378,7 @@ public class ScrollViewTests
             Height = 5,
             ColorScheme = new ColorScheme { Normal = new Attribute (Color.Red, Color.Green) }
         };
-        sv.ContentSize = size;
+        sv.SetContentSize (size);
         string text = null;
 
         for (var i = 0; i < size.Height; i++)
@@ -447,7 +447,7 @@ public class ScrollViewTests
         {
             Width = 10, Height = 10,
         };
-        sv.ContentSize = new (50, 50);
+        sv.SetContentSize (new (50, 50));
         sv.ContentOffset = new (25, 25);
 
         var top = new Toplevel ();
@@ -455,7 +455,7 @@ public class ScrollViewTests
         Application.Begin (top);
 
         Assert.Equal (new (-25, -25), sv.ContentOffset);
-        Assert.Equal (new (50, 50), sv.ContentSize);
+        Assert.Equal (new (50, 50), sv.GetContentSize ());
         Assert.True (sv.AutoHideScrollBars);
         Assert.True (sv.ShowHorizontalScrollIndicator);
         Assert.True (sv.ShowVerticalScrollIndicator);
@@ -482,14 +482,14 @@ public class ScrollViewTests
     public void ContentSize_AutoHideScrollBars_ShowHorizontalScrollIndicator_ShowVerticalScrollIndicator ()
     {
         var sv = new ScrollView { Width = 10, Height = 10, };
-        sv.ContentSize = new (50, 50);
+        sv.SetContentSize (new (50, 50));
 
         var top = new Toplevel ();
         top.Add (sv);
         Application.Begin (top);
 
-        Assert.Equal (50, sv.ContentSize.Width);
-        Assert.Equal (50, sv.ContentSize.Height);
+        Assert.Equal (50, sv.GetContentSize ().Width);
+        Assert.Equal (50, sv.GetContentSize ().Height);
         Assert.True (sv.AutoHideScrollBars);
         Assert.True (sv.ShowHorizontalScrollIndicator);
         Assert.True (sv.ShowVerticalScrollIndicator);
@@ -546,7 +546,7 @@ public class ScrollViewTests
             ShowHorizontalScrollIndicator = true,
             ShowVerticalScrollIndicator = true
         };
-        scrollView.ContentSize = size;
+        scrollView.SetContentSize (size);
         scrollView.Add (view);
         var win = new Window { X = 1, Y = 1, Width = 20, Height = 14 };
         win.Add (scrollView);
@@ -871,7 +871,7 @@ public class ScrollViewTests
             Width = 10,
             Height = 10,
         };
-        sv.ContentSize = new (50, 50);
+        sv.SetContentSize (new (50, 50));
 
         for (var i = 0; i < 8; i++)
         {
@@ -921,7 +921,7 @@ public class ScrollViewTests
     public void KeyBindings_Command ()
     {
         var sv = new ScrollView { Width = 20, Height = 10, };
-        sv.ContentSize = new (40, 20);
+        sv.SetContentSize (new (40, 20));
 
         sv.Add (
                 new View { Width = 20, Height = 5 },
@@ -1056,7 +1056,7 @@ public class ScrollViewTests
     public void Remove_Added_View_Is_Allowed ()
     {
         var sv = new ScrollView { Width = 20, Height = 20, };
-        sv.ContentSize = new (100, 100);
+        sv.SetContentSize (new (100, 100));
 
         sv.Add (
                 new View { Width = Dim.Fill (), Height = Dim.Fill (50), Id = "View1" },

+ 4 - 4
UnitTests/Views/SliderTests.cs

@@ -175,7 +175,7 @@ public class SliderTests
         // 0123456789
         // 1 2 3
         Assert.Equal (1, slider.MinimumInnerSpacing);
-        Assert.Equal (new Size (5, 2), slider.ContentSize);
+        Assert.Equal (new Size (5, 2), slider.GetContentSize ());
         Assert.Equal (new Size (5, 2), slider.Frame.Size);
         Assert.NotNull (slider);
         Assert.NotNull (slider.Options);
@@ -519,7 +519,7 @@ public class SliderTests
 
         Assert.Equal (new (6, 3), expectedSize);
 
-        view.ContentSize = new (1, 1);
+        view.SetContentSize (new (1, 1));
 
         view.LayoutSubviews ();
         slider.SetRelativeLayout (view.Viewport.Size);
@@ -552,7 +552,7 @@ public class SliderTests
 
         Assert.Equal (new (6, 10), expectedSize);
 
-        view.ContentSize = new (1, 1);
+        view.SetContentSize (new (1, 1));
 
         view.LayoutSubviews ();
         slider.SetRelativeLayout (view.Viewport.Size);
@@ -585,7 +585,7 @@ public class SliderTests
 
         Assert.Equal (new (10, 3), expectedSize);
 
-        view.ContentSize = new (1, 1);
+        view.SetContentSize (new (1, 1));
 
         view.LayoutSubviews ();
         slider.SetRelativeLayout (view.Viewport.Size);

+ 1 - 1
UnitTests/Views/ToplevelTests.cs

@@ -1321,7 +1321,7 @@ public class ToplevelTests
             Width = 40,
             Height = 16,
         };
-        scrollView.ContentSize = new (200, 100);
+        scrollView.SetContentSize (new (200, 100));
         var win = new Window { X = 3, Y = 3, Width = Dim.Fill (3), Height = Dim.Fill (3), Arrangement = ViewArrangement.Movable };
         scrollView.Add (win);
         Toplevel top = new ();

+ 2 - 2
docfx/docs/dimauto.md

@@ -7,7 +7,7 @@ Like all `Dim` types, `Dim.Auto` is used to set the `Width` or `Height` of a vie
 The `DimAutoStyle` enum defines the different ways that `Dim.Auto` can be used to size a view. The `DimAutoStyle` enum has the following values:
 
 * `Text` - The view is sized based on the `Text` property and `TextFormatter` settings.
-* `Content` - The view is sized based on either the `ContentSize` or the `Subviews` property. If `ContentSize` is not explicitly set (via `View.SetContentSize()`), the view is sized based on the Subview with the largest relvant dimension plus location. If `ContentSize` is explicitly set, the view is sized based on the `ContentSize`.
+* `Content` - The view is sized based on either the value returned by `View.SetContentSize()` or the `Subviews` property. If the content size is not explicitly set (via `View.SetContentSize()`), the view is sized based on the Subview with the largest relvant dimension plus location. If the content size is explicitly set, the view is sized based on the value returned by `View.SetContentSize()`.
 * `Auto` -  The view is sized based on both the text and content, whichever is larger.
 
 ## Using Dim.Auto
@@ -113,6 +113,6 @@ view.Add (slider);
 
 Note the developer does not need to specify the size of the `Slider`, it will size itself based on the number of options and the orientation. 
 
-Views like `Slider` do this by setting `Width` and `Height` to `Dim.Auto (DimAutoStyle.Content)` in the constructor and calling `SetContentSize ()` whenever the desired content size changes. The View will then be sized to be big enough to fit the content.
+Views like `Slider` do this by setting `Width` and `Height` to `Dim.Auto (DimAutoStyle.Content)` in the constructor and calling `SetContentSize()` whenever the desired content size changes. The View will then be sized to be big enough to fit the content.
 
 Views that use `Text` for their content can just set `Width` and `Height` to `Dim.Auto (DimAutoStyle.Text)`. It is recommended to use `Height = Dim.Auto (DimAutoStyle.Text, minimumContentDim: 1)` to ensure the View can show at least one line of text.

+ 7 - 15
docfx/docs/layout.md

@@ -7,22 +7,22 @@ Terminal.Gui provides a rich system for how `View` objects are laid out relative
 * **Screen-Relative** - Describes the dimensions and characteristics of the underlying terminal. Currently Terminal.Gui only supports applications that run "full-screen", meaning they fill the entire terminal when running. As the user resizes their terminal, the `Screen` changes size and the applicaiton will be resized to fit. *Screen-Relative* means an origin (`0, 0`) at the top-left corner of the terminal. `ConsoleDriver`s operate exclusively on *Screen-Relative* coordinates.
 * **Application.Relative** - The dimensions and characteristics of the application. Because only full-screen apps are currently supported, `Application` is effectively the same as `Screen` from a layout perspective. *Application-Relative* currently means an origin (`0, 0`) at the top-left corner of the terminal. `Applicaiton.Top` is a `View` with a top-left corner fixed at the *Application.Relative* coordinate of (`0, 0`) and is the size of `Screen`.
 * **Frame-Relative**  - The `Frame` property of a `View` is a rectangle that describes the current location and size of the view relative to the `Superview`'s content area. *Frame-Relative* means a coordinate is relative to the top-left corner of the View in question. `View.FrameToScreen ()` and `View.ScreenToFrame ()` are helper methods for translating a *Frame-Relative* coordinate to a *Screen-Relative* coordinate and vice-versa.
-* **Content-Relative** - A rectangle, with an origin of (`0, 0`) and size (defined by `View.ContentSize`) where the View's content exists. *Content-Relative* means a coordinate is relative to the top-left corner of the content, which is always (`0,0`). `View.ContentToScreen ()` and `View.ScreenToContent ()` are helper methods for translating a *Content-Relative* coordinate to a *Screen-Relative* coordinate and vice-versa.
-* **Viewport-Relative** - A *Content-Relative* rectangle representing the subset of the View's content that is visible to the user. If `View.ContentSize` is larger than the Viewport, scrolling is enabled. *Viewport-Relative* means a coordinate that is bound by (`0,0`) and the size of the inner-rectangle of the View's `Padding`. The View drawing primitives (e.g. `View.Move`) take *Viewport-Relative* coordinates; `Move (0, 0)` means the `Cell` in the top-left corner of the inner rectangle of `Padding`. `View.ViewportToScreen ()` and `View.ScreenToViewport ()` are helper methods for translating a *Viewport-Relative* coordinate to a *Screen-Relative* coordinate and vice-versa. To convert a *Viewport-Relative* coordinate to a *Content-Relative* coordinate, simply subtract `Viewport.X` and/or `Viewport.Y` from the *Content-Relative* coordinate. To convert a *Viewport-Relative* coordinate to a *Frame-Relative* coordinate, subtract the point returned by `View.GetViewportOffsetFromFrame`.
+* **Content-Relative** - A rectangle, with an origin of (`0, 0`) and size (defined by `View.GetContentSize()`) where the View's content exists. *Content-Relative* means a coordinate is relative to the top-left corner of the content, which is always (`0,0`). `View.ContentToScreen ()` and `View.ScreenToContent ()` are helper methods for translating a *Content-Relative* coordinate to a *Screen-Relative* coordinate and vice-versa.
+* **Viewport-Relative** - A *Content-Relative* rectangle representing the subset of the View's content that is visible to the user. If `View.GetContentSize()` is larger than the Viewport, scrolling is enabled. *Viewport-Relative* means a coordinate that is bound by (`0,0`) and the size of the inner-rectangle of the View's `Padding`. The View drawing primitives (e.g. `View.Move`) take *Viewport-Relative* coordinates; `Move (0, 0)` means the `Cell` in the top-left corner of the inner rectangle of `Padding`. `View.ViewportToScreen ()` and `View.ScreenToViewport ()` are helper methods for translating a *Viewport-Relative* coordinate to a *Screen-Relative* coordinate and vice-versa. To convert a *Viewport-Relative* coordinate to a *Content-Relative* coordinate, simply subtract `Viewport.X` and/or `Viewport.Y` from the *Content-Relative* coordinate. To convert a *Viewport-Relative* coordinate to a *Frame-Relative* coordinate, subtract the point returned by `View.GetViewportOffsetFromFrame`.
 
 ## The Frame
 
-The `Frame` property of a `View` is a rectangle that describes the current location and size of the view relative to the `Superview`'s content area. The `Frame`  has a `Location` and `Size`. The `Location` describes the top-left corner of the view relative to the `Superview`'s content area. The `Size` describes the width and height of the view. The `Frame` is used to determine where the view is drawn on the screen and is used to calculate the `Viewport` and `ContentSize`.
+The `Frame` property of a `View` is a rectangle that describes the current location and size of the view relative to the `Superview`'s content area. The `Frame`  has a `Location` and `Size`. The `Location` describes the top-left corner of the view relative to the `Superview`'s content area. The `Size` describes the width and height of the view. The `Frame` is used to determine where the view is drawn on the screen and is used to calculate the Viewport and content size.
 
 ## The Content Area
 
- The content area is the area where the view's content is drawn. Content can be any combination of the `View.Text` property, `Subviews`, and other content drawn by the View. The `View.ContentSize` property gets the size of the content area of the view. *Content Area* refers to the rectangle with a location of `0,0` with a size of `ContentSize`.
+ The content area is the area where the view's content is drawn. Content can be any combination of the `View.Text` property, `Subviews`, and other content drawn by the View. The `View.GetContentSize()` property gets the size of the content area of the view. *Content Area* refers to the rectangle with a location of `0,0` with a size of `ContentSize`.
 
- `ContentSize` tracks the size of the `Viewport` by default. If `ContentSize` is set via `SetContentSize()`, the content area is the provided size. If `ContentSize` is larger than the `Viewport`, scrolling is enabled. 
+ The Content size tracks the size of the `Viewport` by default. If the content size is set via `SetContentSize()`, the content area is the provided size. If the content size is larger than the `Viewport`, scrolling is enabled. 
 
 ## The Viewport
 
-The Viewport (`View.Viewport`) is a rectangle describing the portion of the *Content Area* that is currently visible to the user. It is a "portal" into the content. The `Viewport.Location` is relative to the top-left corner of the inner rectangle of `View.Padding`. If `Viewport.Size` is the same as `View.ContentSize`, `Viewport.Location` will be `0,0`. 
+The Viewport (`View.Viewport`) is a rectangle describing the portion of the *Content Area* that is currently visible to the user. It is a "portal" into the content. The `Viewport.Location` is relative to the top-left corner of the inner rectangle of `View.Padding`. If `Viewport.Size` is the same as `View.GetContentSize()`, `Viewport.Location` will be `0,0`. 
 
 To enable scrolling call `View.SetContentSize()` and then set `Viewport.Location` to positive values. Making `Viewport.Location` positive moves the Viewport down and to the right in the content. 
 
@@ -32,17 +32,11 @@ The default `ViewportSettings` also constrains the Viewport to the size of the c
 
 ## Layout
 
-Terminal.Gui provides a rich system for how views are laid out relative to each other. **Computed Layout** means the position and size of a View is being computed by the layout engine. **Absolute Layout** means the position and size of a View has been declared to be an absolute values. The position of a view is set by setting the `X` and `Y` properties, which are of time [Pos](~/api/Terminal.Gui.Pos.yml). The size is set via `Width` and `Height`, which are of type [Dim](~/api/Terminal.Gui.Dim.yml).
-
-* **Computed Layout** supports dynamic console apps where UI elements (Views) automatically adjust as the terminal resizes or other Views change size or position. The X, Y, Width, and Height properties are Dim and Pos objects that dynamically update the position of a view.
-
-* **Absolute Layout** requires specifying coordinates and sizes of Views explicitly, and the View will typically stay in a fixed position and size.
+Terminal.Gui provides a rich system for how views are laid out relative to each other. The position of a view is set by setting the `X` and `Y` properties, which are of time [Pos](~/api/Terminal.Gui.Pos.yml). The size is set via `Width` and `Height`, which are of type [Dim](~/api/Terminal.Gui.Dim.yml).
 
 ```cs
-// Absolute layout using a absoulte values for X, Y, Width, and Height
 var label1 = new Label () { X = 1, Y = 2, Width = 3, Height = 4, Title = "Absolute")
 
-// Computed Layout using Pos and Dim objects for X, Y, Width, and Height
 var label2 = new Label () {
     Title = "Computed",
     X = Pos.Right (otherView),
@@ -54,8 +48,6 @@ var label2 = new Label () {
 
 The `Frame` property is a rectangle that provides the current location and size of the view relative to the View's `Superview`'s Content area. 
 
-The `View.LayoutStyle` property can be used to determine how the View is treated. If the style is `Absolute`, the `X`, `Y`, `Width`, and `Height` objects are all absolute values. If the style is `Computed`, one or more of the `X`, `Y`, `Width`, and `Height` objects describe a computed value.
-
 ## The `Pos` Type
 
 The [Pos](~/api/Terminal.Gui.Pos.yml) is the type of `View.X` and `View.Y` and supports the following sub-types:

+ 5 - 5
docfx/docs/migratingfromv1.md

@@ -117,7 +117,7 @@ In v2, the layout system has been improved to make it easier to create complex u
 
 * [View.Frame](~/api/Terminal.Gui.View.Frame.yml) now represents the position and size of the view in the superview's coordinate system. The `Frame` property is of type `Rectangle`.
 * [View.Bounds](~/api/Terminal.Gui.View.Bounds.yml) has been replaced by [View.Viewport](~/api/Terminal.Gui.View.Viewport.yml). The `Viewport` property represents the visible area of the view in its own coordinate system. The `Viewport` property is of type `Rectangle`.
-* [View.ContentSize](~/api/Terminal.Gui.View.ContentSize.yml) represents the size of the view's content. The `ContentSize` property is of type `Size`. This replaces `ScrollView` and `ScrollBarView` in v1. See more below.
+* [View.GetContentSize()](~/api/Terminal.Gui.View.GetContentSize.yml) represents the size of the view's content. This replaces `ScrollView` and `ScrollBarView` in v1. See more below.
 
 ### How to Fix
 
@@ -125,7 +125,7 @@ In v2, the layout system has been improved to make it easier to create complex u
 
 * Rename `Bounds` to `Viewport`. The `Location` property of `Bounds` can now have non-zero values.
 * Update any code that assumed `Bounds.Location` was always `Point.Empty`.
-* Update any code that used `Bounds` to refer to the size of the view's content. Use `ContentSize` instead.
+* Update any code that used `Bounds` to refer to the size of the view's content. Use `GetContentSize()` instead.
 * Update any code that assumed `Bounds.Size` was the same as `Frame.Size`. `Frame.Size` defines the size of the view in the superview's coordinate system, while `Viewport.Size` defines the visible area of the view in its own coordinate system.
 * Use [View.GetAdornmentsThickness](~/api/Terminal.Gui.View.GetAdornmentsThickness.yml) to get the total thickness of the view's border, margin, and padding.
 * Not assume a View can draw outside of 'Viewport'. Use the 'Margin', 'Border', and 'Padding' Adornments to do things outside of `Viewport`. View subclasses should not implement their own concept of padding or margins but leverage these `Adornments` instead. 
@@ -149,13 +149,13 @@ In v2, the `Border`, `Margin`, and `Padding` properties have been added to all v
 
 ## Built-in Scrolling
 
-In v1, scrolling was enabled by using `ScrollView` or `ScrollBarView`. In v2, the base [View](~/api/Terminal.Gui.View.yml) class supports scrolling inherently. The area of a view visible to the user at a given moment was previously a rectangle called `Bounds`. `Bounds.Location` was always `Point.Empty`. In v2 the visible area is a rectangle called `Viewport` which is a protal into the Views content, which can be bigger (or smaller) than the area visible to the user. Causing a view to scroll is as simple as changing `View.Viewport.Location`. The View's content described by [View.ContentSize](~/api/Terminal.Gui.View.ContentSize.yml). See [Layout](layout.md) for details.
+In v1, scrolling was enabled by using `ScrollView` or `ScrollBarView`. In v2, the base [View](~/api/Terminal.Gui.View.yml) class supports scrolling inherently. The area of a view visible to the user at a given moment was previously a rectangle called `Bounds`. `Bounds.Location` was always `Point.Empty`. In v2 the visible area is a rectangle called `Viewport` which is a protal into the Views content, which can be bigger (or smaller) than the area visible to the user. Causing a view to scroll is as simple as changing `View.Viewport.Location`. The View's content described by [View.GetContentSize()](~/api/Terminal.Gui.View.GetContentSize.yml). See [Layout](layout.md) for details.
 
 ### How to Fix
 
-* Replace `ScrollView` with [View](~/api/Terminal.Gui.View.yml) and use the `Viewport` and `ContentSize` properties to control scrolling.
+* Replace `ScrollView` with [View](~/api/Terminal.Gui.View.yml) and use `Viewport` and [View.GetContentSize()](~/api/Terminal.Gui.View.GetContentSize.yml) to control scrolling.
 * Update any code that assumed `Bounds.Location` was always `Point.Empty`.
-* Update any code that used `Bounds` to refer to the size of the view's content. Use `ContentSize` instead.
+* Update any code that used `Bounds` to refer to the size of the view's content. Use [View.GetContentSize()](~/api/Terminal.Gui.View.GetContentSize.yml) instead.
 * Update any code that assumed `Bounds.Size` was the same as `Frame.Size`. `Frame.Size` defines the size of the view in the superview's coordinate system, while `Viewport.Size` defines the visible area of the view in its own coordinate system.
 
 ## Updated Keyboard API

+ 1 - 1
docfx/docs/newinv2.md

@@ -24,7 +24,7 @@ The entire library has been reviewed and simplified. As a result, the API is mor
   * In v1, `View` was derived from `Responder` which supported `IDisposable`. In v2, `Responder` has been removed and `View` is the base-class supporting `IDisposable`. 
   * `Application.Init` no longer automatically creates a toplevel or sets `Applicaton.Top`; app developers must explicitly create the toplevel view and pass it to `Appliation.Run` (or use `Application.Run<myTopLevel>`). Developers are responsible for calling `Dispose` on any toplevel they create before exiting. 
 * New! *Adornments* -  Adornments are a special form of View that appear outside the `Viewport`: `Margin`, `Border`, and `Padding`.
-* New! *Built-in Scrolling/Virtual Content Area* - In v1, to have a view a user could scroll required either a bespoke scrolling implementation, inheriting from `ScrollView`, or managing the complexity of `ScrollBarView` directly. In v2, the base-View class supports scrolling inherently. The area of a view visible to the user at a given moment was previously a rectangle called `Bounds`. `Bounds.Location` was always `Point.Empty`. In v2 the visible area is a rectangle called `Viewport` which is a protal into the Views content, which can be bigger (or smaller) than the area visible to the user. Causing a view to scroll is as simple as changing `View.Viewport.Location`. The View's content described by `View.ContentSize`. See [Layout](layout.md) for details.
+* New! *Built-in Scrolling/Virtual Content Area* - In v1, to have a view a user could scroll required either a bespoke scrolling implementation, inheriting from `ScrollView`, or managing the complexity of `ScrollBarView` directly. In v2, the base-View class supports scrolling inherently. The area of a view visible to the user at a given moment was previously a rectangle called `Bounds`. `Bounds.Location` was always `Point.Empty`. In v2 the visible area is a rectangle called `Viewport` which is a protal into the Views content, which can be bigger (or smaller) than the area visible to the user. Causing a view to scroll is as simple as changing `View.Viewport.Location`. The View's content described by `View.GetContentSize()`. See [Layout](layout.md) for details.
 * New! *`Dim.Auto`* - Automatically sizes the view to fitthe view's Text, SubViews, or ContentArea.
 * Improved! *`Pos.AnchorEnd ()`* - New to v2 is `Pos.AnchorEnd ()` (with no parameters) which allows a view to be anchored to the right or bottom of the Superview. 
 * New! *`Pos.Align ()`* - Aligns a set of views horizontally or vertically (left, rigth, center, etc...).