DimAbsolute.cs 906 B

1234567891011121314151617181920212223242526272829
  1. namespace Terminal.Gui.ViewBase;
  2. /// <summary>
  3. /// Represents a dimension that is a fixed size.
  4. /// </summary>
  5. /// <remarks>
  6. /// <para>
  7. /// This is a low-level API that is typically used internally by the layout system. Use the various static
  8. /// methods on the <see cref="Dim"/> class to create <see cref="Dim"/> objects instead.
  9. /// </para>
  10. /// </remarks>
  11. /// <param name="Size"></param>
  12. public record DimAbsolute (int Size) : Dim
  13. {
  14. /// <summary>
  15. /// Gets the size of the dimension.
  16. /// </summary>
  17. public int Size { get; } = Size;
  18. /// <inheritdoc/>
  19. public override string ToString () { return $"Absolute({Size})"; }
  20. internal override int GetAnchor (int size) { return Size; }
  21. internal override int Calculate (int location, int superviewContentSize, View us, Dimension dimension)
  22. {
  23. return Math.Max (GetAnchor (0), 0);
  24. }
  25. }