Răsfoiți Sursa

better names and API docs

Tig 9 luni în urmă
părinte
comite
a93d1ceeb7
64 a modificat fișierele cu 514 adăugiri și 482 ștergeri
  1. 1 1
      Terminal.Gui/Text/Autocomplete/PopupAutocomplete.PopUp.cs
  2. 17 8
      Terminal.Gui/View/Adornment/Adornment.cs
  3. 1 1
      Terminal.Gui/View/Adornment/Border.cs
  4. 1 1
      Terminal.Gui/View/Adornment/Margin.cs
  5. 2 2
      Terminal.Gui/View/Adornment/ShadowView.cs
  6. 4 2
      Terminal.Gui/View/DrawEventArgs.cs
  7. 120 0
      Terminal.Gui/View/View.Color.cs
  8. 1 1
      Terminal.Gui/View/View.Content.cs
  9. 280 379
      Terminal.Gui/View/View.Drawing.cs
  10. 1 1
      Terminal.Gui/View/ViewportSettings.cs
  11. 1 1
      Terminal.Gui/Views/ColorBar.cs
  12. 2 2
      Terminal.Gui/Views/ColorPicker.16.cs
  13. 1 1
      Terminal.Gui/Views/ColorPicker.cs
  14. 4 4
      Terminal.Gui/Views/ComboBox.cs
  15. 1 1
      Terminal.Gui/Views/FileDialog.cs
  16. 4 4
      Terminal.Gui/Views/GraphView/Annotations.cs
  17. 1 1
      Terminal.Gui/Views/GraphView/GraphView.cs
  18. 1 1
      Terminal.Gui/Views/HexView.cs
  19. 1 1
      Terminal.Gui/Views/Line.cs
  20. 1 1
      Terminal.Gui/Views/LineView.cs
  21. 1 1
      Terminal.Gui/Views/ListView.cs
  22. 1 1
      Terminal.Gui/Views/Menu/Menu.cs
  23. 1 1
      Terminal.Gui/Views/Menu/MenuBar.cs
  24. 1 1
      Terminal.Gui/Views/NumericUpDown.cs
  25. 1 1
      Terminal.Gui/Views/ProgressBar.cs
  26. 1 1
      Terminal.Gui/Views/RadioGroup.cs
  27. 2 2
      Terminal.Gui/Views/ScrollBarView.cs
  28. 2 2
      Terminal.Gui/Views/ScrollView.cs
  29. 2 2
      Terminal.Gui/Views/Slider.cs
  30. 4 4
      Terminal.Gui/Views/TabView.cs
  31. 1 1
      Terminal.Gui/Views/TableView/ListTableSource.cs
  32. 1 1
      Terminal.Gui/Views/TableView/TableView.cs
  33. 1 1
      Terminal.Gui/Views/TextField.cs
  34. 1 1
      Terminal.Gui/Views/TextValidateField.cs
  35. 1 1
      Terminal.Gui/Views/TextView.cs
  36. 4 4
      Terminal.Gui/Views/TileView.cs
  37. 1 1
      Terminal.Gui/Views/TreeView/TreeView.cs
  38. 1 1
      UICatalog/Scenarios/AnimationScenario/AnimationScenario.cs
  39. 2 2
      UICatalog/Scenarios/CharacterMap.cs
  40. 1 1
      UICatalog/Scenarios/ColorPicker.cs
  41. 1 1
      UICatalog/Scenarios/CsvEditor.cs
  42. 1 1
      UICatalog/Scenarios/Editor.cs
  43. 1 1
      UICatalog/Scenarios/Images.cs
  44. 2 2
      UICatalog/Scenarios/LineDrawing.cs
  45. 1 1
      UICatalog/Scenarios/ListColumns.cs
  46. 1 1
      UICatalog/Scenarios/ListViewWithSelection.cs
  47. 2 2
      UICatalog/Scenarios/ListsAndCombos.cs
  48. 2 2
      UICatalog/Scenarios/Snake.cs
  49. 1 1
      UICatalog/Scenarios/SyntaxHighlighting.cs
  50. 1 1
      UICatalog/Scenarios/TableEditor.cs
  51. 1 1
      UICatalog/Scenarios/Text.cs
  52. 1 1
      UICatalog/Scenarios/TextEffectsScenario.cs
  53. 5 5
      UICatalog/Scenarios/TextViewAutocompletePopup.cs
  54. 1 1
      UICatalog/Scenarios/TreeViewFileSystem.cs
  55. 1 1
      UICatalog/Scenarios/Wizards.cs
  56. 2 2
      UnitTests/Application/ApplicationTests.cs
  57. 2 2
      UnitTests/Input/ResponderTests.cs
  58. 1 1
      UnitTests/UICatalog/ScenarioTests.cs
  59. 2 2
      UnitTests/View/Draw/DrawTests.cs
  60. 1 1
      UnitTests/View/Layout/LayoutTests.cs
  61. 1 1
      UnitTests/View/TextTests.cs
  62. 3 3
      UnitTests/View/ViewTests.cs
  63. 1 1
      UnitTests/Views/LabelTests.cs
  64. 4 4
      UnitTests/Views/ScrollBarViewTests.cs

+ 1 - 1
Terminal.Gui/Text/Autocomplete/PopupAutocomplete.PopUp.cs

@@ -15,7 +15,7 @@ public abstract partial class PopupAutocomplete
 
         private readonly PopupAutocomplete _autoComplete;
 
-        protected override bool OnDrawContent (Rectangle viewport)
+        protected override bool OnDrawingContent (Rectangle viewport)
         {
             if (!_autoComplete.LastPopupPos.HasValue)
             {

+ 17 - 8
Terminal.Gui/View/Adornment/Adornment.cs

@@ -157,11 +157,16 @@ public class Adornment : View, IDesignable
 
     /// <summary>Does nothing for Adornment</summary>
     /// <returns></returns>
-    protected override bool OnDrawAdornments () { return false; }
+    protected override bool OnDrawingAdornments () { return false; }
 
     /// <inheritdoc/>
-    protected override bool OnClearViewport (Rectangle viewport)
+    protected override bool OnClearingViewport (Rectangle viewport)
     {
+        if (Thickness == Thickness.Empty)
+        {
+            return true;
+        }
+
         Attribute normalAttr = GetNormalColor ();
         Driver?.SetAttribute (normalAttr);
 
@@ -172,14 +177,20 @@ public class Adornment : View, IDesignable
     }
 
     /// <inheritdoc />
-    protected override bool OnDrawSubviews (Rectangle viewport)
+    protected override bool OnDrawingText (Rectangle viewport)
     {
-        return false;
+        return Thickness == Thickness.Empty;
+    }
+
+    /// <inheritdoc />
+    protected override bool OnDrawingSubviews (Rectangle viewport)
+    {
+        return Thickness == Thickness.Empty;
     }
 
     /// <summary>Does nothing for Adornment</summary>
     /// <returns></returns>
-    protected override bool OnRenderLineCanvas () { return true; }
+    protected override bool OnRenderingLineCanvas () { return true; }
 
     /// <summary>
     ///     Adornments only render to their <see cref="Parent"/>'s or Parent's SuperView's LineCanvas, so setting this
@@ -194,9 +205,7 @@ public class Adornment : View, IDesignable
     /// <inheritdoc />
     protected override bool OnDrawComplete (Rectangle viewport)
     {
-
-
-        return false;
+        return Thickness == Thickness.Empty;
     }
 
     /// <summary>

+ 1 - 1
Terminal.Gui/View/Adornment/Border.cs

@@ -606,7 +606,7 @@ public class Border : Adornment
     #endregion Mouse Support
 
     /// <inheritdoc/>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         if (Thickness == Thickness.Empty)
         {

+ 1 - 1
Terminal.Gui/View/Adornment/Margin.cs

@@ -68,7 +68,7 @@ public class Margin : Adornment
     }
 
     /// <inheritdoc />
-    protected override bool OnClearViewport (Rectangle viewport)
+    protected override bool OnClearingViewport (Rectangle viewport)
     {
         if (Thickness == Thickness.Empty)
         {

+ 2 - 2
Terminal.Gui/View/Adornment/ShadowView.cs

@@ -37,14 +37,14 @@ internal class ShadowView : View
     }
 
     /// <inheritdoc />
-    protected override bool OnClearViewport (Rectangle viewport)
+    protected override bool OnClearingViewport (Rectangle viewport)
     {
         // Prevent clearing (so we can have transparency)
         return true;
     }
 
     /// <inheritdoc/>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         switch (ShadowStyle)
         {

+ 4 - 2
Terminal.Gui/View/DrawEventArgs.cs

@@ -1,7 +1,9 @@
-namespace Terminal.Gui;
+using System.ComponentModel;
+
+namespace Terminal.Gui;
 
 /// <summary>Event args for draw events</summary>
-public class DrawEventArgs : EventArgs
+public class DrawEventArgs : CancelEventArgs
 {
     /// <summary>Creates a new instance of the <see cref="DrawEventArgs"/> class.</summary>
     /// <param name="newViewport">

+ 120 - 0
Terminal.Gui/View/View.Color.cs

@@ -0,0 +1,120 @@
+namespace Terminal.Gui;
+
+public partial class View
+{
+    private ColorScheme _colorScheme;
+
+    /// <summary>The color scheme for this view, if it is not defined, it returns the <see cref="SuperView"/>'s color scheme.</summary>
+    public virtual ColorScheme ColorScheme
+    {
+        get
+        {
+            if (_colorScheme is null)
+            {
+                return SuperView?.ColorScheme;
+            }
+
+            return _colorScheme;
+        }
+        set
+        {
+            if (_colorScheme != value)
+            {
+                _colorScheme = value;
+
+                if (Border is { } && Border.LineStyle != LineStyle.None && Border.ColorScheme is { })
+                {
+                    Border.ColorScheme = _colorScheme;
+                }
+
+                SetNeedsDisplay ();
+            }
+        }
+    }
+
+    /// <summary>Determines the current <see cref="ColorScheme"/> based on the <see cref="Enabled"/> value.</summary>
+    /// <returns>
+    ///     <see cref="ColorScheme.Focus"/> if <see cref="Enabled"/> is <see langword="true"/> or
+    ///     <see cref="ColorScheme.Disabled"/> if <see cref="Enabled"/> is <see langword="false"/>. If it's
+    ///     overridden can return other values.
+    /// </returns>
+    public virtual Attribute GetFocusColor ()
+    {
+        ColorScheme cs = ColorScheme;
+
+        if (cs is null)
+        {
+            cs = new ();
+        }
+
+        return Enabled ? GetColor (cs.Focus) : cs.Disabled;
+    }
+
+    /// <summary>Determines the current <see cref="ColorScheme"/> based on the <see cref="Enabled"/> value.</summary>
+    /// <returns>
+    ///     <see cref="ColorScheme.Focus"/> if <see cref="Enabled"/> is <see langword="true"/> or
+    ///     <see cref="ColorScheme.Disabled"/> if <see cref="Enabled"/> is <see langword="false"/>. If it's
+    ///     overridden can return other values.
+    /// </returns>
+    public virtual Attribute GetHotFocusColor ()
+    {
+        ColorScheme cs = ColorScheme ?? new ();
+
+        return Enabled ? GetColor (cs.HotFocus) : cs.Disabled;
+    }
+
+    /// <summary>Determines the current <see cref="ColorScheme"/> based on the <see cref="Enabled"/> value.</summary>
+    /// <returns>
+    ///     <see cref="Terminal.Gui.ColorScheme.HotNormal"/> if <see cref="Enabled"/> is <see langword="true"/> or
+    ///     <see cref="Terminal.Gui.ColorScheme.Disabled"/> if <see cref="Enabled"/> is <see langword="false"/>. If it's
+    ///     overridden can return other values.
+    /// </returns>
+    public virtual Attribute GetHotNormalColor ()
+    {
+        ColorScheme cs = ColorScheme;
+
+        if (cs is null)
+        {
+            cs = new ();
+        }
+
+        return Enabled ? GetColor (cs.HotNormal) : cs.Disabled;
+    }
+
+    /// <summary>Determines the current <see cref="ColorScheme"/> based on the <see cref="Enabled"/> value.</summary>
+    /// <returns>
+    ///     <see cref="Terminal.Gui.ColorScheme.Normal"/> if <see cref="Enabled"/> is <see langword="true"/> or
+    ///     <see cref="Terminal.Gui.ColorScheme.Disabled"/> if <see cref="Enabled"/> is <see langword="false"/>. If it's
+    ///     overridden can return other values.
+    /// </returns>
+    public virtual Attribute GetNormalColor ()
+    {
+        ColorScheme cs = ColorScheme;
+
+        if (cs is null)
+        {
+            cs = new ();
+        }
+
+        Attribute disabled = new (cs.Disabled.Foreground, cs.Disabled.Background);
+
+        if (Diagnostics.HasFlag (ViewDiagnosticFlags.Hover) && _hovering)
+        {
+            disabled = new (disabled.Foreground.GetDarkerColor (), disabled.Background.GetDarkerColor ());
+        }
+
+        return Enabled ? GetColor (cs.Normal) : disabled;
+    }
+
+    private Attribute GetColor (Attribute inputAttribute)
+    {
+        Attribute attr = inputAttribute;
+
+        if (Diagnostics.HasFlag (ViewDiagnosticFlags.Hover) && _hovering)
+        {
+            attr = new (attr.Foreground.GetDarkerColor (), attr.Background.GetDarkerColor ());
+        }
+
+        return attr;
+    }
+}

+ 1 - 1
Terminal.Gui/View/View.Content.cs

@@ -265,7 +265,7 @@ public partial class View
     ///     </para>
     ///     <para>
     ///         Altering the Viewport Size will eventually (when the view is next laid out) cause the
-    ///         <see cref="Layout"/> and <see cref="OnDrawContent(Rectangle)"/> methods to be called.
+    ///         <see cref="Layout"/> and <see cref="OnDrawingContent"/> methods to be called.
     ///     </para>
     /// </remarks>
     public virtual Rectangle Viewport

+ 280 - 379
Terminal.Gui/View/View.Drawing.cs

@@ -1,52 +1,40 @@
 #nullable enable
 using System.Diagnostics;
-using System.Reflection.Metadata;
 
 namespace Terminal.Gui;
 
 public partial class View // Drawing APIs
 {
-    private ColorScheme? _colorScheme;
+    #region Drawing Primitives
 
-    /// <summary>The color scheme for this view, if it is not defined, it returns the <see cref="SuperView"/>'s color scheme.</summary>
-    public virtual ColorScheme? ColorScheme
+    /// <summary>Moves the drawing cursor to the specified <see cref="Viewport"/>-relative location in the view.</summary>
+    /// <remarks>
+    ///     <para>
+    ///         If the provided coordinates are outside the visible content area, this method does nothing.
+    ///     </para>
+    ///     <para>
+    ///         The top-left corner of the visible content area is <c>ViewPort.Location</c>.
+    ///     </para>
+    /// </remarks>
+    /// <param name="col">Column (viewport-relative).</param>
+    /// <param name="row">Row (viewport-relative).</param>
+    public bool Move (int col, int row)
     {
-        get
+        if (Driver is null || Driver?.Rows == 0)
         {
-            if (_colorScheme is null)
-            {
-                return SuperView?.ColorScheme;
-            }
-
-            return _colorScheme;
+            return false;
         }
-        set
-        {
-            if (_colorScheme != value)
-            {
-                _colorScheme = value;
 
-                if (Border is { } && Border.LineStyle != LineStyle.None && Border.ColorScheme is { })
-                {
-                    Border.ColorScheme = _colorScheme;
-                }
-
-                SetNeedsDisplay ();
-            }
+        if (col < 0 || row < 0 || col >= Viewport.Width || row >= Viewport.Height)
+        {
+            return false;
         }
-    }
 
-    /// <summary>The canvas that any line drawing that is to be shared by subviews of this view should add lines to.</summary>
-    /// <remarks><see cref="Border"/> adds border lines to this LineCanvas.</remarks>
-    public LineCanvas LineCanvas { get; } = new ();
+        Point screen = ViewportToScreen (new Point (col, row));
+        Driver?.Move (screen.X, screen.Y);
 
-    /// <summary>
-    ///     Gets or sets whether this View will use it's SuperView's <see cref="LineCanvas"/> for rendering any
-    ///     lines. If <see langword="true"/> the rendering of any borders drawn by this Frame will be done by its parent's
-    ///     SuperView. If <see langword="false"/> (the default) this View's <see cref="OnDrawAdornments"/> method will be
-    ///     called to render the borders.
-    /// </summary>
-    public virtual bool SuperViewRendersLineCanvas { get; set; } = false;
+        return true;
+    }
 
     /// <summary>Draws the specified character in the specified viewport-relative column and row of the View.</summary>
     /// <para>
@@ -66,42 +54,59 @@ public partial class View // Drawing APIs
         }
     }
 
-    /// <summary>Clears <see cref="Viewport"/> with the normal background.</summary>
+    /// <summary>Utility function to draw strings that contain a hotkey.</summary>
+    /// <param name="text">String to display, the hotkey specifier before a letter flags the next letter as the hotkey.</param>
+    /// <param name="hotColor">Hot color.</param>
+    /// <param name="normalColor">Normal color.</param>
     /// <remarks>
     ///     <para>
-    ///         If <see cref="ViewportSettings"/> has <see cref="Gui.ViewportSettings.ClearContentOnly"/> only
-    ///         the portion of the content
-    ///         area that is visible within the <see cref="View.Viewport"/> will be cleared. This is useful for views that have
-    ///         a
-    ///         content area larger than the Viewport (e.g. when <see cref="ViewportSettings.AllowNegativeLocation"/> is
-    ///         enabled) and want
-    ///         the area outside the content to be visually distinct.
+    ///         The hotkey is any character following the hotkey specifier, which is the underscore ('_') character by
+    ///         default.
     ///     </para>
+    ///     <para>The hotkey specifier can be changed via <see cref="HotKeySpecifier"/></para>
     /// </remarks>
-    public void Clear ()
+    public void DrawHotString (string text, Attribute hotColor, Attribute normalColor)
     {
-        if (Driver is null)
+        Rune hotkeySpec = HotKeySpecifier == (Rune)0xffff ? (Rune)'_' : HotKeySpecifier;
+        Application.Driver?.SetAttribute (normalColor);
+
+        foreach (Rune rune in text.EnumerateRunes ())
         {
-            return;
-        }
+            if (rune == new Rune (hotkeySpec.Value))
+            {
+                Application.Driver?.SetAttribute (hotColor);
 
-        // Get screen-relative coords
-        Rectangle toClear = ViewportToScreen (Viewport with { Location = new (0, 0) });
+                continue;
+            }
 
-        Rectangle prevClip = Driver.Clip;
+            Application.Driver?.AddRune (rune);
+            Application.Driver?.SetAttribute (normalColor);
+        }
+    }
 
-        if (ViewportSettings.HasFlag (ViewportSettings.ClearContentOnly))
+    /// <summary>
+    ///     Utility function to draw strings that contains a hotkey using a <see cref="ColorScheme"/> and the "focused"
+    ///     state.
+    /// </summary>
+    /// <param name="text">String to display, the underscore before a letter flags the next letter as the hotkey.</param>
+    /// <param name="focused">
+    ///     If set to <see langword="true"/> this uses the focused colors from the color scheme, otherwise
+    ///     the regular ones.
+    /// </param>
+    public void DrawHotString (string text, bool focused)
+    {
+        if (focused)
         {
-            Rectangle visibleContent = ViewportToScreen (new Rectangle (new (-Viewport.X, -Viewport.Y), GetContentSize ()));
-            toClear = Rectangle.Intersect (toClear, visibleContent);
+            DrawHotString (text, GetHotFocusColor (), GetFocusColor ());
+        }
+        else
+        {
+            DrawHotString (
+                           text,
+                           Enabled ? GetHotNormalColor () : ColorScheme!.Disabled,
+                           Enabled ? GetNormalColor () : ColorScheme!.Disabled
+                          );
         }
-
-        Attribute prev = Driver.SetAttribute (GetNormalColor ());
-        Driver.FillRect (toClear);
-        Driver.SetAttribute (prev);
-
-        Driver.Clip = prevClip;
-        SetNeedsDisplay ();
     }
 
     /// <summary>Fills the specified <see cref="Viewport"/>-relative rectangle with the specified color.</summary>
@@ -128,6 +133,10 @@ public partial class View // Drawing APIs
         Driver.Clip = prevClip;
     }
 
+    #endregion Drawing Primitives
+
+    #region Clipping
+
     /// <summary>Sets the <see cref="ConsoleDriver"/>'s clip region to <see cref="Viewport"/>.</summary>
     /// <remarks>
     ///     <para>
@@ -168,29 +177,21 @@ public partial class View // Drawing APIs
         return previous;
     }
 
+    #endregion Clipping
+
+    #region Drawing Engine
+
     /// <summary>
-    ///     Draws the view if it needs to be drawn. Causes the following virtual methods to be called (along with their related
-    ///     events):
-    ///     <see cref="OnDrawContent"/>, <see cref="OnDrawContentComplete"/>.
+    ///     Draws the view if it needs to be drawn.
     /// </summary>
     /// <remarks>
     ///     <para>
     ///         The view will only be drawn if it is visible, and has any of <see cref="NeedsDisplay"/>,
     ///         <see cref="SubViewNeedsDisplay"/>,
-    ///         or <see cref="IsLayoutNeeded"/> set.
-    ///     </para>
-    ///     <para>
-    ///         Always use <see cref="Viewport"/> (view-relative) when calling <see cref="OnDrawContent(Rectangle)"/>, NOT
-    ///         <see cref="Frame"/> (superview-relative).
-    ///     </para>
-    ///     <para>
-    ///         Views should set the color that they want to use on entry, as otherwise this will inherit the last color that
-    ///         was set globally on the driver.
+    ///         or <see cref="NeedsLayout"/> set.
     ///     </para>
     ///     <para>
-    ///         Overrides of <see cref="OnDrawContent(Rectangle)"/> must ensure they do not set <c>Driver.Clip</c> to a clip
-    ///         region larger than the <ref name="Viewport"/> property, as this will cause the driver to clip the entire
-    ///         region.
+    ///         // TODO: Add docs for the drawing process.
     ///     </para>
     /// </remarks>
     public void Draw ()
@@ -244,6 +245,8 @@ public partial class View // Drawing APIs
         DoDrawComplete (Viewport);
     }
 
+    #region DrawAdornments
+
     private void DoDrawAdornmentSubViews ()
     {
         if (Margin?.Subviews is { })
@@ -252,75 +255,89 @@ public partial class View // Drawing APIs
             {
                 subview.SetNeedsDisplay ();
             }
+
             Margin?.DoDrawSubviews (Margin.Viewport);
         }
+
         if (Border?.Subviews is { })
         {
             foreach (View subview in Border.Subviews)
             {
                 subview.SetNeedsDisplay ();
             }
+
             Border?.DoDrawSubviews (Border.Viewport);
         }
+
         if (Padding?.Subviews is { })
         {
             foreach (View subview in Padding.Subviews)
             {
                 subview.SetNeedsDisplay ();
             }
+
             Padding?.DoDrawSubviews (Padding.Viewport);
         }
     }
 
+    // TODO: Make private and change menuBar and Tab to not use
     internal void DoDrawAdornments ()
     {
-        if (OnDrawAdornments ())
+        if (OnDrawingAdornments ())
         {
             return;
         }
 
         // TODO: add event.
 
+        // TODO: add a DrawAdornments method
+
         // Each of these renders lines to either this View's LineCanvas 
         // Those lines will be finally rendered in OnRenderLineCanvas
-        Margin?.Draw (); //OnDrawContent (Margin.Viewport);
+        Margin?.Draw ();
         Border?.Draw ();
-        Padding?.Draw (); //OnDrawContent (Padding.Viewport);
-
+        Padding?.Draw ();
     }
 
     /// <summary>
-    ///     Called when the View's adornments are to be drawn. Prepares <see cref="View.LineCanvas"/>. If <see cref="SuperViewRendersLineCanvas"/> is true, only the
+    ///     Called when the View's Adornments are to be drawn. Prepares <see cref="View.LineCanvas"/>. If
+    ///     <see cref="SuperViewRendersLineCanvas"/> is true, only the
     ///     <see cref="LineCanvas"/> of this view's subviews will be rendered. If <see cref="SuperViewRendersLineCanvas"/> is
     ///     false (the default), this method will cause the <see cref="LineCanvas"/> be prepared to be rendered.
     /// </summary>
-    /// <returns></returns>
-    protected virtual bool OnDrawAdornments ()
-    {
-        return false;
-    }
+    /// <returns><see langword="true"/> to stop further drawing of the Adornments.</returns>
+    protected virtual bool OnDrawingAdornments () { return false; }
+
+    #endregion DrawAdornments
+
     #region ClearViewport
 
     private void DoClearViewport (Rectangle viewport)
     {
         Debug.Assert (viewport == Viewport);
 
-        if (OnClearViewport (Viewport))
+        if (OnClearingViewport (Viewport))
         {
             return;
         }
 
         var dev = new DrawEventArgs (Viewport, Rectangle.Empty);
-        ClearViewport?.Invoke (this, dev);
+        ClearingViewport?.Invoke (this, dev);
 
-        // BUGBUG: this clears way too frequently. Need to optimize this.
-        if (NeedsDisplay /* || Arrangement.HasFlag (ViewArrangement.Overlapped)*/)
+        if (dev.Cancel)
         {
-            Clear ();
+            return;
         }
+
+        ClearViewport ();
     }
 
-    protected virtual bool OnClearViewport (Rectangle viewport) { return false; }
+    /// <summary>
+    ///     Called when the <see cref="Viewport"/> is to be cleared.
+    /// </summary>
+    /// <param name="viewport"></param>
+    /// <returns><see langword="true"/> to stop further clearing.</returns>
+    protected virtual bool OnClearingViewport (Rectangle viewport) { return false; }
 
     /// <summary>Event invoked when the content area of the View is to be drawn.</summary>
     /// <remarks>
@@ -330,7 +347,45 @@ public partial class View // Drawing APIs
     ///         <see cref="View"/> .
     ///     </para>
     /// </remarks>
-    public event EventHandler<DrawEventArgs>? ClearViewport;
+    public event EventHandler<DrawEventArgs>? ClearingViewport;
+
+    /// <summary>Clears <see cref="Viewport"/> with the normal background.</summary>
+    /// <remarks>
+    ///     <para>
+    ///         If <see cref="ViewportSettings"/> has <see cref="Gui.ViewportSettings.ClearContentOnly"/> only
+    ///         the portion of the content
+    ///         area that is visible within the <see cref="View.Viewport"/> will be cleared. This is useful for views that have
+    ///         a
+    ///         content area larger than the Viewport (e.g. when <see cref="ViewportSettings.AllowNegativeLocation"/> is
+    ///         enabled) and want
+    ///         the area outside the content to be visually distinct.
+    ///     </para>
+    /// </remarks>
+    public void ClearViewport ()
+    {
+        if (Driver is null)
+        {
+            return;
+        }
+
+        // Get screen-relative coords
+        Rectangle toClear = ViewportToScreen (Viewport with { Location = new (0, 0) });
+
+        Rectangle prevClip = Driver.Clip;
+
+        if (ViewportSettings.HasFlag (ViewportSettings.ClearContentOnly))
+        {
+            Rectangle visibleContent = ViewportToScreen (new Rectangle (new (-Viewport.X, -Viewport.Y), GetContentSize ()));
+            toClear = Rectangle.Intersect (toClear, visibleContent);
+        }
+
+        Attribute prev = Driver.SetAttribute (GetNormalColor ());
+        Driver.FillRect (toClear);
+        Driver.SetAttribute (prev);
+
+        Driver.Clip = prevClip;
+        SetNeedsDisplay ();
+    }
 
     #endregion ClearViewport
 
@@ -338,17 +393,43 @@ public partial class View // Drawing APIs
 
     private void DoDrawText (Rectangle viewport)
     {
-        Debug.Assert(viewport == Viewport);
-
+        Debug.Assert (viewport == Viewport);
 
-        if (OnDrawText (Viewport))
+        if (OnDrawingText (Viewport))
         {
             return;
         }
 
         var dev = new DrawEventArgs (Viewport, Rectangle.Empty);
-        DrawText?.Invoke (this, dev);
+        DrawingText?.Invoke (this, dev);
 
+        if (dev.Cancel)
+        {
+            return;
+        }
+
+        DrawText ();
+    }
+
+    /// <summary>
+    ///     Called when the <see cref="Text"/> of the View is to be drawn.
+    /// </summary>
+    /// <param name="viewport"></param>
+    /// <returns><see langword="true"/> to stop further drawing of  <see cref="Text"/>.</returns>
+    protected virtual bool OnDrawingText (Rectangle viewport) { return false; }
+
+    /// <summary>Raised when the <see cref="Text"/> of the View is to be drawn.</summary>
+    /// <returns>
+    ///     Set <see cref="DrawEventArgs.Cancel"/> to <see langword="true"/> to stop further drawing of
+    ///     <see cref="Text"/>.
+    /// </returns>
+    public event EventHandler<DrawEventArgs>? DrawingText;
+
+    /// <summary>
+    ///     Draws the <see cref="Text"/> of the View using the <see cref="TextFormatter"/>.
+    /// </summary>
+    public void DrawText ()
+    {
         if (!string.IsNullOrEmpty (TextFormatter.Text))
         {
             TextFormatter.NeedsFormat = true;
@@ -358,31 +439,17 @@ public partial class View // Drawing APIs
         // TODO: If the output is not in the Viewport, do nothing
         var drawRect = new Rectangle (ContentToScreen (Point.Empty), GetContentSize ());
 
-        if (Id == "ScrollingDemoView")
-        {
-
-        }
         TextFormatter?.Draw (
                              drawRect,
                              HasFocus ? GetFocusColor () : GetNormalColor (),
                              HasFocus ? GetHotFocusColor () : GetHotNormalColor (),
                              Rectangle.Empty
                             );
+
+        // We assume that the text has been drawn over the entire area; ensure that the subviews are redrawn.
         SetSubViewNeedsDisplay ();
     }
 
-    protected virtual bool OnDrawText (Rectangle viewport) { return false; }
-
-    /// <summary>Event invoked when the content area of the View is to be drawn.</summary>
-    /// <remarks>
-    ///     <para>Will be invoked before any subviews added with <see cref="Add(View)"/> have been drawn.</para>
-    ///     <para>
-    ///         Rect provides the view-relative rectangle describing the currently visible viewport into the
-    ///         <see cref="View"/> .
-    ///     </para>
-    /// </remarks>
-    public event EventHandler<DrawEventArgs>? DrawText;
-
     #endregion DrawText
 
     #region DrawContent
@@ -390,51 +457,30 @@ public partial class View // Drawing APIs
     private void DoDrawContent (Rectangle viewport)
     {
         Debug.Assert (viewport == Viewport);
-        if (OnDrawContent (Viewport))
+
+        if (OnDrawingContent (Viewport))
         {
             return;
         }
 
         var dev = new DrawEventArgs (Viewport, Rectangle.Empty);
-        DrawContent?.Invoke (this, dev);
+        DrawingContent?.Invoke (this, dev);
+
+        if (dev.Cancel)
+        { }
+
+        // Do nothing.
     }
 
     /// <summary>
-    ///     Called when the View's content is to be drawn.
+    ///     Called when the View's content is to be drawn. The default implementation does nothing.
     /// </summary>
     /// <remarks>
-    ///     <para>
-    ///         The <paramref name="viewport"/> parameter is provided as a convenience; it has the same values as the
-    ///         <see cref="Viewport"/> property.
-    ///     </para>
-    ///     <para>
-    ///         The <see cref="Viewport"/> Location and Size indicate what part of the View's content, defined
-    ///         by <see cref="GetContentSize ()"/>, is visible and should be drawn. The coordinates taken by <see cref="Move"/>
-    ///         and
-    ///         <see cref="AddRune"/> are relative to <see cref="Viewport"/>, thus if <c>ViewPort.Location.Y</c> is <c>5</c>
-    ///         the 6th row of the content should be drawn using <c>MoveTo (x, 5)</c>.
-    ///     </para>
-    ///     <para>
-    ///         If <see cref="GetContentSize ()"/> is larger than <c>ViewPort.Size</c> drawing code should use
-    ///         <see cref="Viewport"/>
-    ///         to constrain drawing for better performance.
-    ///     </para>
-    ///     <para>
-    ///         The <see cref="ConsoleDriver.Clip"/> may define smaller area than <see cref="Viewport"/>; complex drawing code
-    ///         can be more
-    ///         efficient by using <see cref="ConsoleDriver.Clip"/> to constrain drawing for better performance.
-    ///     </para>
-    ///     <para>
-    ///         Overrides should loop through the subviews and call <see cref="Draw"/>.
-    ///     </para>
     /// </remarks>
-    /// <param name="viewport">
-    ///     The rectangle describing the currently visible viewport into the <see cref="View"/>; has the same value as
-    ///     <see cref="Viewport"/>.
-    /// </param>
-    protected virtual bool OnDrawContent (Rectangle viewport) { return false; }
+    /// <returns><see langword="true"/> to stop further drawing content.</returns>
+    protected virtual bool OnDrawingContent (Rectangle viewport) { return false; }
 
-    /// <summary>Event invoked when the content area of the View is to be drawn.</summary>
+    /// <summary>Raised when  the View's content is to be drawn.</summary>
     /// <remarks>
     ///     <para>Will be invoked before any subviews added with <see cref="Add(View)"/> have been drawn.</para>
     ///     <para>
@@ -442,279 +488,109 @@ public partial class View // Drawing APIs
     ///         <see cref="View"/> .
     ///     </para>
     /// </remarks>
-    public event EventHandler<DrawEventArgs>? DrawContent;
+    public event EventHandler<DrawEventArgs>? DrawingContent;
 
     #endregion DrawContent
 
     #region DrawSubviews
 
-    internal void DoDrawSubviews (Rectangle viewport)
+    private void DoDrawSubviews (Rectangle viewport)
     {
         Debug.Assert (viewport == Viewport);
-        if (OnDrawSubviews (Viewport))
-        {
-            return;
-        }
-
-        var dev = new DrawEventArgs (Viewport, Rectangle.Empty);
-        DrawSubviews?.Invoke (this, dev);
 
-        // TODO: Move drawing of subviews to a separate OnDrawText virtual method
-        // Draw subviews
-        // TODO: Implement OnDrawText (cancelable);
-        if (_subviews is null || !SubViewNeedsDisplay)
+        if (OnDrawingSubviews (Viewport))
         {
             return;
         }
 
-        IEnumerable<View> subviewsNeedingDraw = _subviews.Where (
-                                                                 view => view.Visible
-                                                                         && (view.NeedsDisplay
-                                                                             || view.SubViewNeedsDisplay
-
-                                                                                // || view.Arrangement.HasFlag (ViewArrangement.Overlapped)
-                                                                            ));
-
-        foreach (View view in subviewsNeedingDraw)
-        {
-            if (view.NeedsLayout)
-            {
-                //Debug.WriteLine ($"Layout should be de-coupled from drawing: {view}");
-                //view.LayoutSubviews ();
-            }
-
-            // TODO: This ensures overlapped views are drawn correctly. However, this is inefficient.
-            // TODO: The correct fix is to implement non-rectangular clip regions: https://github.com/gui-cs/Terminal.Gui/issues/3413
-            if (view.Arrangement.HasFlag (ViewArrangement.Overlapped))
-            {
-                // view.SetNeedsDisplay ();
-            }
-
-            view.Draw ();
-        }
-    }
-
-    protected virtual bool OnDrawSubviews (Rectangle viewport) { return false; }
-
-    /// <summary>Event invoked when the content area of the View is to be drawn.</summary>
-    /// <remarks>
-    ///     <para>Will be invoked before any subviews added with <see cref="Add(View)"/> have been drawn.</para>
-    ///     <para>
-    ///         Rect provides the view-relative rectangle describing the currently visible viewport into the
-    ///         <see cref="View"/> .
-    ///     </para>
-    /// </remarks>
-    public event EventHandler<DrawEventArgs>? DrawSubviews;
-
-    #endregion DrawSubviews
-
-
-    #region DrawComplete
+        var dev = new DrawEventArgs (Viewport, Rectangle.Empty);
+        DrawingSubviews?.Invoke (this, dev);
 
-    private void DoDrawComplete (Rectangle viewport)
-    {
-        Debug.Assert (viewport == Viewport);
-        if (OnDrawComplete (Viewport))
+        if (dev.Cancel)
         {
             return;
         }
 
-        var dev = new DrawEventArgs (Viewport, Rectangle.Empty);
-        DrawComplete?.Invoke (this, dev);
+        DrawSubviews ();
     }
 
-    protected virtual bool OnDrawComplete (Rectangle viewport) { return false; }
-
-    /// <summary>Event invoked when the View is completed drawing.</summary>
-    /// <remarks>
-    ///     <para>
-    ///         Rect provides the view-relative rectangle describing the currently visible viewport into the
-    ///         <see cref="View"/> .
-    ///     </para>
-    /// </remarks>
-    public event EventHandler<DrawEventArgs>? DrawComplete;
-
-
-    #endregion DrawComplete
+    /// <summary>
+    ///     Called when the <see cref="Subviews"/> are to be drawn.
+    /// </summary>
+    /// <param name="viewport"></param>
+    /// <returns><see langword="true"/> to stop further drawing of <see cref="Subviews"/>.</returns>
+    protected virtual bool OnDrawingSubviews (Rectangle viewport) { return false; }
 
-    /// <summary>Utility function to draw strings that contain a hotkey.</summary>
-    /// <param name="text">String to display, the hotkey specifier before a letter flags the next letter as the hotkey.</param>
-    /// <param name="hotColor">Hot color.</param>
-    /// <param name="normalColor">Normal color.</param>
+    /// <summary>Raised when the <see cref="Subviews"/> are to be drawn.</summary>
     /// <remarks>
-    ///     <para>
-    ///         The hotkey is any character following the hotkey specifier, which is the underscore ('_') character by
-    ///         default.
-    ///     </para>
-    ///     <para>The hotkey specifier can be changed via <see cref="HotKeySpecifier"/></para>
     /// </remarks>
-    public void DrawHotString (string text, Attribute hotColor, Attribute normalColor)
-    {
-        Rune hotkeySpec = HotKeySpecifier == (Rune)0xffff ? (Rune)'_' : HotKeySpecifier;
-        Application.Driver?.SetAttribute (normalColor);
-
-        foreach (Rune rune in text.EnumerateRunes ())
-        {
-            if (rune == new Rune (hotkeySpec.Value))
-            {
-                Application.Driver?.SetAttribute (hotColor);
-
-                continue;
-            }
-
-            Application.Driver?.AddRune (rune);
-            Application.Driver?.SetAttribute (normalColor);
-        }
-    }
+    /// <returns>
+    ///     Set <see cref="DrawEventArgs.Cancel"/> to <see langword="true"/> to stop further drawing of
+    ///     <see cref="Subviews"/>.
+    /// </returns>
+    public event EventHandler<DrawEventArgs>? DrawingSubviews;
 
     /// <summary>
-    ///     Utility function to draw strings that contains a hotkey using a <see cref="ColorScheme"/> and the "focused"
-    ///     state.
+    ///     Draws the <see cref="Subviews"/>.
     /// </summary>
-    /// <param name="text">String to display, the underscore before a letter flags the next letter as the hotkey.</param>
-    /// <param name="focused">
-    ///     If set to <see langword="true"/> this uses the focused colors from the color scheme, otherwise
-    ///     the regular ones.
-    /// </param>
-    public void DrawHotString (string text, bool focused)
+    public void DrawSubviews ()
     {
-        if (focused)
-        {
-            DrawHotString (text, GetHotFocusColor (), GetFocusColor ());
-        }
-        else
+        if (_subviews is null || !SubViewNeedsDisplay)
         {
-            DrawHotString (
-                           text,
-                           Enabled ? GetHotNormalColor () : ColorScheme!.Disabled,
-                           Enabled ? GetNormalColor () : ColorScheme!.Disabled
-                          );
+            return;
         }
-    }
 
-    /// <summary>Determines the current <see cref="ColorScheme"/> based on the <see cref="Enabled"/> value.</summary>
-    /// <returns>
-    ///     <see cref="ColorScheme.Focus"/> if <see cref="Enabled"/> is <see langword="true"/> or
-    ///     <see cref="ColorScheme.Disabled"/> if <see cref="Enabled"/> is <see langword="false"/>. If it's
-    ///     overridden can return other values.
-    /// </returns>
-    public virtual Attribute GetFocusColor ()
-    {
-        ColorScheme? cs = ColorScheme;
+        IEnumerable<View> subviewsNeedingDraw = _subviews.Where (view => view.Visible && (view.NeedsDisplay || view.SubViewNeedsDisplay));
 
-        if (cs is null)
+        foreach (View view in subviewsNeedingDraw)
         {
-            cs = new ();
+            view.Draw ();
         }
-
-        return Enabled ? GetColor (cs.Focus) : cs.Disabled;
-    }
-
-    /// <summary>Determines the current <see cref="ColorScheme"/> based on the <see cref="Enabled"/> value.</summary>
-    /// <returns>
-    ///     <see cref="ColorScheme.Focus"/> if <see cref="Enabled"/> is <see langword="true"/> or
-    ///     <see cref="ColorScheme.Disabled"/> if <see cref="Enabled"/> is <see langword="false"/>. If it's
-    ///     overridden can return other values.
-    /// </returns>
-    public virtual Attribute GetHotFocusColor ()
-    {
-        ColorScheme? cs = ColorScheme ?? new ();
-
-        return Enabled ? GetColor (cs.HotFocus) : cs.Disabled;
     }
 
-    /// <summary>Determines the current <see cref="ColorScheme"/> based on the <see cref="Enabled"/> value.</summary>
-    /// <returns>
-    ///     <see cref="Terminal.Gui.ColorScheme.HotNormal"/> if <see cref="Enabled"/> is <see langword="true"/> or
-    ///     <see cref="Terminal.Gui.ColorScheme.Disabled"/> if <see cref="Enabled"/> is <see langword="false"/>. If it's
-    ///     overridden can return other values.
-    /// </returns>
-    public virtual Attribute GetHotNormalColor ()
-    {
-        ColorScheme? cs = ColorScheme;
-
-        if (cs is null)
-        {
-            cs = new ();
-        }
+    #endregion DrawSubviews
 
-        return Enabled ? GetColor (cs.HotNormal) : cs.Disabled;
-    }
+    #region DrawLineCanvas
 
-    /// <summary>Determines the current <see cref="ColorScheme"/> based on the <see cref="Enabled"/> value.</summary>
-    /// <returns>
-    ///     <see cref="Terminal.Gui.ColorScheme.Normal"/> if <see cref="Enabled"/> is <see langword="true"/> or
-    ///     <see cref="Terminal.Gui.ColorScheme.Disabled"/> if <see cref="Enabled"/> is <see langword="false"/>. If it's
-    ///     overridden can return other values.
-    /// </returns>
-    public virtual Attribute GetNormalColor ()
+    internal void DoRenderLineCanvas ()
     {
-        ColorScheme? cs = ColorScheme;
-
-        if (cs is null)
+        if (OnRenderingLineCanvas ())
         {
-            cs = new ();
-        }
-
-        Attribute disabled = new (cs.Disabled.Foreground, cs.Disabled.Background);
-
-        if (Diagnostics.HasFlag (ViewDiagnosticFlags.Hover) && _hovering)
-        {
-            disabled = new (disabled.Foreground.GetDarkerColor (), disabled.Background.GetDarkerColor ());
+            return;
         }
 
-        return Enabled ? GetColor (cs.Normal) : disabled;
-    }
-
-    private Attribute GetColor (Attribute inputAttribute)
-    {
-        Attribute attr = inputAttribute;
-
-        if (Diagnostics.HasFlag (ViewDiagnosticFlags.Hover) && _hovering)
-        {
-            attr = new (attr.Foreground.GetDarkerColor (), attr.Background.GetDarkerColor ());
-        }
+        // TODO: Add event
 
-        return attr;
+        RenderLineCanvas ();
     }
 
-    /// <summary>Moves the drawing cursor to the specified <see cref="Viewport"/>-relative location in the view.</summary>
-    /// <remarks>
-    ///     <para>
-    ///         If the provided coordinates are outside the visible content area, this method does nothing.
-    ///     </para>
-    ///     <para>
-    ///         The top-left corner of the visible content area is <c>ViewPort.Location</c>.
-    ///     </para>
-    /// </remarks>
-    /// <param name="col">Column (viewport-relative).</param>
-    /// <param name="row">Row (viewport-relative).</param>
-    public bool Move (int col, int row)
-    {
-        if (Driver is null || Driver?.Rows == 0)
-        {
-            return false;
-        }
-
-        if (col < 0 || row < 0 || col >= Viewport.Width || row >= Viewport.Height)
-        {
-            return false;
-        }
+    /// <summary>
+    ///     Called when the <see cref="View.LineCanvas"/> is to be rendered. See <see cref="RenderLineCanvas"/>.
+    /// </summary>
+    /// <returns><see langword="true"/> to stop further drawing of <see cref="LineCanvas"/>.</returns>
+    protected virtual bool OnRenderingLineCanvas () { return false; }
 
-        Point screen = ViewportToScreen (new Point (col, row));
-        Driver?.Move (screen.X, screen.Y);
+    /// <summary>The canvas that any line drawing that is to be shared by subviews of this view should add lines to.</summary>
+    /// <remarks><see cref="Border"/> adds border lines to this LineCanvas.</remarks>
+    public LineCanvas LineCanvas { get; } = new ();
 
-        return true;
-    }
+    /// <summary>
+    ///     Gets or sets whether this View will use it's SuperView's <see cref="LineCanvas"/> for rendering any
+    ///     lines. If <see langword="true"/> the rendering of any borders drawn by this Frame will be done by its parent's
+    ///     SuperView. If <see langword="false"/> (the default) this View's <see cref="OnDrawingAdornments"/> method will be
+    ///     called to render the borders.
+    /// </summary>
+    public virtual bool SuperViewRendersLineCanvas { get; set; } = false;
 
-    internal void DoRenderLineCanvas ()
+    /// <summary>
+    ///     Causes the contents of <see cref="LineCanvas"/> to be drawn. 
+    ///      If <see cref="SuperViewRendersLineCanvas"/> is true, only the
+    ///     <see cref="LineCanvas"/> of this view's subviews will be rendered. If <see cref="SuperViewRendersLineCanvas"/> is
+    ///     false (the default), this method will cause the <see cref="LineCanvas"/> to be rendered.
+    /// </summary>
+    public void RenderLineCanvas ()
     {
-        if (OnRenderLineCanvas ())
-        {
-            return;
-        }
-
-        // TODO: Add event
+        // TODO: This is super confusing and needs to be refactored.
 
         if (Driver is null)
         {
@@ -765,18 +641,41 @@ public partial class View // Drawing APIs
             LineCanvas.Clear ();
         }
     }
+    #endregion DrawLineCanvas
 
-    /// <summary>
-    ///     Renders <see cref="View.LineCanvas"/>. If <see cref="SuperViewRendersLineCanvas"/> is true, only the
-    ///     <see cref="LineCanvas"/> of this view's subviews will be rendered. If <see cref="SuperViewRendersLineCanvas"/> is
-    ///     false (the default), this method will cause the <see cref="LineCanvas"/> to be rendered.
-    /// </summary>
-    /// <returns></returns>
-    protected virtual bool OnRenderLineCanvas ()
+    #region DrawComplete
+
+    private void DoDrawComplete (Rectangle viewport)
     {
-        return false;
+        Debug.Assert (viewport == Viewport);
+
+        if (OnDrawComplete (Viewport))
+        {
+            return;
+        }
+
+        var dev = new DrawEventArgs (Viewport, Rectangle.Empty);
+        DrawComplete?.Invoke (this, dev);
+
+        if (dev.Cancel)
+        { }
+
+        // Default implementation does nothing.
     }
 
+    /// <summary>
+    ///     Called when the View is completed drawing.
+    /// </summary>
+    /// <param name="viewport"></param>
+    protected virtual bool OnDrawComplete (Rectangle viewport) { return false; }
+
+    /// <summary>Raised when the View is completed drawing.</summary>
+    /// <remarks>
+    /// </remarks>
+    public event EventHandler<DrawEventArgs>? DrawComplete;
+
+    #endregion DrawComplete
+
     #region NeedsDisplay
 
     // TODO: Make _needsDisplayRect nullable instead of relying on Empty
@@ -789,7 +688,7 @@ public partial class View // Drawing APIs
     /// <summary>Gets or sets whether the view needs to be redrawn.</summary>
     /// <remarks>
     ///     <para>
-    ///         Will be <see langword="true"/> if the <see cref="NeedsLayout"/> property is <see langword="true"/> or if 
+    ///         Will be <see langword="true"/> if the <see cref="NeedsLayout"/> property is <see langword="true"/> or if
     ///         any part of the view's <see cref="Viewport"/> needs to be redrawn.
     ///     </para>
     ///     <para>
@@ -916,4 +815,6 @@ public partial class View // Drawing APIs
     }
 
     #endregion NeedsDisplay
+
+    #endregion Drawing Engine
 }

+ 1 - 1
Terminal.Gui/View/ViewportSettings.cs

@@ -94,7 +94,7 @@ public enum ViewportSettings
     ClipContentOnly = 16,
 
     /// <summary>
-    ///     If set <see cref="View.Clear()"/> will clear only the portion of the content
+    ///     If set <see cref="View.ClearViewport"/> will clear only the portion of the content
     ///     area that is visible within the <see cref="View.Viewport"/>. This is useful for views that have a
     ///     content area larger than the Viewport and want the area outside the content to be visually distinct.
     ///     <para>

+ 1 - 1
Terminal.Gui/Views/ColorBar.cs

@@ -82,7 +82,7 @@ internal abstract class ColorBar : View, IColorBar
     }
 
     /// <inheritdoc/>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         var xOffset = 0;
 

+ 2 - 2
Terminal.Gui/Views/ColorPicker.16.cs

@@ -131,9 +131,9 @@ public class ColorPicker16 : View
     }
 
     ///<inheritdoc/>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
-        base.OnDrawContent (viewport);
+        base.OnDrawingContent (viewport);
 
         Driver?.SetAttribute (HasFocus ? ColorScheme.Focus : GetNormalColor ());
         var colorIndex = 0;

+ 1 - 1
Terminal.Gui/Views/ColorPicker.cs

@@ -99,7 +99,7 @@ public partial class ColorPicker : View
     public event EventHandler<ColorEventArgs>? ColorChanged;
 
     /// <inheritdoc/>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         Attribute normal = GetNormalColor ();
         Driver?.SetAttribute (new (SelectedColor, normal.Background));

+ 4 - 4
Terminal.Gui/Views/ComboBox.cs

@@ -294,7 +294,7 @@ public class ComboBox : View, IDesignable
     public virtual void OnCollapsed () { Collapsed?.Invoke (this, EventArgs.Empty); }
 
     /// <inheritdoc/>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
 
         if (!_autoHide)
@@ -505,7 +505,7 @@ public class ComboBox : View, IDesignable
         }
 
         Reset (true);
-        _listview.Clear ();
+        _listview.ClearViewport ();
         _listview.TabStop = TabBehavior.NoStop;
         SuperView?.MoveSubviewToStart (this);
 
@@ -806,7 +806,7 @@ public class ComboBox : View, IDesignable
         _listview.SetSource (_searchSet);
         _listview.ResumeSuspendCollectionChangedEvent ();
 
-        _listview.Clear ();
+        _listview.ClearViewport ();
         _listview.Height = CalculateHeight ();
         SuperView?.MoveSubviewToStart (this);
     }
@@ -886,7 +886,7 @@ public class ComboBox : View, IDesignable
             return res;
         }
 
-        protected override bool OnDrawContent (Rectangle viewport)
+        protected override bool OnDrawingContent (Rectangle viewport)
         {
             Attribute current = ColorScheme?.Focus ?? Attribute.Default;
             Driver?.SetAttribute (current);

+ 1 - 1
Terminal.Gui/Views/FileDialog.cs

@@ -368,7 +368,7 @@ public class FileDialog : Dialog
     }
 
     /// <inheritdoc/>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         if (!string.IsNullOrWhiteSpace (_feedback))
         {

+ 4 - 4
Terminal.Gui/Views/GraphView/Annotations.cs

@@ -130,12 +130,12 @@ public class LegendAnnotation : View, IAnnotation
     // BUGBUG: Legend annotations are subviews. But for some reason the are rendered directly in OnDrawContent 
     // BUGBUG: instead of just being normal subviews. They get rendered as blank rects and thus we disable subview drawing.
     /// <inheritdoc />
-    protected override bool OnDrawText (Rectangle viewport) { return true; }
+    protected override bool OnDrawingText (Rectangle viewport) { return true; }
 
     // BUGBUG: Legend annotations are subviews. But for some reason the are rendered directly in OnDrawContent 
     // BUGBUG: instead of just being normal subviews. They get rendered as blank rects and thus we disable subview drawing.
     /// <inheritdoc />
-    protected override bool OnClearViewport (Rectangle viewport) { return true; }
+    protected override bool OnClearingViewport (Rectangle viewport) { return true; }
 
 
     /// <summary>Draws the Legend and all entries into the area within <see cref="View.Viewport"/></summary>
@@ -150,8 +150,8 @@ public class LegendAnnotation : View, IAnnotation
 
         if (BorderStyle != LineStyle.None)
         {
-            OnDrawAdornments ();
-            OnRenderLineCanvas ();
+            OnDrawingAdornments ();
+            OnRenderingLineCanvas ();
         }
 
         var linesDrawn = 0;

+ 1 - 1
Terminal.Gui/Views/GraphView/GraphView.cs

@@ -197,7 +197,7 @@ public class GraphView : View
     }
 
     ///<inheritdoc/>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         if (CellSize.X == 0 || CellSize.Y == 0)
         {

+ 1 - 1
Terminal.Gui/Views/HexView.cs

@@ -421,7 +421,7 @@ public class HexView : View, IDesignable
     }
 
     ///<inheritdoc/>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         if (Source is null)
         {

+ 1 - 1
Terminal.Gui/Views/Line.cs

@@ -64,7 +64,7 @@ public class Line : View, IOrientation
     }
 
     /// <inheritdoc/>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         LineCanvas lc = LineCanvas;
 

+ 1 - 1
Terminal.Gui/Views/LineView.cs

@@ -54,7 +54,7 @@ public class LineView : View
     public Rune? StartingAnchor { get; set; }
 
     /// <summary>Draws the line including any starting/ending anchors</summary>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         Move (0, 0);
         Driver?.SetAttribute (GetNormalColor ());

+ 1 - 1
Terminal.Gui/Views/ListView.cs

@@ -769,7 +769,7 @@ public class ListView : View, IDesignable
     }
 
     /// <inheritdoc/>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         Attribute current = ColorScheme?.Focus ?? Attribute.Default;
         Driver?.SetAttribute (current);

+ 1 - 1
Terminal.Gui/Views/Menu/Menu.cs

@@ -394,7 +394,7 @@ internal sealed class Menu : View
     }
 
     /// <inheritdoc />
-    protected override bool OnDrawAdornments ()
+    protected override bool OnDrawingAdornments ()
     {
         Margin?.SetNeedsDisplay ();
         Border?.SetNeedsDisplay();

+ 1 - 1
Terminal.Gui/Views/Menu/MenuBar.cs

@@ -297,7 +297,7 @@ public class MenuBar : View, IDesignable
     public event EventHandler<MenuOpeningEventArgs>? MenuOpening;
 
     /// <inheritdoc/>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         var pos = 0;
 

+ 1 - 1
Terminal.Gui/Views/NumericUpDown.cs

@@ -264,7 +264,7 @@ public class NumericUpDown<T> : View where T : notnull
 
     // Prevent the drawing of Text
     /// <inheritdoc />
-    protected override bool OnDrawText (Rectangle viewport) { return true; }
+    protected override bool OnDrawingText (Rectangle viewport) { return true; }
 }
 
 /// <summary>

+ 1 - 1
Terminal.Gui/Views/ProgressBar.cs

@@ -139,7 +139,7 @@ public class ProgressBar : View, IDesignable
     }
 
     ///<inheritdoc/>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         Driver?.SetAttribute (GetHotNormalColor ());
 

+ 1 - 1
Terminal.Gui/Views/RadioGroup.cs

@@ -360,7 +360,7 @@ public class RadioGroup : View, IDesignable, IOrientation
     }
 
     /// <inheritdoc/>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         Driver?.SetAttribute (GetNormalColor ());
 

+ 2 - 2
Terminal.Gui/Views/ScrollBarView.cs

@@ -446,7 +446,7 @@ public class ScrollBarView : View
     public virtual void OnChangedPosition () { ChangedPosition?.Invoke (this, EventArgs.Empty); }
 
     /// <inheritdoc/>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         if (ColorScheme is null || ((!ShowScrollIndicator || Size == 0) && AutoHideScrollBars && Visible))
         {
@@ -827,7 +827,7 @@ public class ScrollBarView : View
             _contentBottomRightCorner.Width = 1;
             _contentBottomRightCorner.Height = 1;
             _contentBottomRightCorner.MouseClick += ContentBottomRightCorner_MouseClick;
-            _contentBottomRightCorner.DrawContent += ContentBottomRightCorner_DrawContent;
+            _contentBottomRightCorner.DrawingContent += ContentBottomRightCorner_DrawContent;
         }
     }
 

+ 2 - 2
Terminal.Gui/Views/ScrollView.cs

@@ -372,12 +372,12 @@ public class ScrollView : View
     }
 
     /// <inheritdoc/>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         SetViewsNeedsDisplay ();
 
         // TODO: It's bad practice for views to always clear a view. It negates clipping.
-        Clear ();
+        ClearViewport ();
 
         if (!string.IsNullOrEmpty (_contentView.Text) || _contentView.Subviews.Count > 0)
         {

+ 2 - 2
Terminal.Gui/Views/Slider.cs

@@ -775,7 +775,7 @@ public class Slider<T> : View, IOrientation
     #region Drawing
 
     /// <inheritdoc/>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         // TODO: make this more surgical to reduce repaint
 
@@ -841,7 +841,7 @@ public class Slider<T> : View, IOrientation
     private void DrawSlider ()
     {
         // TODO: be more surgical on clear
-        Clear ();
+        ClearViewport ();
 
         // Attributes
 

+ 4 - 4
Terminal.Gui/Views/TabView.cs

@@ -290,7 +290,7 @@ public class TabView : View
     public int EnsureValidScrollOffsets (int value) { return Math.Max (Math.Min (value, Tabs.Count - 1), 0); }
 
     /// <inheritdoc/>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         if (Tabs.Any ())
         {
@@ -640,15 +640,15 @@ public class TabView : View
         }
 
         /// <inheritdoc />
-        protected override bool OnClearViewport (Rectangle viewport)
+        protected override bool OnClearingViewport (Rectangle viewport)
         {
             // clear any old text
-            Clear ();
+            ClearViewport ();
 
             return true;
         }
 
-        protected override bool OnDrawContent (Rectangle viewport)
+        protected override bool OnDrawingContent (Rectangle viewport)
         {
             _host._tabLocations = _host.CalculateViewport (Viewport).ToArray ();
 

+ 1 - 1
Terminal.Gui/Views/TableView/ListTableSource.cs

@@ -38,7 +38,7 @@ public class ListTableSource : ITableSource
         DataTable = CreateTable (CalculateColumns ());
 
         // TODO: Determine the best event for this
-        tableView.DrawContent += TableView_DrawContent;
+        tableView.DrawingContent += TableView_DrawContent;
     }
 
     /// <inheritdoc/>

+ 1 - 1
Terminal.Gui/Views/TableView/TableView.cs

@@ -910,7 +910,7 @@ public class TableView : View
     }
 
     ///<inheritdoc/>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         Move (0, 0);
 

+ 1 - 1
Terminal.Gui/Views/TextField.cs

@@ -931,7 +931,7 @@ public class TextField : View
     }
 
     /// <inheritdoc/>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         _isDrawing = true;
 

+ 1 - 1
Terminal.Gui/Views/TextValidateField.cs

@@ -553,7 +553,7 @@ namespace Terminal.Gui
         }
 
         /// <inheritdoc/>
-        protected override bool OnDrawContent (Rectangle viewport)
+        protected override bool OnDrawingContent (Rectangle viewport)
         {
             if (_provider is null)
             {

+ 1 - 1
Terminal.Gui/Views/TextView.cs

@@ -3550,7 +3550,7 @@ public class TextView : View
     }
 
     /// <inheritdoc/>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         _isDrawing = true;
 

+ 4 - 4
Terminal.Gui/Views/TileView.cs

@@ -174,10 +174,10 @@ public class TileView : View
     // QUESTION: Does this need to be fixed before events are refactored?
     /// <summary>Overridden so no Frames get drawn</summary>
     /// <returns></returns>
-    protected override bool OnDrawAdornments () { return true; }
+    protected override bool OnDrawingAdornments () { return true; }
 
     /// <inheritdoc/>
-    protected override bool OnRenderLineCanvas () { return false; }
+    protected override bool OnRenderingLineCanvas () { return false; }
 
     /// <inheritdoc/>
     protected override bool OnDrawComplete (Rectangle viewport)
@@ -973,9 +973,9 @@ public class TileView : View
         }
 
         /// <inheritdoc/>
-        protected override bool OnClearViewport (Rectangle viewport) { return true; }
+        protected override bool OnClearingViewport (Rectangle viewport) { return true; }
 
-        protected override bool OnDrawContent (Rectangle viewport)
+        protected override bool OnDrawingContent (Rectangle viewport)
         {
             DrawSplitterSymbol ();
 

+ 1 - 1
Terminal.Gui/Views/TreeView/TreeView.cs

@@ -1127,7 +1127,7 @@ public class TreeView<T> : View, ITreeView where T : class
     public event EventHandler<ObjectActivatedEventArgs<T>> ObjectActivated;
 
     ///<inheritdoc/>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         if (roots is null)
         {

+ 1 - 1
UICatalog/Scenarios/AnimationScenario/AnimationScenario.cs

@@ -176,7 +176,7 @@ public class AnimationScenario : Scenario
         private Rectangle oldSize = Rectangle.Empty;
         public void NextFrame () { currentFrame = (currentFrame + 1) % frameCount; }
 
-        protected override bool OnDrawContent (Rectangle viewport)
+        protected override bool OnDrawingContent (Rectangle viewport)
         {
             if (oldSize != Viewport)
             {

+ 2 - 2
UICatalog/Scenarios/CharacterMap.cs

@@ -657,14 +657,14 @@ internal class CharMap : View
     private static int RowWidth => RowLabelWidth + COLUMN_WIDTH * 16;
     public event EventHandler<ListViewItemEventArgs> Hover;
 
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         if (viewport.Height == 0 || viewport.Width == 0)
         {
             return true;
         }
 
-        Clear ();
+        ClearViewport ();
 
         int cursorCol = Cursor.X + Viewport.X - RowLabelWidth - 1;
         int cursorRow = Cursor.Y + Viewport.Y - 1;

+ 1 - 1
UICatalog/Scenarios/ColorPicker.cs

@@ -249,7 +249,7 @@ public class ColorPickers : Scenario
     /// <summary>Update a color label from his ColorPicker.</summary>
     private void UpdateColorLabel (Label label, Color color)
     {
-        label.Clear ();
+        label.ClearViewport ();
 
         label.Text =
             $"{color} ({(int)color}) #{color.R:X2}{color.G:X2}{color.B:X2}";

+ 1 - 1
UICatalog/Scenarios/CsvEditor.cs

@@ -638,7 +638,7 @@ public class CsvEditor : Scenario
             tableView.SetNeedsDisplay ();
         };*/
 
-        _tableView.DrawContent += (s, e) =>
+        _tableView.DrawingContent += (s, e) =>
                                   {
                                       scrollBar.Size = _tableView.Table?.Rows ?? 0;
                                       scrollBar.Position = _tableView.RowOffset;

+ 1 - 1
UICatalog/Scenarios/Editor.cs

@@ -296,7 +296,7 @@ public class Editor : Scenario
                                                              _textView.SetNeedsDisplay ();
                                                          };
 
-        _textView.DrawContent += (s, e) =>
+        _textView.DrawingContent += (s, e) =>
                                  {
                                      _scrollBar.Size = _textView.Lines;
                                      _scrollBar.Position = _textView.TopRow;

+ 1 - 1
UICatalog/Scenarios/Images.cs

@@ -114,7 +114,7 @@ public class Images : Scenario
         private Image<Rgba32> _fullResImage;
         private Image<Rgba32> _matchSize;
 
-        protected override bool OnDrawContent (Rectangle bounds)
+        protected override bool OnDrawingContent (Rectangle bounds)
         {
             if (_fullResImage == null)
             {

+ 2 - 2
UICatalog/Scenarios/LineDrawing.cs

@@ -268,7 +268,7 @@ public class DrawingArea : View
     public ITool CurrentTool { get; set; } = new DrawLineTool ();
     public DrawingArea () { AddLayer (); }
 
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         foreach (LineCanvas canvas in Layers)
         {
@@ -375,7 +375,7 @@ public class AttributeView : View
     }
 
     /// <inheritdoc/>
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         Color fg = Value.Foreground;
         Color bg = Value.Background;

+ 1 - 1
UICatalog/Scenarios/ListColumns.cs

@@ -350,7 +350,7 @@ public class ListColumns : Scenario
         };
         */
 
-        _listColView.DrawContent += (s, e) =>
+        _listColView.DrawingContent += (s, e) =>
                                     {
                                         scrollBar.Size = _listColView.Table?.Rows ?? 0;
                                         scrollBar.Position = _listColView.RowOffset;

+ 1 - 1
UICatalog/Scenarios/ListViewWithSelection.cs

@@ -99,7 +99,7 @@ public class ListViewWithSelection : Scenario
             _listView.SetNeedsDisplay ();
         };
 
-        _listView.DrawContent += (s, e) =>
+        _listView.DrawingContent += (s, e) =>
         {
             scrollBar.Size = _listView.Source.Count;
             scrollBar.Position = _listView.TopItem;

+ 2 - 2
UICatalog/Scenarios/ListsAndCombos.cs

@@ -80,7 +80,7 @@ public class ListsAndCombos : Scenario
                                                             listview.SetNeedsDisplay ();
                                                         };
 
-        listview.DrawContent += (s, e) =>
+        listview.DrawingContent += (s, e) =>
                                 {
                                     scrollBar.Size = listview.Source.Count - 1;
                                     scrollBar.Position = listview.TopItem;
@@ -137,7 +137,7 @@ public class ListsAndCombos : Scenario
                                                                comboBox.SetNeedsDisplay ();
                                                            };
 
-        comboBox.DrawContent += (s, e) =>
+        comboBox.DrawingContent += (s, e) =>
                                 {
                                     scrollBarCbx.Size = comboBox.Source.Count;
                                     scrollBarCbx.Position = ((ListView)comboBox.Subviews [1]).TopItem;

+ 2 - 2
UICatalog/Scenarios/Snake.cs

@@ -314,10 +314,10 @@ public class Snake : Scenario
 
         public SnakeState State { get; }
 
-        protected override bool OnDrawContent (Rectangle viewport)
+        protected override bool OnDrawingContent (Rectangle viewport)
         {
             Driver?.SetAttribute (white);
-            Clear ();
+            ClearViewport ();
 
             var canvas = new LineCanvas ();
 

+ 1 - 1
UICatalog/Scenarios/SyntaxHighlighting.cs

@@ -282,7 +282,7 @@ public class SyntaxHighlighting : Scenario
         };
 
         _textView.TextChanged += (s, e) => HighlightTextBasedOnKeywords ();
-        _textView.DrawContent += (s, e) => HighlightTextBasedOnKeywords ();
+        _textView.DrawingContent += (s, e) => HighlightTextBasedOnKeywords ();
         _textView.DrawComplete += (s, e) => HighlightTextBasedOnKeywords ();
     }
 

+ 1 - 1
UICatalog/Scenarios/TableEditor.cs

@@ -1233,7 +1233,7 @@ public class TableEditor : Scenario
             tableView.SetNeedsDisplay ();
         };*/
 
-        _tableView.DrawContent += (s, e) =>
+        _tableView.DrawingContent += (s, e) =>
                                   {
                                       scrollBar.Size = _tableView.Table?.Rows ?? 0;
                                       scrollBar.Position = _tableView.RowOffset;

+ 1 - 1
UICatalog/Scenarios/Text.cs

@@ -72,7 +72,7 @@ public class Text : Scenario
             Height = Dim.Percent (20)
         };
         textView.Text = "TextView with some more test text. Unicode shouldn't 𝔹Aℝ𝔽!";
-        textView.DrawContent += TextView_DrawContent;
+        textView.DrawingContent += TextView_DrawContent;
 
         // This shows how to enable autocomplete in TextView.
         void TextView_DrawContent (object sender, DrawEventArgs e)

+ 1 - 1
UICatalog/Scenarios/TextEffectsScenario.cs

@@ -132,7 +132,7 @@ internal class GradientsView : View
     private const int LABEL_HEIGHT = 1;
     private const int GRADIENT_WITH_LABEL_HEIGHT = GRADIENT_HEIGHT + LABEL_HEIGHT + 1; // +1 for spacing
 
-    protected override bool OnDrawContent (Rectangle viewport)
+    protected override bool OnDrawingContent (Rectangle viewport)
     {
         DrawTopLineGradient (viewport);
 

+ 5 - 5
UICatalog/Scenarios/TextViewAutocompletePopup.cs

@@ -63,7 +63,7 @@ public class TextViewAutocompletePopup : Scenario
             Y = 1,
             Width = width, Height = _height, Text = text
         };
-        _textViewTopLeft.DrawContent += TextViewTopLeft_DrawContent;
+        _textViewTopLeft.DrawingContent += TextViewTopLeft_DrawContent;
         appWindow.Add (_textViewTopLeft);
 
         _textViewTopRight = new()
@@ -71,14 +71,14 @@ public class TextViewAutocompletePopup : Scenario
             X = Pos.AnchorEnd (width), Y = 1,
             Width = width, Height = _height, Text = text
         };
-        _textViewTopRight.DrawContent += TextViewTopRight_DrawContent;
+        _textViewTopRight.DrawingContent += TextViewTopRight_DrawContent;
         appWindow.Add (_textViewTopRight);
 
         _textViewBottomLeft = new()
         {
             Y = Pos.AnchorEnd (_height), Width = width, Height = _height, Text = text
         };
-        _textViewBottomLeft.DrawContent += TextViewBottomLeft_DrawContent;
+        _textViewBottomLeft.DrawingContent += TextViewBottomLeft_DrawContent;
         appWindow.Add (_textViewBottomLeft);
 
         _textViewBottomRight = new()
@@ -89,7 +89,7 @@ public class TextViewAutocompletePopup : Scenario
             Height = _height,
             Text = text
         };
-        _textViewBottomRight.DrawContent += TextViewBottomRight_DrawContent;
+        _textViewBottomRight.DrawingContent += TextViewBottomRight_DrawContent;
         appWindow.Add (_textViewBottomRight);
 
         _textViewCentered = new()
@@ -100,7 +100,7 @@ public class TextViewAutocompletePopup : Scenario
             Height = _height,
             Text = text
         };
-        _textViewCentered.DrawContent += TextViewCentered_DrawContent;
+        _textViewCentered.DrawingContent += TextViewCentered_DrawContent;
         appWindow.Add (_textViewCentered);
 
         _miMultiline.Checked = _textViewTopLeft.Multiline;

+ 1 - 1
UICatalog/Scenarios/TreeViewFileSystem.cs

@@ -395,7 +395,7 @@ public class TreeViewFileSystem : Scenario
                                                             _treeViewFiles.SetNeedsDisplay ();
                                                         };
 
-        _treeViewFiles.DrawContent += (s, e) =>
+        _treeViewFiles.DrawingContent += (s, e) =>
                                       {
                                           scrollBar.Size = _treeViewFiles.ContentHeight;
                                           scrollBar.Position = _treeViewFiles.ScrollOffsetVertical;

+ 1 - 1
UICatalog/Scenarios/Wizards.cs

@@ -326,7 +326,7 @@ public class Wizards : Scenario
                                                                             someText.SetNeedsDisplay ();
                                                                         };
 
-                                           someText.DrawContent += (s, e) =>
+                                           someText.DrawingContent += (s, e) =>
                                                                    {
                                                                        scrollBar.Size = someText.Lines;
                                                                        scrollBar.Position = someText.TopRow;

+ 2 - 2
UnitTests/Application/ApplicationTests.cs

@@ -840,7 +840,7 @@ public class ApplicationTests
         // Don't use Dialog here as it has more layout logic. Use Window instead.
         Dialog d = null;
         Toplevel top = new ();
-        top.DrawContent += (s, a) => count++;
+        top.DrawingContent += (s, a) => count++;
         int iteration = -1;
 
         Application.Iteration += (s, a) =>
@@ -851,7 +851,7 @@ public class ApplicationTests
                                      {
                                          // TODO: Don't use Dialog here as it has more layout logic. Use Window instead.
                                          d = new ();
-                                         d.DrawContent += (s, a) => count++;
+                                         d.DrawingContent += (s, a) => count++;
                                          Application.Run (d);
                                      }
                                      else if (iteration < 3)

+ 2 - 2
UnitTests/Input/ResponderTests.cs

@@ -187,8 +187,8 @@ public class ResponderTests
 
         Assert.True (
                      Responder.IsOverridden (
-                                             new ScrollBarView { Text = "ScrollBarView overrides OnDrawContent" },
-                                             "OnDrawContent"
+                                             new ScrollBarView { Text = "ScrollBarView overrides OnDrawingContent" },
+                                             "OnDrawingContent"
                                             )
                     );
 #if DEBUG_IDISPOSABLE

+ 1 - 1
UnitTests/UICatalog/ScenarioTests.cs

@@ -748,7 +748,7 @@ public class ScenarioTests : TestsAllViews
 
             //DimPosChanged ();
             _hostPane.LayoutSubviews ();
-            _hostPane.Clear ();
+            _hostPane.ClearViewport ();
             _hostPane.SetNeedsDisplay ();
             UpdateSettings (view);
             UpdateTitle (view);

+ 2 - 2
UnitTests/View/Draw/DrawTests.cs

@@ -189,7 +189,7 @@ public class DrawTests (ITestOutputHelper _output)
  └─┘",
                                                       _output);
 
-        view.Clear ();
+        view.ClearViewport ();
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"
@@ -227,7 +227,7 @@ public class DrawTests (ITestOutputHelper _output)
  └─┘",
                                                       _output);
 
-        view.Clear ();
+        view.ClearViewport ();
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"

+ 1 - 1
UnitTests/View/Layout/LayoutTests.cs

@@ -23,7 +23,7 @@ public class LayoutTests (ITestOutputHelper _output) : TestsAllViews
         }
 
         var drawContentCount = 0;
-        view.DrawContent += (s, e) => drawContentCount++;
+        view.DrawingContent += (s, e) => drawContentCount++;
 
         var layoutStartedCount = 0;
         view.SubviewLayout += (s, e) => layoutStartedCount++;

+ 1 - 1
UnitTests/View/TextTests.cs

@@ -278,7 +278,7 @@ Y
         Assert.Equal (new (12, 1), view.TextFormatter.ConstrainToSize);
         Assert.Equal (new (0, 0, 12, 1), view.Frame);
 
-        top.Clear ();
+        top.ClearViewport ();
         view.SetNeedsDisplay ();
         view.Draw ();
         expected = @" HelloWorlds";

+ 3 - 3
UnitTests/View/ViewTests.cs

@@ -12,7 +12,7 @@ public class ViewTests (ITestOutputHelper output)
     {
         var view = new FrameView { Width = Dim.Fill (), Height = Dim.Fill () };
 
-        view.DrawContent += (s, e) =>
+        view.DrawingContent += (s, e) =>
                             {
                                 Rectangle savedClip = Application.Driver!.Clip;
                                 Application.Driver!.Clip = new (1, 1, view.Viewport.Width, view.Viewport.Height);
@@ -76,7 +76,7 @@ public class ViewTests (ITestOutputHelper output)
     {
         var view = new FrameView { Width = Dim.Fill (), Height = Dim.Fill () };
 
-        view.DrawContent += (s, e) =>
+        view.DrawingContent += (s, e) =>
                             {
                                 Rectangle savedClip = Application.Driver!.Clip;
                                 Application.Driver!.Clip = new (1, 1, view.Viewport.Width, view.Viewport.Height);
@@ -1102,7 +1102,7 @@ At 0,0
         public bool IsKeyUp { get; set; }
         public override string Text { get; set; }
 
-        protected override bool OnDrawContent (Rectangle viewport)
+        protected override bool OnDrawingContent (Rectangle viewport)
         {
             var idx = 0;
 

+ 1 - 1
UnitTests/Views/LabelTests.cs

@@ -1077,7 +1077,7 @@ e
         Assert.Equal (10, text.Length);
         label.Width = Dim.Fill () - text.Length;
         win.LayoutSubviews ();
-        win.Clear ();
+        win.ClearViewport ();
         win.Draw ();
 
         Assert.Equal (Rectangle.Empty, label.Frame);

+ 4 - 4
UnitTests/Views/ScrollBarViewTests.cs

@@ -434,7 +434,7 @@ This is a test
 
                                                                                   };
 
-                                              listView.DrawContent += (s, e) =>
+                                              listView.DrawingContent += (s, e) =>
                                                                       {
                                                                           newScrollBarView.Size = listView.MaxLength;
                                                                           Assert.Equal (newScrollBarView.Size, listView.MaxLength);
@@ -515,7 +515,7 @@ This is a test
 
                                                                                         };
 
-                                                    listView.DrawContent += (s, e) =>
+                                                    listView.DrawingContent += (s, e) =>
                                                                             {
                                                                                 newScrollBarView.Size = listView.Source.Count;
                                                                                 Assert.Equal (newScrollBarView.Size, listView.Source.Count);
@@ -1327,7 +1327,7 @@ This is a test             ",
     {
         if (!_added)
         {
-            _hostView.DrawContent += _hostView_DrawContent;
+            _hostView.DrawingContent += _hostView_DrawContent;
             _scrollBar.ChangedPosition += _scrollBar_ChangedPosition;
             _scrollBar.OtherScrollBarView.ChangedPosition += _scrollBar_OtherScrollBarView_ChangedPosition;
         }
@@ -1339,7 +1339,7 @@ This is a test             ",
     {
         if (_added)
         {
-            _hostView.DrawContent -= _hostView_DrawContent;
+            _hostView.DrawingContent -= _hostView_DrawContent;
             _scrollBar.ChangedPosition -= _scrollBar_ChangedPosition;
             _scrollBar.OtherScrollBarView.ChangedPosition -= _scrollBar_OtherScrollBarView_ChangedPosition;
         }