Files
Terminal.Gui/Terminal.Gui/View/Layout/PosFunc.cs
2024-08-14 13:06:15 -06:00

25 lines
851 B
C#

#nullable enable
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
{
/// <summary>
/// Gets the function that computes the position.
/// </summary>
public new Func<int> Func { get; } = Pos;
/// <inheritdoc/>
public override string ToString () { return $"PosFunc({Func ()})"; }
internal override int GetAnchor (int size) { return Func (); }
}