PosFunc.cs 510 B

1234567891011121314
  1. #nullable enable
  2. namespace Terminal.Gui;
  3. /// <summary>
  4. /// Represents a position that is computed by executing a function that returns an integer position.
  5. /// </summary>
  6. /// <param name="Fn">The function that computes the dimension. If this function throws <see cref="LayoutException"/>... </param>
  7. public record PosFunc (Func<int> Fn) : Pos
  8. {
  9. /// <inheritdoc/>
  10. public override string ToString () { return $"PosFunc({Fn ()})"; }
  11. internal override int GetAnchor (int size) { return Fn (); }
  12. }