mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2026-02-10 04:13:32 +01:00
* Revertf6e1368: "Fixes problems with extension blocks and params keyword" * Revert7965168: "Add modernization commit to .git-blame-ignore-revs" * Revert3f57df5: "Modernization of the code base"
58 lines
1.6 KiB
C#
58 lines
1.6 KiB
C#
namespace Spectre.Console;
|
|
|
|
/// <summary>
|
|
/// Contains extension methods for <see cref="Layout"/>.
|
|
/// </summary>
|
|
public static class LayoutExtensions
|
|
{
|
|
/// <summary>
|
|
/// Sets the ratio of the layout.
|
|
/// </summary>
|
|
/// <param name="layout">The layout.</param>
|
|
/// <param name="ratio">The ratio.</param>
|
|
/// <returns>The same instance so that multiple calls can be chained.</returns>
|
|
public static Layout Ratio(this Layout layout, int ratio)
|
|
{
|
|
if (layout is null)
|
|
{
|
|
throw new ArgumentNullException(nameof(layout));
|
|
}
|
|
|
|
layout.Ratio = ratio;
|
|
return layout;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sets the size of the layout.
|
|
/// </summary>
|
|
/// <param name="layout">The layout.</param>
|
|
/// <param name="size">The size.</param>
|
|
/// <returns>The same instance so that multiple calls can be chained.</returns>
|
|
public static Layout Size(this Layout layout, int size)
|
|
{
|
|
if (layout is null)
|
|
{
|
|
throw new ArgumentNullException(nameof(layout));
|
|
}
|
|
|
|
layout.Size = size;
|
|
return layout;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sets the minimum width of the layout.
|
|
/// </summary>
|
|
/// <param name="layout">The layout.</param>
|
|
/// <param name="size">The size.</param>
|
|
/// <returns>The same instance so that multiple calls can be chained.</returns>
|
|
public static Layout MinimumSize(this Layout layout, int size)
|
|
{
|
|
if (layout is null)
|
|
{
|
|
throw new ArgumentNullException(nameof(layout));
|
|
}
|
|
|
|
layout.MinimumSize = size;
|
|
return layout;
|
|
}
|
|
} |