using System;
namespace Spectre.Console.Rendering
{
///
/// Contains extension methods for .
///
public static class PanelExtensions
{
///
/// Sets the panel header.
///
/// The panel.
/// The header text.
/// The header style.
/// The header alignment.
/// The same instance so that multiple calls can be chained.
public static Panel SetHeader(this Panel panel, string text, Style? style = null, Justify? alignment = null)
{
if (panel is null)
{
throw new ArgumentNullException(nameof(panel));
}
if (text is null)
{
throw new ArgumentNullException(nameof(text));
}
return SetHeader(panel, new Header(text, style, alignment));
}
///
/// Sets the panel header.
///
/// The panel.
/// The header to use.
/// The same instance so that multiple calls can be chained.
public static Panel SetHeader(this Panel panel, Header header)
{
if (panel is null)
{
throw new ArgumentNullException(nameof(panel));
}
panel.Header = header;
return panel;
}
}
}