using System; using Spectre.Console.Rendering; namespace Spectre.Console { /// /// Represents a table column. /// public sealed class TableColumn : IColumn { /// /// Gets the column header. /// public IRenderable Header { get; } /// /// Gets or sets the column footer. /// public IRenderable? Footer { get; set; } /// /// Gets or sets the width of the column. /// If null, the column will adapt to it's contents. /// public int? Width { get; set; } /// /// Gets or sets the padding of the column. /// Vertical padding (top and bottom) is ignored. /// public Padding? Padding { get; set; } /// /// Gets or sets a value indicating whether wrapping of /// text within the column should be prevented. /// public bool NoWrap { get; set; } /// /// Gets or sets the alignment of the column. /// public Justify? Alignment { get; set; } /// /// Initializes a new instance of the class. /// /// The table column header. public TableColumn(string header) : this(new Markup(header).Overflow(Overflow.Ellipsis)) { } /// /// Initializes a new instance of the class. /// /// The instance to use as the table column header. public TableColumn(IRenderable header) { Header = header ?? throw new ArgumentNullException(nameof(header)); Width = null; Padding = new Padding(1, 0, 1, 0); NoWrap = false; Alignment = null; } } }