using System;
namespace Spectre.Console
{
///
/// Represents a header.
///
public sealed class PanelHeader : IAlignable
{
///
/// Gets the header text.
///
public string Text { get; }
///
/// Gets or sets the header style.
///
public Style? Style { get; set; }
///
/// Gets or sets the header alignment.
///
public Justify? Alignment { get; set; }
///
/// Initializes a new instance of the class.
///
/// The header text.
/// The header style.
/// The header alignment.
public PanelHeader(string text, Style? style = null, Justify? alignment = null)
{
Text = text ?? throw new ArgumentNullException(nameof(text));
Style = style;
Alignment = alignment;
}
///
/// Sets the header style.
///
/// The header style.
/// The same instance so that multiple calls can be chained.
public PanelHeader SetStyle(Style? style)
{
Style = style ?? Style.Plain;
return this;
}
///
/// Sets the header alignment.
///
/// The header alignment.
/// The same instance so that multiple calls can be chained.
public PanelHeader SetAlignment(Justify alignment)
{
Alignment = alignment;
return this;
}
}
}