|
@@ -98,100 +98,6 @@ public class Border : Adornment
|
|
|
}
|
|
|
set => _lineStyle = value;
|
|
|
}
|
|
|
-
|
|
|
- /// <summary>Draws a frame in the current view, clipped by the boundary of this view</summary>
|
|
|
- /// <param name="region">View-relative region for the frame to be drawn.</param>
|
|
|
- /// <param name="clear">If set to <see langword="true"/> it clear the region.</param>
|
|
|
- [Obsolete ("This method is obsolete in v2. Use use LineCanvas or Frame instead.", false)]
|
|
|
- public void DrawFrame (Rectangle region, bool clear)
|
|
|
- {
|
|
|
- Rectangle savedClip = ClipToBounds ();
|
|
|
- Rectangle screenBounds = BoundsToScreen (region);
|
|
|
-
|
|
|
- if (clear)
|
|
|
- {
|
|
|
- Driver.FillRect (region);
|
|
|
- }
|
|
|
-
|
|
|
- var lc = new LineCanvas ();
|
|
|
- bool drawTop = region.Width > 1 && region.Height > 1;
|
|
|
- bool drawLeft = region.Width > 1 && region.Height > 1;
|
|
|
- bool drawBottom = region.Width > 1 && region.Height > 1;
|
|
|
- bool drawRight = region.Width > 1 && region.Height > 1;
|
|
|
-
|
|
|
- if (drawTop)
|
|
|
- {
|
|
|
- lc.AddLine (screenBounds.Location, screenBounds.Width, Orientation.Horizontal, LineStyle);
|
|
|
- }
|
|
|
-
|
|
|
- if (drawLeft)
|
|
|
- {
|
|
|
- lc.AddLine (screenBounds.Location, screenBounds.Height, Orientation.Vertical, LineStyle);
|
|
|
- }
|
|
|
-
|
|
|
- if (drawBottom)
|
|
|
- {
|
|
|
- lc.AddLine (
|
|
|
- new Point (screenBounds.X, screenBounds.Y + screenBounds.Height - 1),
|
|
|
- screenBounds.Width,
|
|
|
- Orientation.Horizontal,
|
|
|
- LineStyle
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- if (drawRight)
|
|
|
- {
|
|
|
- lc.AddLine (
|
|
|
- new Point (screenBounds.X + screenBounds.Width - 1, screenBounds.Y),
|
|
|
- screenBounds.Height,
|
|
|
- Orientation.Vertical,
|
|
|
- LineStyle
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- foreach (KeyValuePair<Point, Rune> p in lc.GetMap ())
|
|
|
- {
|
|
|
- Driver.Move (p.Key.X, p.Key.Y);
|
|
|
- Driver.AddRune (p.Value);
|
|
|
- }
|
|
|
-
|
|
|
- lc.Clear ();
|
|
|
-
|
|
|
- // TODO: This should be moved to LineCanvas as a new BorderStyle.Ruler
|
|
|
- if ((ConsoleDriver.Diagnostics & ConsoleDriver.DiagnosticFlags.FrameRuler)
|
|
|
- == ConsoleDriver.DiagnosticFlags.FrameRuler)
|
|
|
- {
|
|
|
- // Top
|
|
|
- var hruler = new Ruler { Length = screenBounds.Width, Orientation = Orientation.Horizontal };
|
|
|
-
|
|
|
- if (drawTop)
|
|
|
- {
|
|
|
- hruler.Draw (new Point (screenBounds.X, screenBounds.Y));
|
|
|
- }
|
|
|
-
|
|
|
- //Left
|
|
|
- var vruler = new Ruler { Length = screenBounds.Height - 2, Orientation = Orientation.Vertical };
|
|
|
-
|
|
|
- if (drawLeft)
|
|
|
- {
|
|
|
- vruler.Draw (new Point (screenBounds.X, screenBounds.Y + 1), 1);
|
|
|
- }
|
|
|
-
|
|
|
- // Bottom
|
|
|
- if (drawBottom)
|
|
|
- {
|
|
|
- hruler.Draw (new Point (screenBounds.X, screenBounds.Y + screenBounds.Height - 1));
|
|
|
- }
|
|
|
-
|
|
|
- // Right
|
|
|
- if (drawRight)
|
|
|
- {
|
|
|
- vruler.Draw (new Point (screenBounds.X + screenBounds.Width - 1, screenBounds.Y + 1), 1);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- Driver.Clip = savedClip;
|
|
|
- }
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
public override void OnDrawContent (Rectangle contentArea)
|