namespace Terminal.Gui;
/// Draws a single line using the specified by .
public class Line : View
{
/// Constructs a Line object.
public Line ()
{
BorderStyle = LineStyle.Single;
Border.Thickness = new Thickness (0);
}
///
/// The direction of the line. If you change this you will need to manually update the Width/Height of the
/// control to cover a relevant area based on the new direction.
///
public Orientation Orientation { get; set; }
///
public override void OnDrawContent (Rectangle viewport)
{
LineCanvas lc = LineCanvas;
if (SuperView is Adornment adornment)
{
lc = adornment.Parent.LineCanvas;
}
lc.AddLine (
ViewportToScreen (viewport).Location,
Orientation == Orientation.Horizontal ? Frame.Width : Frame.Height,
Orientation,
BorderStyle
);
}
}