Addressed review feedback

This commit is contained in:
Tig
2024-08-18 17:27:20 -06:00
parent 34773a4d07
commit 34b33e1ca4
4 changed files with 13 additions and 37 deletions

View File

@@ -11,11 +11,6 @@ namespace Terminal.Gui;
/// <param name="Margin">The margin to not fill.</param>
public record DimFill (int Margin) : Dim
{
/// <summary>
/// Gets the margin to not fill.
/// </summary>
public int Margin { get; } = Margin;
/// <inheritdoc/>
public override string ToString () { return $"Fill({Margin})"; }

View File

@@ -8,19 +8,16 @@ namespace Terminal.Gui;
/// This is a low-level API that is typically used internally by the layout system. Use the various static
/// methods on the <see cref="Gui.Dim"/> class to create <see cref="Gui.Dim"/> objects instead.
/// </remarks>
/// <param name="Dim"></param>
public record DimFunc (Func<int> Dim) : Dim
/// <param name="Fn">The function that computes the dimension.</param>
public record DimFunc (Func<int> Fn) : Dim
{
/// <summary>
/// Gets the function that computes the dimension.
/// </summary>
public new Func<int> Func { get; } = Dim;
public Func<int> Fn { get; } = Fn;
/// <inheritdoc/>
public override int GetHashCode () { return Func.GetHashCode (); }
public override string ToString () { return $"DimFunc({Fn ()})"; }
/// <inheritdoc/>
public override string ToString () { return $"DimFunc({Func ()})"; }
internal override int GetAnchor (int size) { return Func (); }
internal override int GetAnchor (int size) { return Fn (); }
}

View File

@@ -8,29 +8,24 @@ namespace Terminal.Gui;
/// This is a low-level API that is typically used internally by the layout system. Use the various static
/// methods on the <see cref="Dim"/> class to create <see cref="Dim"/> objects instead.
/// </remarks>
/// <param name="Percent">The percentage.</param>
/// <param name="Percentage">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.GetContentSize ()"/>.
/// </param>
public record DimPercent (int Percent, DimPercentMode Mode = DimPercentMode.ContentSize) : Dim
public record DimPercent (int Percentage, DimPercentMode Mode = DimPercentMode.ContentSize) : Dim
{
/// <summary>
/// Gets the percentage.
/// </summary>
public new int Percent { get; } = Percent;
/// <summary>
/// </summary>
/// <returns></returns>
public override string ToString () { return $"Percent({Percent},{Mode})"; }
public override string ToString () { return $"Percent({Percentage},{Mode})"; }
/// <summary>
/// Gets whether the dimension is computed using the View's position or GetContentSize ().
/// </summary>
public DimPercentMode Mode { get; } = Mode;
internal override int GetAnchor (int size) { return (int)(size * (Percent / 100f)); }
internal override int GetAnchor (int size) { return (int)(size * (Percentage / 100f)); }
internal override int Calculate (int location, int superviewContentSize, View us, Dimension dimension)
{

View File

@@ -4,22 +4,11 @@ namespace Terminal.Gui;
/// <summary>
/// Represents a position that is computed by executing a function that returns an integer position.
/// </summary>
/// <remarks>
/// <para>
/// This is a low-level API that is typically used internally by the layout system. Use the various static
/// methods on the <see cref="Gui.Pos"/> class to create <see cref="Gui.Pos"/> objects instead.
/// </para>
/// </remarks>
/// <param name="Pos">The position.</param>
public record PosFunc (Func<int> Pos) : Pos
/// <param name="Pos">The function that computes the position.</param>
public record PosFunc (Func<int> Fn) : Pos
{
/// <summary>
/// Gets the function that computes the position.
/// </summary>
public new Func<int> Func { get; } = Pos;
/// <inheritdoc/>
public override string ToString () { return $"PosFunc({Func ()})"; }
public override string ToString () { return $"PosFunc({Fn ()})"; }
internal override int GetAnchor (int size) { return Func (); }
internal override int GetAnchor (int size) { return Fn (); }
}