Class RuleControl
- Namespace
- SharpConsoleUI.Controls
- Assembly
- SharpConsoleUI.dll
A control that renders a horizontal rule (divider line) with optional title text. Renders directly to CharacterBuffer using BoxChars.
public class RuleControl : BaseControl, IWindowControl, IDisposable, IDOMPaintable, INotifyPropertyChanged
- Inheritance
-
RuleControl
- Implements
- Inherited Members
- Extension Methods
Constructors
RuleControl()
Initializes a new instance of the RuleControl class.
public RuleControl()
Properties
BorderStyle
Gets or sets the border style for the rule line characters.
public BorderStyle BorderStyle { get; set; }
Property Value
Color
Gets or sets the color of the rule line.
public Color? Color { 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?
Title
Gets or sets the title text displayed within the rule.
public string? Title { get; set; }
Property Value
TitleAlignment
Gets or sets the horizontal alignment of the title within the rule.
public TextJustification TitleAlignment { get; set; }
Property Value
Methods
Create()
Creates a new builder for configuring a RuleControl
public static RuleBuilder Create()
Returns
- RuleBuilder
A new builder instance
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