Class SeparatorControl
- Namespace
- SharpConsoleUI.Controls
- Assembly
- SharpConsoleUI.dll
A simple vertical separator control for visually dividing UI elements. Unlike SplitterControl, this is non-interactive and non-focusable. Uses a single vertical line character for a subtle appearance.
public class SeparatorControl : BaseControl, IWindowControl, IDisposable, IDOMPaintable, INotifyPropertyChanged
- Inheritance
-
SeparatorControl
- Implements
- Inherited Members
- Extension Methods
Constructors
SeparatorControl()
Initializes a new instance of the SeparatorControl class.
public SeparatorControl()
Properties
BackgroundColor
Gets or sets the background color of the separator. When null, inherits from the container.
public Color? BackgroundColor { get; set; }
Property Value
Character
Gets or sets the character used to draw the separator. Defaults to '│' (single vertical line).
public char Character { get; set; }
Property Value
Container
Gets or sets the parent container that hosts this control.
public override IContainer? Container { get; set; }
Property Value
ContentWidth
Gets the minimum width needed to display the control's content, including margins. Returns null if width cannot be determined. This is calculated based on content (text length, child controls, etc.) and represents the natural/intrinsic size.
public override int? ContentWidth { get; }
Property Value
- int?
ForegroundColor
Gets or sets the foreground color of the separator. When null, uses theme's SeparatorForegroundColor, then falls back to container color.
public Color? ForegroundColor { get; set; }
Property Value
Width
Gets or sets the explicit width of the control, or null for automatic sizing.
public override int? Width { get; set; }
Property Value
- int?
Methods
GetLogicalContentSize()
Gets the logical size of the control's content without rendering.
public override Size GetLogicalContentSize()
Returns
- Size
The size representing the content's natural dimensions.
MeasureDOM(LayoutConstraints)
Measures the control's desired size given the available constraints.
public override LayoutSize MeasureDOM(LayoutConstraints constraints)
Parameters
constraintsLayoutConstraintsThe layout constraints (min/max width/height).
Returns
- LayoutSize
The desired size of the control.
PaintDOM(CharacterBuffer, LayoutRect, LayoutRect, Color, Color)
Paints the control's content directly to a CharacterBuffer.
public override void PaintDOM(CharacterBuffer buffer, LayoutRect bounds, LayoutRect clipRect, Color defaultFg, Color defaultBg)
Parameters
bufferCharacterBufferThe buffer to paint to.
boundsLayoutRectThe absolute bounds where the control should paint.
clipRectLayoutRectThe clipping rectangle (visible area).
defaultFgColordefaultBgColor