Files
spectre.console/src/Spectre.Console/Widgets/GridColumn.cs
Patrik Svensson 7d6104ace4 Add padder widget
This commit adds a padder can be use to pad other IRenderable
objects such as tables, panels, grids, text, etc.
2020-09-17 10:58:50 +02:00

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);
}
}
}