DimFill.cs 1001 B

1234567891011121314151617181920212223242526272829
  1. #nullable enable
  2. namespace Terminal.Gui;
  3. /// <summary>
  4. /// Represents a dimension that fills the dimension, leaving the specified margin.
  5. /// </summary>
  6. /// <remarks>
  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. /// </remarks>
  10. /// <param name="margin">The margin to not fill.</param>
  11. public class DimFill (int margin) : Dim
  12. {
  13. /// <inheritdoc/>
  14. public override bool Equals (object? other) { return other is DimFill fill && fill.Margin == Margin; }
  15. /// <inheritdoc/>
  16. public override int GetHashCode () { return Margin.GetHashCode (); }
  17. /// <summary>
  18. /// Gets the margin to not fill.
  19. /// </summary>
  20. public int Margin { get; } = margin;
  21. /// <inheritdoc/>
  22. public override string ToString () { return $"Fill({Margin})"; }
  23. internal override int GetAnchor (int size) { return size - Margin; }
  24. }