PosAbsolute.cs 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. #nullable enable
  2. namespace Terminal.Gui;
  3. /// <summary>
  4. /// Represents an absolute position in the layout. This is used to specify a fixed position in the layout.
  5. /// </summary>
  6. /// <remarks>
  7. /// <para>
  8. /// This is a low-level API that is typically used internally by the layout system. Use the various static
  9. /// methods on the <see cref="Pos"/> class to create <see cref="Pos"/> objects instead.
  10. /// </para>
  11. /// </remarks>
  12. /// <param name="position"></param>
  13. public class PosAbsolute (int position) : Pos
  14. {
  15. /// <summary>
  16. /// The position of the <see cref="View"/> in the layout.
  17. /// </summary>
  18. public int Position { get; } = position;
  19. /// <inheritdoc/>
  20. public override bool Equals (object? other) { return other is PosAbsolute abs && abs.Position == Position; }
  21. /// <inheritdoc/>
  22. public override int GetHashCode () { return Position.GetHashCode (); }
  23. /// <inheritdoc/>
  24. public override string ToString () { return $"Absolute({Position})"; }
  25. internal override int GetAnchor (int size) { return Position; }
  26. }