浏览代码

API doc updates

Tig 1 年之前
父节点
当前提交
465c04f59f

+ 25 - 13
Terminal.Gui/View/Layout/ViewLayout.cs

@@ -43,10 +43,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 <see cref="Viewport"/>.
+    ///     <see cref="SuperView"/>'s Content, which is bound by <see cref="ContentSize"/>.
     /// </value>
     /// <remarks>
-    ///     <para>Frame is relative to the <see cref="SuperView"/>'s <see cref="Viewport"/>.</para>
+    ///     <para>Frame is relative to the <see cref="SuperView"/>'s Content, which is bound by <see cref="ContentSize"/>.</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.
@@ -99,7 +99,7 @@ public partial class View
                 return ret;
             }
 
-            Point viewportOffset = super.GetViewportOffset ();
+            Point viewportOffset = super.GetViewportOffsetFromFrame ();
             viewportOffset.Offset (super.Frame.X - super.Viewport.X, super.Frame.Y - super.Viewport.Y);
             ret.X += viewportOffset.X;
             ret.Y += viewportOffset.Y;
@@ -117,7 +117,7 @@ public partial class View
     /// <param name="y">Screen-relative row.</param>
     public virtual Point ScreenToFrame (int x, int y)
     {
-        Point superViewViewportOffset = SuperView?.GetViewportOffset () ?? Point.Empty;
+        Point superViewViewportOffset = SuperView?.GetViewportOffsetFromFrame () ?? Point.Empty;
 
         if (SuperView is null)
         {
@@ -138,13 +138,16 @@ 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"/>.
+    ///     </para>
+    ///     <para>
     ///         If set to a relative value (e.g. <see cref="Pos.Center"/>) the value is indeterminate until the view has been
-    ///         initialized ( <see cref="IsInitialized"/> is true) and <see cref="SetRelativeLayout(Rectangle)"/> has been
+    ///         initialized ( <see cref="IsInitialized"/> is true) and <see cref="SetRelativeLayout(Size)"/> has been
     ///         called.
     ///     </para>
     ///     <para>
     ///         Changing this property will eventually (when the view is next drawn) cause the
-    ///         <see cref="LayoutSubview(View, Rectangle)"/> and <see cref="OnDrawContent(Rectangle)"/> methods to be called.
+    ///         <see cref="LayoutSubview(View, Size)"/> and <see cref="OnDrawContent(Rectangle)"/> methods to be called.
     ///     </para>
     ///     <para>
     ///         Changing this property will cause <see cref="Frame"/> to be updated. If the new value is not of type
@@ -168,13 +171,16 @@ 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"/>.
+    ///     </para>
+    ///     <para>
     ///         If set to a relative value (e.g. <see cref="Pos.Center"/>) the value is indeterminate until the view has been
-    ///         initialized ( <see cref="IsInitialized"/> is true) and <see cref="SetRelativeLayout(Rectangle)"/> has been
+    ///         initialized ( <see cref="IsInitialized"/> is true) and <see cref="SetRelativeLayout(Size)"/> has been
     ///         called.
     ///     </para>
     ///     <para>
     ///         Changing this property will eventually (when the view is next drawn) cause the
-    ///         <see cref="LayoutSubview(View, Rectangle)"/> and <see cref="OnDrawContent(Rectangle)"/> methods to be called.
+    ///         <see cref="LayoutSubview(View, Size)"/> and <see cref="OnDrawContent(Rectangle)"/> methods to be called.
     ///     </para>
     ///     <para>
     ///         Changing this property will cause <see cref="Frame"/> to be updated. If the new value is not of type
@@ -198,13 +204,16 @@ 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"/>.
+    ///     </para>
+    ///     <para>
     ///         If set to a relative value (e.g. <see cref="Dim.Fill(int)"/>) the value is indeterminate until the view has
-    ///         been initialized ( <see cref="IsInitialized"/> is true) and <see cref="SetRelativeLayout(Rectangle)"/> has been
+    ///         been initialized ( <see cref="IsInitialized"/> is true) and <see cref="SetRelativeLayout(Size)"/> has been
     ///         called.
     ///     </para>
     ///     <para>
     ///         Changing this property will eventually (when the view is next drawn) cause the
-    ///         <see cref="LayoutSubview(View, Rectangle)"/> and <see cref="OnDrawContent(Rectangle)"/> methods to be called.
+    ///         <see cref="LayoutSubview(View, Size)"/> and <see cref="OnDrawContent(Rectangle)"/> methods to be called.
     ///     </para>
     ///     <para>
     ///         Changing this property will cause <see cref="Frame"/> to be updated. If the new value is not of type
@@ -245,13 +254,16 @@ 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"/>.
+    ///     </para>
+    ///     <para>
     ///         If set to a relative value (e.g. <see cref="Dim.Fill(int)"/>) the value is indeterminate until the view has
-    ///         been initialized ( <see cref="IsInitialized"/> is true) and <see cref="SetRelativeLayout(Rectangle)"/> has been
+    ///         been initialized ( <see cref="IsInitialized"/> is true) and <see cref="SetRelativeLayout(Size)"/> has been
     ///         called.
     ///     </para>
     ///     <para>
     ///         Changing this property will eventually (when the view is next drawn) cause the
-    ///         <see cref="LayoutSubview(View, Rectangle)"/> and <see cref="OnDrawContent(Rectangle)"/> methods to be called.
+    ///         <see cref="LayoutSubview(View, Size)"/> and <see cref="OnDrawContent(Rectangle)"/> methods to be called.
     ///     </para>
     ///     <para>
     ///         Changing this property will cause <see cref="Frame"/> to be updated. If the new value is not of type
@@ -583,7 +595,7 @@ public partial class View
             found = start.Padding;
         }
 
-        Point viewportOffset = start.GetViewportOffset ();
+        Point viewportOffset = start.GetViewportOffsetFromFrame ();
 
         if (found is { })
         {

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

@@ -342,7 +342,7 @@ public partial class View
         return Enabled ? cs.Normal : cs.Disabled;
     }
 
-    /// <summary>Moves the drawing cursor to the specified view-relative column and row in the view.</summary>
+    /// <summary>Moves the drawing cursor to the specified <see cref="Viewport"/>-relative location in the view.</summary>
     /// <remarks>
     ///     <para>
     ///         If the provided coordinates are outside the visible content area, this method does nothing.
@@ -402,7 +402,7 @@ public partial class View
     ///         <see cref="Viewport"/> property.
     ///     </para>
     ///     <para>
-    ///         The <see cref="Viewport"/> Location and Size indicate what part of the View's virtual content area, defined
+    ///         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
     ///         <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>.
@@ -412,8 +412,8 @@ public partial class View
     ///         to constrain drawing for better performance.
     ///     </para>
     ///     <para>
-    ///         The <see cref="Clip"/> may define smaller area than <see cref="Viewport"/>; complex drawing code can be more
-    ///         efficient by using <see cref="Clip"/> to constrain drawing for better performance.
+    ///         The <see cref="ConsoleDriver.Clip"/> may define smaller area than <see cref="Viewport"/>; complex drawing code can be more
+    ///         efficient by using <see cref="ConsoleDriver.Clip"/> to constrain drawing for better performance.
     ///     </para>
     ///     <para>
     ///         Overrides should loop through the subviews and call <see cref="Draw"/>.

+ 7 - 7
Terminal.Gui/View/ViewScrolling.cs

@@ -55,7 +55,7 @@ public partial class View
     public Point ContentToScreen (in Point location)
     {
         // Translate to Viewport
-        Point viewportOffset = GetViewportOffset ();
+        Point viewportOffset = GetViewportOffsetFromFrame ();
         Point contentRelativeToViewport = location;
         contentRelativeToViewport.Offset (-Viewport.X, -Viewport.Y);
 
@@ -74,7 +74,7 @@ public partial class View
     /// <returns>The coordinate relative to this view's Content.</returns>
     public Point ScreenToContent (int x, int y)
     {
-        Point viewportOffset = GetViewportOffset ();
+        Point viewportOffset = GetViewportOffsetFromFrame ();
         Point screen = ScreenToFrame (x, y);
         screen.Offset (Viewport.X - viewportOffset.X, Viewport.Y - viewportOffset.Y);
 
@@ -94,9 +94,9 @@ public partial class View
 
     /// <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 the <see cref="Adornment"/>s.
+    ///     The viewport Location is relative to the top-left corner of the inner rectangle of <see cref="Padding"/>s.
     ///     If the viewport Size is the sames as the <see cref="ContentSize"/> the Location will be <c>0, 0</c>.
-    ///     Non-zero values for the location indicate the visible area is offset into the View's virtual
+    ///     Positive values for the location indicate the visible area is offset into the View's virtual
     ///     <see cref="ContentSize"/>.
     /// </summary>
     /// <value>
@@ -175,7 +175,7 @@ public partial class View
     {
         // Translate bounds to Frame (our SuperView's Viewport-relative coordinates)
         Rectangle screen = FrameToScreen ();
-        Point viewportOffset = GetViewportOffset ();
+        Point viewportOffset = GetViewportOffsetFromFrame ();
         screen.Offset (viewportOffset.X + location.X, viewportOffset.Y + location.Y);
 
         return new (screen.Location, location.Size);
@@ -190,7 +190,7 @@ public partial class View
     /// <param name="y">Row relative to the top of the Viewport</param>
     public Point ScreenToViewport (int x, int y)
     {
-        Point viewportOffset = GetViewportOffset ();
+        Point viewportOffset = GetViewportOffsetFromFrame ();
         Point screen = ScreenToFrame (x, y);
         screen.Offset (-viewportOffset.X, -viewportOffset.Y);
 
@@ -201,7 +201,7 @@ public partial class View
     ///     Helper to get the X and Y offset of the Viewport from the Frame. This is the sum of the Left and Top properties
     ///     of <see cref="Margin"/>, <see cref="Border"/> and <see cref="Padding"/>.
     /// </summary>
-    public Point GetViewportOffset () { return Padding is null ? Point.Empty : Padding.Thickness.GetInside (Padding.Frame).Location; }
+    public Point GetViewportOffsetFromFrame () { return Padding is null ? Point.Empty : Padding.Thickness.GetInside (Padding.Frame).Location; }
 
     /// <summary>
     ///     Scrolls the view vertically by the specified number of rows.

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

@@ -823,7 +823,7 @@ public class MenuBar : View
 
         Rectangle superViewFrame = SuperView is null ? Driver.Viewport : SuperView.Frame;
         View sv = SuperView is null ? Application.Current : SuperView;
-        Point viewportOffset = sv.GetViewportOffset ();
+        Point viewportOffset = sv.GetViewportOffsetFromFrame ();
 
         return new (
                     superViewFrame.X - sv.Frame.X - viewportOffset.X,
@@ -840,7 +840,7 @@ public class MenuBar : View
     {
         Rectangle screen = Driver.Viewport;
         Rectangle currentFrame = Application.Current.Frame;
-        Point viewportOffset = Application.Top.GetViewportOffset ();
+        Point viewportOffset = Application.Top.GetViewportOffsetFromFrame ();
 
         return new (screen.X - currentFrame.X - viewportOffset.X, screen.Y - currentFrame.Y - viewportOffset.Y);
     }

+ 1 - 1
UICatalog/Scenarios/ViewExperiments.cs

@@ -225,7 +225,7 @@ public class ViewExperiments : Scenario
                                        } .Viewport: {
                                            view.Viewport
                                        } .viewportOffset: {
-                                           view.GetViewportOffset ()
+                                           view.GetViewportOffsetFromFrame ()
                                        }\n .Padding.Frame: {
                                            view.Padding.Frame
                                        } .Padding.Viewport: {

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

@@ -253,7 +253,7 @@ public class ViewportTests (ITestOutputHelper output)
         view.EndInit ();
         view.Margin.Thickness = new (adornmentThickness);
 
-        Assert.Equal (expectedOffset, view.GetViewportOffset ().X);
+        Assert.Equal (expectedOffset, view.GetViewportOffsetFromFrame ().X);
     }
 
     [Fact]