mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-19 21:38:16 +08:00

This commit adds a padder can be use to pad other IRenderable objects such as tables, panels, grids, text, etc.
56 lines
1.5 KiB
C#
56 lines
1.5 KiB
C#
namespace Spectre.Console
|
|
{
|
|
/// <summary>
|
|
/// Represents a grid column.
|
|
/// </summary>
|
|
public sealed class GridColumn : IColumn
|
|
{
|
|
private Padding _padding;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the width of the column.
|
|
/// If <c>null</c>, the column will adapt to it's contents.
|
|
/// </summary>
|
|
public int? Width { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets a value indicating whether wrapping of
|
|
/// text within the column should be prevented.
|
|
/// </summary>
|
|
public bool NoWrap { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the padding of the column.
|
|
/// Vertical padding (top and bottom) is ignored.
|
|
/// </summary>
|
|
public Padding Padding
|
|
{
|
|
get => _padding;
|
|
set
|
|
{
|
|
HasExplicitPadding = true;
|
|
_padding = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets or sets the alignment of the column.
|
|
/// </summary>
|
|
public Justify? Alignment { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets a value indicating whether the user
|
|
/// has set an explicit padding for this column.
|
|
/// </summary>
|
|
internal bool HasExplicitPadding { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="GridColumn"/> class.
|
|
/// </summary>
|
|
public GridColumn()
|
|
{
|
|
_padding = new Padding(0, 0, 2, 0);
|
|
}
|
|
}
|
|
}
|