namespace Spectre.Console.Extensions; /// /// Contains extension methods for . /// public static class AlignExtensions { /// /// Sets the width. /// /// The object. /// The width, or null for no explicit width. /// The same instance so that multiple calls can be chained. public static Align Width(this Align align, int? width) { if (align is null) { throw new ArgumentNullException(nameof(align)); } align.Width = width; return align; } /// /// Sets the height. /// /// The object. /// The height, or null for no explicit height. /// The same instance so that multiple calls can be chained. public static Align Height(this Align align, int? height) { if (align is null) { throw new ArgumentNullException(nameof(align)); } align.Height = height; return align; } /// /// Sets the vertical alignment. /// /// The object. /// The vertical alignment, or null for no vertical alignment. /// The same instance so that multiple calls can be chained. public static Align VerticalAlignment(this Align align, VerticalAlignment? vertical) { if (align is null) { throw new ArgumentNullException(nameof(align)); } align.Vertical = vertical; return align; } /// /// Sets the object to be top aligned. /// /// The object. /// The same instance so that multiple calls can be chained. public static Align TopAligned(this Align align) { if (align is null) { throw new ArgumentNullException(nameof(align)); } align.Vertical = Console.VerticalAlignment.Top; return align; } /// /// Sets the object to be middle aligned. /// /// The object. /// The same instance so that multiple calls can be chained. public static Align MiddleAligned(this Align align) { if (align is null) { throw new ArgumentNullException(nameof(align)); } align.Vertical = Console.VerticalAlignment.Middle; return align; } /// /// Sets the object to be bottom aligned. /// /// The object. /// The same instance so that multiple calls can be chained. public static Align BottomAligned(this Align align) { if (align is null) { throw new ArgumentNullException(nameof(align)); } align.Vertical = Console.VerticalAlignment.Bottom; return align; } }