Class LayoutRequirements
- Namespace
- SharpConsoleUI.Core
- Assembly
- SharpConsoleUI.dll
Controls express sizing and alignment needs via this record. Single source of truth for all layout-related information.
public record LayoutRequirements : IEquatable<LayoutRequirements>
- Inheritance
-
LayoutRequirements
- Implements
- Inherited Members
Fields
Default
Default layout requirements with no fixed dimensions and left alignment.
public static readonly LayoutRequirements Default
Field Value
Properties
EffectiveMaxHeight
Effective maximum height (defaults to int.MaxValue if null)
public int EffectiveMaxHeight { get; }
Property Value
EffectiveMaxWidth
Effective maximum width (defaults to int.MaxValue if null)
public int EffectiveMaxWidth { get; }
Property Value
EffectiveMinHeight
Effective minimum height (defaults to 1 if null)
public int EffectiveMinHeight { get; }
Property Value
EffectiveMinWidth
Effective minimum width (defaults to 1 if null)
public int EffectiveMinWidth { get; }
Property Value
FlexFactor
Flex factor for proportional sizing when Width is null (1.0 = equal share)
public double FlexFactor { get; init; }
Property Value
Height
Fixed height (null = flexible)
public int? Height { get; init; }
Property Value
- int?
HorizontalAlignment
Horizontal alignment within allocated space
public HorizontalAlignment HorizontalAlignment { get; init; }
Property Value
IsFixed
True if this has a fixed width (Width is set)
public bool IsFixed { get; }
Property Value
IsStretch
True if this should expand to fill available space
public bool IsStretch { get; }
Property Value
MaxHeight
Maximum height constraint (null = unlimited)
public int? MaxHeight { get; init; }
Property Value
- int?
MaxWidth
Maximum width constraint (null = unlimited)
public int? MaxWidth { get; init; }
Property Value
- int?
MinHeight
Minimum height constraint (null = no minimum)
public int? MinHeight { get; init; }
Property Value
- int?
MinWidth
Minimum width constraint (null = no minimum, defaults to 1 during layout)
public int? MinWidth { get; init; }
Property Value
- int?
VerticalAlignment
Vertical alignment within allocated space
public VerticalAlignment VerticalAlignment { get; init; }
Property Value
Width
Fixed width (null = flexible, uses available space)
public int? Width { get; init; }
Property Value
- int?
Methods
ClampHeight(int)
Clamps a height value to the min/max constraints
public int ClampHeight(int height)
Parameters
heightint
Returns
ClampWidth(int)
Clamps a width value to the min/max constraints
public int ClampWidth(int width)
Parameters
widthint
Returns
Fixed(int, HorizontalAlignment)
Creates fixed-width requirements
public static LayoutRequirements Fixed(int width, HorizontalAlignment alignment = HorizontalAlignment.Left)
Parameters
widthintalignmentHorizontalAlignment
Returns
Fixed(int, int, HorizontalAlignment, VerticalAlignment)
Creates fixed-size requirements
public static LayoutRequirements Fixed(int width, int height, HorizontalAlignment horizontalAlignment = HorizontalAlignment.Left, VerticalAlignment verticalAlignment = VerticalAlignment.Top)
Parameters
widthintheightinthorizontalAlignmentHorizontalAlignmentverticalAlignmentVerticalAlignment
Returns
Flexible(int?, int?, HorizontalAlignment)
Creates flexible requirements with optional constraints
public static LayoutRequirements Flexible(int? minWidth = null, int? maxWidth = null, HorizontalAlignment alignment = HorizontalAlignment.Left)
Parameters
minWidthint?maxWidthint?alignmentHorizontalAlignment
Returns
Stretch()
Creates stretch requirements (expands to fill available space)
public static LayoutRequirements Stretch()