diff --git a/Terminal.Gui/Text/Autocomplete/PopupAutocomplete.PopUp.cs b/Terminal.Gui/Text/Autocomplete/PopupAutocomplete.PopUp.cs
index d783785bb..84923fd98 100644
--- a/Terminal.Gui/Text/Autocomplete/PopupAutocomplete.PopUp.cs
+++ b/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)
{
diff --git a/Terminal.Gui/View/Adornment/Adornment.cs b/Terminal.Gui/View/Adornment/Adornment.cs
index e2aebda10..c63c90f8a 100644
--- a/Terminal.Gui/View/Adornment/Adornment.cs
+++ b/Terminal.Gui/View/Adornment/Adornment.cs
@@ -157,11 +157,16 @@ public class Adornment : View, IDesignable
/// Does nothing for Adornment
///
- protected override bool OnDrawAdornments () { return false; }
+ protected override bool OnDrawingAdornments () { return false; }
///
- 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
}
///
- protected override bool OnDrawSubviews (Rectangle viewport)
+ protected override bool OnDrawingText (Rectangle viewport)
{
- return false;
+ return Thickness == Thickness.Empty;
+ }
+
+ ///
+ protected override bool OnDrawingSubviews (Rectangle viewport)
+ {
+ return Thickness == Thickness.Empty;
}
/// Does nothing for Adornment
///
- protected override bool OnRenderLineCanvas () { return true; }
+ protected override bool OnRenderingLineCanvas () { return true; }
///
/// Adornments only render to their 's or Parent's SuperView's LineCanvas, so setting this
@@ -194,9 +205,7 @@ public class Adornment : View, IDesignable
///
protected override bool OnDrawComplete (Rectangle viewport)
{
-
-
- return false;
+ return Thickness == Thickness.Empty;
}
///
diff --git a/Terminal.Gui/View/Adornment/Border.cs b/Terminal.Gui/View/Adornment/Border.cs
index 1cfea3b8d..ecbc2d727 100644
--- a/Terminal.Gui/View/Adornment/Border.cs
+++ b/Terminal.Gui/View/Adornment/Border.cs
@@ -606,7 +606,7 @@ public class Border : Adornment
#endregion Mouse Support
///
- protected override bool OnDrawContent (Rectangle viewport)
+ protected override bool OnDrawingContent (Rectangle viewport)
{
if (Thickness == Thickness.Empty)
{
diff --git a/Terminal.Gui/View/Adornment/Margin.cs b/Terminal.Gui/View/Adornment/Margin.cs
index 29463a149..87393598a 100644
--- a/Terminal.Gui/View/Adornment/Margin.cs
+++ b/Terminal.Gui/View/Adornment/Margin.cs
@@ -68,7 +68,7 @@ public class Margin : Adornment
}
///
- protected override bool OnClearViewport (Rectangle viewport)
+ protected override bool OnClearingViewport (Rectangle viewport)
{
if (Thickness == Thickness.Empty)
{
diff --git a/Terminal.Gui/View/Adornment/ShadowView.cs b/Terminal.Gui/View/Adornment/ShadowView.cs
index c53570b88..befe31509 100644
--- a/Terminal.Gui/View/Adornment/ShadowView.cs
+++ b/Terminal.Gui/View/Adornment/ShadowView.cs
@@ -37,14 +37,14 @@ internal class ShadowView : View
}
///
- protected override bool OnClearViewport (Rectangle viewport)
+ protected override bool OnClearingViewport (Rectangle viewport)
{
// Prevent clearing (so we can have transparency)
return true;
}
///
- protected override bool OnDrawContent (Rectangle viewport)
+ protected override bool OnDrawingContent (Rectangle viewport)
{
switch (ShadowStyle)
{
diff --git a/Terminal.Gui/View/DrawEventArgs.cs b/Terminal.Gui/View/DrawEventArgs.cs
index 32c07c711..ff54c166e 100644
--- a/Terminal.Gui/View/DrawEventArgs.cs
+++ b/Terminal.Gui/View/DrawEventArgs.cs
@@ -1,7 +1,9 @@
-namespace Terminal.Gui;
+using System.ComponentModel;
+
+namespace Terminal.Gui;
/// Event args for draw events
-public class DrawEventArgs : EventArgs
+public class DrawEventArgs : CancelEventArgs
{
/// Creates a new instance of the class.
///
diff --git a/Terminal.Gui/View/View.Color.cs b/Terminal.Gui/View/View.Color.cs
new file mode 100644
index 000000000..9e040e7f9
--- /dev/null
+++ b/Terminal.Gui/View/View.Color.cs
@@ -0,0 +1,120 @@
+namespace Terminal.Gui;
+
+public partial class View
+{
+ private ColorScheme _colorScheme;
+
+ /// The color scheme for this view, if it is not defined, it returns the 's color scheme.
+ 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 ();
+ }
+ }
+ }
+
+ /// Determines the current based on the value.
+ ///
+ /// if is or
+ /// if is . If it's
+ /// overridden can return other values.
+ ///
+ public virtual Attribute GetFocusColor ()
+ {
+ ColorScheme cs = ColorScheme;
+
+ if (cs is null)
+ {
+ cs = new ();
+ }
+
+ return Enabled ? GetColor (cs.Focus) : cs.Disabled;
+ }
+
+ /// Determines the current based on the value.
+ ///
+ /// if is or
+ /// if is . If it's
+ /// overridden can return other values.
+ ///
+ public virtual Attribute GetHotFocusColor ()
+ {
+ ColorScheme cs = ColorScheme ?? new ();
+
+ return Enabled ? GetColor (cs.HotFocus) : cs.Disabled;
+ }
+
+ /// Determines the current based on the value.
+ ///
+ /// if is or
+ /// if is . If it's
+ /// overridden can return other values.
+ ///
+ public virtual Attribute GetHotNormalColor ()
+ {
+ ColorScheme cs = ColorScheme;
+
+ if (cs is null)
+ {
+ cs = new ();
+ }
+
+ return Enabled ? GetColor (cs.HotNormal) : cs.Disabled;
+ }
+
+ /// Determines the current based on the value.
+ ///
+ /// if is or
+ /// if is . If it's
+ /// overridden can return other values.
+ ///
+ 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;
+ }
+}
diff --git a/Terminal.Gui/View/View.Content.cs b/Terminal.Gui/View/View.Content.cs
index a8a5fcde3..c7d3ccdc5 100644
--- a/Terminal.Gui/View/View.Content.cs
+++ b/Terminal.Gui/View/View.Content.cs
@@ -265,7 +265,7 @@ public partial class View
///
///
/// Altering the Viewport Size will eventually (when the view is next laid out) cause the
- /// and methods to be called.
+ /// and methods to be called.
///
///
public virtual Rectangle Viewport
diff --git a/Terminal.Gui/View/View.Drawing.cs b/Terminal.Gui/View/View.Drawing.cs
index e8bc2ef9e..25d6c24f3 100644
--- a/Terminal.Gui/View/View.Drawing.cs
+++ b/Terminal.Gui/View/View.Drawing.cs
@@ -1,53 +1,41 @@
#nullable enable
using System.Diagnostics;
-using System.Reflection.Metadata;
namespace Terminal.Gui;
public partial class View // Drawing APIs
{
- private ColorScheme? _colorScheme;
+ #region Drawing Primitives
- /// The color scheme for this view, if it is not defined, it returns the 's color scheme.
- public virtual ColorScheme? ColorScheme
+ /// Moves the drawing cursor to the specified -relative location in the view.
+ ///
+ ///
+ /// If the provided coordinates are outside the visible content area, this method does nothing.
+ ///
+ ///
+ /// The top-left corner of the visible content area is ViewPort.Location.
+ ///
+ ///
+ /// Column (viewport-relative).
+ /// Row (viewport-relative).
+ 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 (col < 0 || row < 0 || col >= Viewport.Width || row >= Viewport.Height)
{
- if (_colorScheme != value)
- {
- _colorScheme = value;
-
- if (Border is { } && Border.LineStyle != LineStyle.None && Border.ColorScheme is { })
- {
- Border.ColorScheme = _colorScheme;
- }
-
- SetNeedsDisplay ();
- }
+ return false;
}
+
+ Point screen = ViewportToScreen (new Point (col, row));
+ Driver?.Move (screen.X, screen.Y);
+
+ return true;
}
- /// The canvas that any line drawing that is to be shared by subviews of this view should add lines to.
- /// adds border lines to this LineCanvas.
- public LineCanvas LineCanvas { get; } = new ();
-
- ///
- /// Gets or sets whether this View will use it's SuperView's for rendering any
- /// lines. If the rendering of any borders drawn by this Frame will be done by its parent's
- /// SuperView. If (the default) this View's method will be
- /// called to render the borders.
- ///
- public virtual bool SuperViewRendersLineCanvas { get; set; } = false;
-
/// Draws the specified character in the specified viewport-relative column and row of the View.
///
/// If the provided coordinates are outside the visible content area, this method does nothing.
@@ -66,477 +54,6 @@ public partial class View // Drawing APIs
}
}
- /// Clears with the normal background.
- ///
- ///
- /// If has only
- /// the portion of the content
- /// area that is visible within the will be cleared. This is useful for views that have
- /// a
- /// content area larger than the Viewport (e.g. when is
- /// enabled) and want
- /// the area outside the content to be visually distinct.
- ///
- ///
- public void Clear ()
- {
- 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 ();
- }
-
- /// Fills the specified -relative rectangle with the specified color.
- /// The Viewport-relative rectangle to clear.
- /// The color to use to fill the rectangle. If not provided, the Normal background color will be used.
- public void FillRect (Rectangle rect, Color? color = null)
- {
- if (Driver is null)
- {
- return;
- }
-
- // Get screen-relative coords
- Rectangle toClear = ViewportToScreen (rect);
-
- Rectangle prevClip = Driver.Clip;
-
- Driver.Clip = Rectangle.Intersect (prevClip, ViewportToScreen (Viewport with { Location = new (0, 0) }));
-
- Attribute prev = Driver.SetAttribute (new (color ?? GetNormalColor ().Background));
- Driver.FillRect (toClear);
- Driver.SetAttribute (prev);
-
- Driver.Clip = prevClip;
- }
-
- /// Sets the 's clip region to .
- ///
- ///
- /// By default, the clip rectangle is set to the intersection of the current clip region and the
- /// . This ensures that drawing is constrained to the viewport, but allows
- /// content to be drawn beyond the viewport.
- ///
- ///
- /// If has set, clipping will be
- /// applied to just the visible content area.
- ///
- ///
- ///
- /// The current screen-relative clip region, which can be then re-applied by setting
- /// .
- ///
- public Rectangle SetClip ()
- {
- if (Driver is null)
- {
- return Rectangle.Empty;
- }
-
- Rectangle previous = Driver.Clip;
-
- // Clamp the Clip to the entire visible area
- Rectangle clip = Rectangle.Intersect (ViewportToScreen (Viewport with { Location = Point.Empty }), previous);
-
- if (ViewportSettings.HasFlag (ViewportSettings.ClipContentOnly))
- {
- // Clamp the Clip to the just content area that is within the viewport
- Rectangle visibleContent = ViewportToScreen (new Rectangle (new (-Viewport.X, -Viewport.Y), GetContentSize ()));
- clip = Rectangle.Intersect (clip, visibleContent);
- }
-
- Driver.Clip = clip;
-
- return previous;
- }
-
- ///
- /// Draws the view if it needs to be drawn. Causes the following virtual methods to be called (along with their related
- /// events):
- /// , .
- ///
- ///
- ///
- /// The view will only be drawn if it is visible, and has any of ,
- /// ,
- /// or set.
- ///
- ///
- /// Always use (view-relative) when calling , NOT
- /// (superview-relative).
- ///
- ///
- /// 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.
- ///
- ///
- /// Overrides of must ensure they do not set Driver.Clip to a clip
- /// region larger than the property, as this will cause the driver to clip the entire
- /// region.
- ///
- ///
- public void Draw ()
- {
- if (!CanBeVisible (this))
- {
- return;
- }
-
- if (!NeedsDisplay && !SubViewNeedsDisplay)
- {
- return;
- }
-
- DoDrawAdornments ();
-
- if (ColorScheme is { })
- {
- Driver?.SetAttribute (GetNormalColor ());
- }
-
- // By default, we clip to the viewport preventing drawing outside the viewport
- // We also clip to the content, but if a developer wants to draw outside the viewport, they can do
- // so via settings. SetClip honors the ViewportSettings.DisableVisibleContentClipping flag.
- Rectangle prevClip = SetClip ();
-
- // Clear Viewport
- DoClearViewport (Viewport);
-
- // Draw Text
- DoDrawText (Viewport);
-
- // Draw Content
- DoDrawContent (Viewport);
-
- // Draw Subviews
- DoDrawSubviews (Viewport);
-
- if (Driver is { })
- {
- Driver.Clip = prevClip;
- }
-
- DoRenderLineCanvas ();
-
- DoDrawAdornmentSubViews ();
-
- ClearNeedsDisplay ();
-
- // We're done
- DoDrawComplete (Viewport);
- }
-
- private void DoDrawAdornmentSubViews ()
- {
- if (Margin?.Subviews is { })
- {
- foreach (View subview in Margin.Subviews)
- {
- 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);
- }
- }
-
- internal void DoDrawAdornments ()
- {
- if (OnDrawAdornments ())
- {
- return;
- }
-
- // TODO: add event.
-
- // Each of these renders lines to either this View's LineCanvas
- // Those lines will be finally rendered in OnRenderLineCanvas
- Margin?.Draw (); //OnDrawContent (Margin.Viewport);
- Border?.Draw ();
- Padding?.Draw (); //OnDrawContent (Padding.Viewport);
-
- }
-
- ///
- /// Called when the View's adornments are to be drawn. Prepares . If is true, only the
- /// of this view's subviews will be rendered. If is
- /// false (the default), this method will cause the be prepared to be rendered.
- ///
- ///
- protected virtual bool OnDrawAdornments ()
- {
- return false;
- }
- #region ClearViewport
-
- private void DoClearViewport (Rectangle viewport)
- {
- Debug.Assert (viewport == Viewport);
-
- if (OnClearViewport (Viewport))
- {
- return;
- }
-
- var dev = new DrawEventArgs (Viewport, Rectangle.Empty);
- ClearViewport?.Invoke (this, dev);
-
- // BUGBUG: this clears way too frequently. Need to optimize this.
- if (NeedsDisplay /* || Arrangement.HasFlag (ViewArrangement.Overlapped)*/)
- {
- Clear ();
- }
- }
-
- protected virtual bool OnClearViewport (Rectangle viewport) { return false; }
-
- /// Event invoked when the content area of the View is to be drawn.
- ///
- /// Will be invoked before any subviews added with have been drawn.
- ///
- /// Rect provides the view-relative rectangle describing the currently visible viewport into the
- /// .
- ///
- ///
- public event EventHandler? ClearViewport;
-
- #endregion ClearViewport
-
- #region DrawText
-
- private void DoDrawText (Rectangle viewport)
- {
- Debug.Assert(viewport == Viewport);
-
-
- if (OnDrawText (Viewport))
- {
- return;
- }
-
- var dev = new DrawEventArgs (Viewport, Rectangle.Empty);
- DrawText?.Invoke (this, dev);
-
- if (!string.IsNullOrEmpty (TextFormatter.Text))
- {
- TextFormatter.NeedsFormat = true;
- }
-
- // This should NOT clear
- // 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
- );
- SetSubViewNeedsDisplay ();
- }
-
- protected virtual bool OnDrawText (Rectangle viewport) { return false; }
-
- /// Event invoked when the content area of the View is to be drawn.
- ///
- /// Will be invoked before any subviews added with have been drawn.
- ///
- /// Rect provides the view-relative rectangle describing the currently visible viewport into the
- /// .
- ///
- ///
- public event EventHandler? DrawText;
-
- #endregion DrawText
-
- #region DrawContent
-
- private void DoDrawContent (Rectangle viewport)
- {
- Debug.Assert (viewport == Viewport);
- if (OnDrawContent (Viewport))
- {
- return;
- }
-
- var dev = new DrawEventArgs (Viewport, Rectangle.Empty);
- DrawContent?.Invoke (this, dev);
- }
-
- ///
- /// Called when the View's content is to be drawn.
- ///
- ///
- ///
- /// The parameter is provided as a convenience; it has the same values as the
- /// property.
- ///
- ///
- /// The Location and Size indicate what part of the View's content, defined
- /// by , is visible and should be drawn. The coordinates taken by
- /// and
- /// are relative to , thus if ViewPort.Location.Y is 5
- /// the 6th row of the content should be drawn using MoveTo (x, 5).
- ///
- ///
- /// If is larger than ViewPort.Size drawing code should use
- ///
- /// to constrain drawing for better performance.
- ///
- ///
- /// The may define smaller area than ; complex drawing code
- /// can be more
- /// efficient by using to constrain drawing for better performance.
- ///
- ///
- /// Overrides should loop through the subviews and call .
- ///
- ///
- ///
- /// The rectangle describing the currently visible viewport into the ; has the same value as
- /// .
- ///
- protected virtual bool OnDrawContent (Rectangle viewport) { return false; }
-
- /// Event invoked when the content area of the View is to be drawn.
- ///
- /// Will be invoked before any subviews added with have been drawn.
- ///
- /// Rect provides the view-relative rectangle describing the currently visible viewport into the
- /// .
- ///
- ///
- public event EventHandler? DrawContent;
-
- #endregion DrawContent
-
- #region DrawSubviews
-
- internal 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)
- {
- return;
- }
-
- IEnumerable 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; }
-
- /// Event invoked when the content area of the View is to be drawn.
- ///
- /// Will be invoked before any subviews added with have been drawn.
- ///
- /// Rect provides the view-relative rectangle describing the currently visible viewport into the
- /// .
- ///
- ///
- public event EventHandler? DrawSubviews;
-
- #endregion DrawSubviews
-
-
- #region DrawComplete
-
- private void DoDrawComplete (Rectangle viewport)
- {
- Debug.Assert (viewport == Viewport);
- if (OnDrawComplete (Viewport))
- {
- return;
- }
-
- var dev = new DrawEventArgs (Viewport, Rectangle.Empty);
- DrawComplete?.Invoke (this, dev);
- }
-
- protected virtual bool OnDrawComplete (Rectangle viewport) { return false; }
-
- /// Event invoked when the View is completed drawing.
- ///
- ///
- /// Rect provides the view-relative rectangle describing the currently visible viewport into the
- /// .
- ///
- ///
- public event EventHandler? DrawComplete;
-
-
- #endregion DrawComplete
-
/// Utility function to draw strings that contain a hotkey.
/// String to display, the hotkey specifier before a letter flags the next letter as the hotkey.
/// Hot color.
@@ -592,130 +109,489 @@ public partial class View // Drawing APIs
}
}
- /// Determines the current based on the value.
- ///
- /// if is or
- /// if is . If it's
- /// overridden can return other values.
- ///
- public virtual Attribute GetFocusColor ()
+ /// Fills the specified -relative rectangle with the specified color.
+ /// The Viewport-relative rectangle to clear.
+ /// The color to use to fill the rectangle. If not provided, the Normal background color will be used.
+ public void FillRect (Rectangle rect, Color? color = null)
{
- ColorScheme? cs = ColorScheme;
-
- if (cs is null)
+ if (Driver is null)
{
- cs = new ();
+ return;
}
- return Enabled ? GetColor (cs.Focus) : cs.Disabled;
+ // Get screen-relative coords
+ Rectangle toClear = ViewportToScreen (rect);
+
+ Rectangle prevClip = Driver.Clip;
+
+ Driver.Clip = Rectangle.Intersect (prevClip, ViewportToScreen (Viewport with { Location = new (0, 0) }));
+
+ Attribute prev = Driver.SetAttribute (new (color ?? GetNormalColor ().Background));
+ Driver.FillRect (toClear);
+ Driver.SetAttribute (prev);
+
+ Driver.Clip = prevClip;
}
- /// Determines the current based on the value.
- ///
- /// if is or
- /// if is . If it's
- /// overridden can return other values.
- ///
- public virtual Attribute GetHotFocusColor ()
- {
- ColorScheme? cs = ColorScheme ?? new ();
+ #endregion Drawing Primitives
- return Enabled ? GetColor (cs.HotFocus) : cs.Disabled;
- }
+ #region Clipping
- /// Determines the current based on the value.
- ///
- /// if is or
- /// if is . If it's
- /// overridden can return other values.
- ///
- public virtual Attribute GetHotNormalColor ()
- {
- ColorScheme? cs = ColorScheme;
-
- if (cs is null)
- {
- cs = new ();
- }
-
- return Enabled ? GetColor (cs.HotNormal) : cs.Disabled;
- }
-
- /// Determines the current based on the value.
- ///
- /// if is or
- /// if is . If it's
- /// overridden can return other values.
- ///
- 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;
- }
-
- /// Moves the drawing cursor to the specified -relative location in the view.
+ /// Sets the 's clip region to .
///
///
- /// If the provided coordinates are outside the visible content area, this method does nothing.
+ /// By default, the clip rectangle is set to the intersection of the current clip region and the
+ /// . This ensures that drawing is constrained to the viewport, but allows
+ /// content to be drawn beyond the viewport.
///
///
- /// The top-left corner of the visible content area is ViewPort.Location.
+ /// If has set, clipping will be
+ /// applied to just the visible content area.
///
///
- /// Column (viewport-relative).
- /// Row (viewport-relative).
- public bool Move (int col, int row)
+ ///
+ /// The current screen-relative clip region, which can be then re-applied by setting
+ /// .
+ ///
+ public Rectangle SetClip ()
{
- if (Driver is null || Driver?.Rows == 0)
+ if (Driver is null)
{
- return false;
+ return Rectangle.Empty;
}
- if (col < 0 || row < 0 || col >= Viewport.Width || row >= Viewport.Height)
+ Rectangle previous = Driver.Clip;
+
+ // Clamp the Clip to the entire visible area
+ Rectangle clip = Rectangle.Intersect (ViewportToScreen (Viewport with { Location = Point.Empty }), previous);
+
+ if (ViewportSettings.HasFlag (ViewportSettings.ClipContentOnly))
{
- return false;
+ // Clamp the Clip to the just content area that is within the viewport
+ Rectangle visibleContent = ViewportToScreen (new Rectangle (new (-Viewport.X, -Viewport.Y), GetContentSize ()));
+ clip = Rectangle.Intersect (clip, visibleContent);
}
- Point screen = ViewportToScreen (new Point (col, row));
- Driver?.Move (screen.X, screen.Y);
+ Driver.Clip = clip;
- return true;
+ return previous;
}
+ #endregion Clipping
+
+ #region Drawing Engine
+
+ ///
+ /// Draws the view if it needs to be drawn.
+ ///
+ ///
+ ///
+ /// The view will only be drawn if it is visible, and has any of ,
+ /// ,
+ /// or set.
+ ///
+ ///
+ /// // TODO: Add docs for the drawing process.
+ ///
+ ///
+ public void Draw ()
+ {
+ if (!CanBeVisible (this))
+ {
+ return;
+ }
+
+ if (!NeedsDisplay && !SubViewNeedsDisplay)
+ {
+ return;
+ }
+
+ DoDrawAdornments ();
+
+ if (ColorScheme is { })
+ {
+ Driver?.SetAttribute (GetNormalColor ());
+ }
+
+ // By default, we clip to the viewport preventing drawing outside the viewport
+ // We also clip to the content, but if a developer wants to draw outside the viewport, they can do
+ // so via settings. SetClip honors the ViewportSettings.DisableVisibleContentClipping flag.
+ Rectangle prevClip = SetClip ();
+
+ // Clear Viewport
+ DoClearViewport (Viewport);
+
+ // Draw Text
+ DoDrawText (Viewport);
+
+ // Draw Content
+ DoDrawContent (Viewport);
+
+ // Draw Subviews
+ DoDrawSubviews (Viewport);
+
+ if (Driver is { })
+ {
+ Driver.Clip = prevClip;
+ }
+
+ DoRenderLineCanvas ();
+
+ DoDrawAdornmentSubViews ();
+
+ ClearNeedsDisplay ();
+
+ // We're done
+ DoDrawComplete (Viewport);
+ }
+
+ #region DrawAdornments
+
+ private void DoDrawAdornmentSubViews ()
+ {
+ if (Margin?.Subviews is { })
+ {
+ foreach (View subview in Margin.Subviews)
+ {
+ 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 (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 ();
+ Border?.Draw ();
+ Padding?.Draw ();
+ }
+
+ ///
+ /// Called when the View's Adornments are to be drawn. Prepares . If
+ /// is true, only the
+ /// of this view's subviews will be rendered. If is
+ /// false (the default), this method will cause the be prepared to be rendered.
+ ///
+ /// to stop further drawing of the Adornments.
+ protected virtual bool OnDrawingAdornments () { return false; }
+
+ #endregion DrawAdornments
+
+ #region ClearViewport
+
+ private void DoClearViewport (Rectangle viewport)
+ {
+ Debug.Assert (viewport == Viewport);
+
+ if (OnClearingViewport (Viewport))
+ {
+ return;
+ }
+
+ var dev = new DrawEventArgs (Viewport, Rectangle.Empty);
+ ClearingViewport?.Invoke (this, dev);
+
+ if (dev.Cancel)
+ {
+ return;
+ }
+
+ ClearViewport ();
+ }
+
+ ///
+ /// Called when the is to be cleared.
+ ///
+ ///
+ /// to stop further clearing.
+ protected virtual bool OnClearingViewport (Rectangle viewport) { return false; }
+
+ /// Event invoked when the content area of the View is to be drawn.
+ ///
+ /// Will be invoked before any subviews added with have been drawn.
+ ///
+ /// Rect provides the view-relative rectangle describing the currently visible viewport into the
+ /// .
+ ///
+ ///
+ public event EventHandler? ClearingViewport;
+
+ /// Clears with the normal background.
+ ///
+ ///
+ /// If has only
+ /// the portion of the content
+ /// area that is visible within the will be cleared. This is useful for views that have
+ /// a
+ /// content area larger than the Viewport (e.g. when is
+ /// enabled) and want
+ /// the area outside the content to be visually distinct.
+ ///
+ ///
+ 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
+
+ #region DrawText
+
+ private void DoDrawText (Rectangle viewport)
+ {
+ Debug.Assert (viewport == Viewport);
+
+ if (OnDrawingText (Viewport))
+ {
+ return;
+ }
+
+ var dev = new DrawEventArgs (Viewport, Rectangle.Empty);
+ DrawingText?.Invoke (this, dev);
+
+ if (dev.Cancel)
+ {
+ return;
+ }
+
+ DrawText ();
+ }
+
+ ///
+ /// Called when the of the View is to be drawn.
+ ///
+ ///
+ /// to stop further drawing of .
+ protected virtual bool OnDrawingText (Rectangle viewport) { return false; }
+
+ /// Raised when the of the View is to be drawn.
+ ///
+ /// Set to to stop further drawing of
+ /// .
+ ///
+ public event EventHandler? DrawingText;
+
+ ///
+ /// Draws the of the View using the .
+ ///
+ public void DrawText ()
+ {
+ if (!string.IsNullOrEmpty (TextFormatter.Text))
+ {
+ TextFormatter.NeedsFormat = true;
+ }
+
+ // This should NOT clear
+ // TODO: If the output is not in the Viewport, do nothing
+ var drawRect = new Rectangle (ContentToScreen (Point.Empty), GetContentSize ());
+
+ 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 ();
+ }
+
+ #endregion DrawText
+
+ #region DrawContent
+
+ private void DoDrawContent (Rectangle viewport)
+ {
+ Debug.Assert (viewport == Viewport);
+
+ if (OnDrawingContent (Viewport))
+ {
+ return;
+ }
+
+ var dev = new DrawEventArgs (Viewport, Rectangle.Empty);
+ DrawingContent?.Invoke (this, dev);
+
+ if (dev.Cancel)
+ { }
+
+ // Do nothing.
+ }
+
+ ///
+ /// Called when the View's content is to be drawn. The default implementation does nothing.
+ ///
+ ///
+ ///
+ /// to stop further drawing content.
+ protected virtual bool OnDrawingContent (Rectangle viewport) { return false; }
+
+ /// Raised when the View's content is to be drawn.
+ ///
+ /// Will be invoked before any subviews added with have been drawn.
+ ///
+ /// Rect provides the view-relative rectangle describing the currently visible viewport into the
+ /// .
+ ///
+ ///
+ public event EventHandler? DrawingContent;
+
+ #endregion DrawContent
+
+ #region DrawSubviews
+
+ private void DoDrawSubviews (Rectangle viewport)
+ {
+ Debug.Assert (viewport == Viewport);
+
+ if (OnDrawingSubviews (Viewport))
+ {
+ return;
+ }
+
+ var dev = new DrawEventArgs (Viewport, Rectangle.Empty);
+ DrawingSubviews?.Invoke (this, dev);
+
+ if (dev.Cancel)
+ {
+ return;
+ }
+
+ DrawSubviews ();
+ }
+
+ ///
+ /// Called when the are to be drawn.
+ ///
+ ///
+ /// to stop further drawing of .
+ protected virtual bool OnDrawingSubviews (Rectangle viewport) { return false; }
+
+ /// Raised when the are to be drawn.
+ ///
+ ///
+ ///
+ /// Set to to stop further drawing of
+ /// .
+ ///
+ public event EventHandler? DrawingSubviews;
+
+ ///
+ /// Draws the .
+ ///
+ public void DrawSubviews ()
+ {
+ if (_subviews is null || !SubViewNeedsDisplay)
+ {
+ return;
+ }
+
+ IEnumerable subviewsNeedingDraw = _subviews.Where (view => view.Visible && (view.NeedsDisplay || view.SubViewNeedsDisplay));
+
+ foreach (View view in subviewsNeedingDraw)
+ {
+ view.Draw ();
+ }
+ }
+
+ #endregion DrawSubviews
+
+ #region DrawLineCanvas
+
internal void DoRenderLineCanvas ()
{
- if (OnRenderLineCanvas ())
+ if (OnRenderingLineCanvas ())
{
return;
}
// TODO: Add event
+ RenderLineCanvas ();
+ }
+
+ ///
+ /// Called when the is to be rendered. See .
+ ///
+ /// to stop further drawing of .
+ protected virtual bool OnRenderingLineCanvas () { return false; }
+
+ /// The canvas that any line drawing that is to be shared by subviews of this view should add lines to.
+ /// adds border lines to this LineCanvas.
+ public LineCanvas LineCanvas { get; } = new ();
+
+ ///
+ /// Gets or sets whether this View will use it's SuperView's for rendering any
+ /// lines. If the rendering of any borders drawn by this Frame will be done by its parent's
+ /// SuperView. If (the default) this View's method will be
+ /// called to render the borders.
+ ///
+ public virtual bool SuperViewRendersLineCanvas { get; set; } = false;
+
+ ///
+ /// Causes the contents of to be drawn.
+ /// If is true, only the
+ /// of this view's subviews will be rendered. If is
+ /// false (the default), this method will cause the to be rendered.
+ ///
+ public void RenderLineCanvas ()
+ {
+ // TODO: This is super confusing and needs to be refactored.
+
if (Driver is null)
{
return;
@@ -765,17 +641,40 @@ public partial class View // Drawing APIs
LineCanvas.Clear ();
}
}
+ #endregion DrawLineCanvas
+
+ #region DrawComplete
+
+ private void DoDrawComplete (Rectangle viewport)
+ {
+ 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.
+ }
///
- /// Renders . If is true, only the
- /// of this view's subviews will be rendered. If is
- /// false (the default), this method will cause the to be rendered.
+ /// Called when the View is completed drawing.
///
- ///
- protected virtual bool OnRenderLineCanvas ()
- {
- return false;
- }
+ ///
+ protected virtual bool OnDrawComplete (Rectangle viewport) { return false; }
+
+ /// Raised when the View is completed drawing.
+ ///
+ ///
+ public event EventHandler? DrawComplete;
+
+ #endregion DrawComplete
#region NeedsDisplay
@@ -789,7 +688,7 @@ public partial class View // Drawing APIs
/// Gets or sets whether the view needs to be redrawn.
///
///
- /// Will be if the property is or if
+ /// Will be if the property is or if
/// any part of the view's needs to be redrawn.
///
///
@@ -916,4 +815,6 @@ public partial class View // Drawing APIs
}
#endregion NeedsDisplay
+
+ #endregion Drawing Engine
}
diff --git a/Terminal.Gui/View/ViewportSettings.cs b/Terminal.Gui/View/ViewportSettings.cs
index f023d3f75..f7e8488c1 100644
--- a/Terminal.Gui/View/ViewportSettings.cs
+++ b/Terminal.Gui/View/ViewportSettings.cs
@@ -94,7 +94,7 @@ public enum ViewportSettings
ClipContentOnly = 16,
///
- /// If set will clear only the portion of the content
+ /// If set will clear only the portion of the content
/// area that is visible within the . 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.
///
diff --git a/Terminal.Gui/Views/ColorBar.cs b/Terminal.Gui/Views/ColorBar.cs
index bc0a57b4a..a7ffb0605 100644
--- a/Terminal.Gui/Views/ColorBar.cs
+++ b/Terminal.Gui/Views/ColorBar.cs
@@ -82,7 +82,7 @@ internal abstract class ColorBar : View, IColorBar
}
///
- protected override bool OnDrawContent (Rectangle viewport)
+ protected override bool OnDrawingContent (Rectangle viewport)
{
var xOffset = 0;
diff --git a/Terminal.Gui/Views/ColorPicker.16.cs b/Terminal.Gui/Views/ColorPicker.16.cs
index 91dd2feee..33043cad7 100644
--- a/Terminal.Gui/Views/ColorPicker.16.cs
+++ b/Terminal.Gui/Views/ColorPicker.16.cs
@@ -131,9 +131,9 @@ public class ColorPicker16 : View
}
///
- 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;
diff --git a/Terminal.Gui/Views/ColorPicker.cs b/Terminal.Gui/Views/ColorPicker.cs
index d9eabf580..bab8264f8 100644
--- a/Terminal.Gui/Views/ColorPicker.cs
+++ b/Terminal.Gui/Views/ColorPicker.cs
@@ -99,7 +99,7 @@ public partial class ColorPicker : View
public event EventHandler? ColorChanged;
///
- protected override bool OnDrawContent (Rectangle viewport)
+ protected override bool OnDrawingContent (Rectangle viewport)
{
Attribute normal = GetNormalColor ();
Driver?.SetAttribute (new (SelectedColor, normal.Background));
diff --git a/Terminal.Gui/Views/ComboBox.cs b/Terminal.Gui/Views/ComboBox.cs
index 427e863b3..09fff1c57 100644
--- a/Terminal.Gui/Views/ComboBox.cs
+++ b/Terminal.Gui/Views/ComboBox.cs
@@ -294,7 +294,7 @@ public class ComboBox : View, IDesignable
public virtual void OnCollapsed () { Collapsed?.Invoke (this, EventArgs.Empty); }
///
- 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);
diff --git a/Terminal.Gui/Views/FileDialog.cs b/Terminal.Gui/Views/FileDialog.cs
index a201d64ce..133e04866 100644
--- a/Terminal.Gui/Views/FileDialog.cs
+++ b/Terminal.Gui/Views/FileDialog.cs
@@ -368,7 +368,7 @@ public class FileDialog : Dialog
}
///
- protected override bool OnDrawContent (Rectangle viewport)
+ protected override bool OnDrawingContent (Rectangle viewport)
{
if (!string.IsNullOrWhiteSpace (_feedback))
{
diff --git a/Terminal.Gui/Views/GraphView/Annotations.cs b/Terminal.Gui/Views/GraphView/Annotations.cs
index 4da7472c7..d54a2171f 100644
--- a/Terminal.Gui/Views/GraphView/Annotations.cs
+++ b/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.
///
- 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.
///
- protected override bool OnClearViewport (Rectangle viewport) { return true; }
+ protected override bool OnClearingViewport (Rectangle viewport) { return true; }
/// Draws the Legend and all entries into the area within
@@ -150,8 +150,8 @@ public class LegendAnnotation : View, IAnnotation
if (BorderStyle != LineStyle.None)
{
- OnDrawAdornments ();
- OnRenderLineCanvas ();
+ OnDrawingAdornments ();
+ OnRenderingLineCanvas ();
}
var linesDrawn = 0;
diff --git a/Terminal.Gui/Views/GraphView/GraphView.cs b/Terminal.Gui/Views/GraphView/GraphView.cs
index 04eeb8ef0..c0c01ef13 100644
--- a/Terminal.Gui/Views/GraphView/GraphView.cs
+++ b/Terminal.Gui/Views/GraphView/GraphView.cs
@@ -197,7 +197,7 @@ public class GraphView : View
}
///
- protected override bool OnDrawContent (Rectangle viewport)
+ protected override bool OnDrawingContent (Rectangle viewport)
{
if (CellSize.X == 0 || CellSize.Y == 0)
{
diff --git a/Terminal.Gui/Views/HexView.cs b/Terminal.Gui/Views/HexView.cs
index 1e8f03a35..89bb5b54e 100644
--- a/Terminal.Gui/Views/HexView.cs
+++ b/Terminal.Gui/Views/HexView.cs
@@ -421,7 +421,7 @@ public class HexView : View, IDesignable
}
///
- protected override bool OnDrawContent (Rectangle viewport)
+ protected override bool OnDrawingContent (Rectangle viewport)
{
if (Source is null)
{
diff --git a/Terminal.Gui/Views/Line.cs b/Terminal.Gui/Views/Line.cs
index 6f2602ac4..4e71b5c23 100644
--- a/Terminal.Gui/Views/Line.cs
+++ b/Terminal.Gui/Views/Line.cs
@@ -64,7 +64,7 @@ public class Line : View, IOrientation
}
///
- protected override bool OnDrawContent (Rectangle viewport)
+ protected override bool OnDrawingContent (Rectangle viewport)
{
LineCanvas lc = LineCanvas;
diff --git a/Terminal.Gui/Views/LineView.cs b/Terminal.Gui/Views/LineView.cs
index 0ade24a5f..2e46bdecc 100644
--- a/Terminal.Gui/Views/LineView.cs
+++ b/Terminal.Gui/Views/LineView.cs
@@ -54,7 +54,7 @@ public class LineView : View
public Rune? StartingAnchor { get; set; }
/// Draws the line including any starting/ending anchors
- protected override bool OnDrawContent (Rectangle viewport)
+ protected override bool OnDrawingContent (Rectangle viewport)
{
Move (0, 0);
Driver?.SetAttribute (GetNormalColor ());
diff --git a/Terminal.Gui/Views/ListView.cs b/Terminal.Gui/Views/ListView.cs
index 74bc4aab9..94b442158 100644
--- a/Terminal.Gui/Views/ListView.cs
+++ b/Terminal.Gui/Views/ListView.cs
@@ -769,7 +769,7 @@ public class ListView : View, IDesignable
}
///
- protected override bool OnDrawContent (Rectangle viewport)
+ protected override bool OnDrawingContent (Rectangle viewport)
{
Attribute current = ColorScheme?.Focus ?? Attribute.Default;
Driver?.SetAttribute (current);
diff --git a/Terminal.Gui/Views/Menu/Menu.cs b/Terminal.Gui/Views/Menu/Menu.cs
index 3b7222773..637f5a12d 100644
--- a/Terminal.Gui/Views/Menu/Menu.cs
+++ b/Terminal.Gui/Views/Menu/Menu.cs
@@ -394,7 +394,7 @@ internal sealed class Menu : View
}
///
- protected override bool OnDrawAdornments ()
+ protected override bool OnDrawingAdornments ()
{
Margin?.SetNeedsDisplay ();
Border?.SetNeedsDisplay();
diff --git a/Terminal.Gui/Views/Menu/MenuBar.cs b/Terminal.Gui/Views/Menu/MenuBar.cs
index 9dea468fe..e69e9f0c7 100644
--- a/Terminal.Gui/Views/Menu/MenuBar.cs
+++ b/Terminal.Gui/Views/Menu/MenuBar.cs
@@ -297,7 +297,7 @@ public class MenuBar : View, IDesignable
public event EventHandler? MenuOpening;
///
- protected override bool OnDrawContent (Rectangle viewport)
+ protected override bool OnDrawingContent (Rectangle viewport)
{
var pos = 0;
diff --git a/Terminal.Gui/Views/NumericUpDown.cs b/Terminal.Gui/Views/NumericUpDown.cs
index 89c5e54fb..cc32300c9 100644
--- a/Terminal.Gui/Views/NumericUpDown.cs
+++ b/Terminal.Gui/Views/NumericUpDown.cs
@@ -264,7 +264,7 @@ public class NumericUpDown : View where T : notnull
// Prevent the drawing of Text
///
- protected override bool OnDrawText (Rectangle viewport) { return true; }
+ protected override bool OnDrawingText (Rectangle viewport) { return true; }
}
///
diff --git a/Terminal.Gui/Views/ProgressBar.cs b/Terminal.Gui/Views/ProgressBar.cs
index 976b71529..afb4bcc4c 100644
--- a/Terminal.Gui/Views/ProgressBar.cs
+++ b/Terminal.Gui/Views/ProgressBar.cs
@@ -139,7 +139,7 @@ public class ProgressBar : View, IDesignable
}
///
- protected override bool OnDrawContent (Rectangle viewport)
+ protected override bool OnDrawingContent (Rectangle viewport)
{
Driver?.SetAttribute (GetHotNormalColor ());
diff --git a/Terminal.Gui/Views/RadioGroup.cs b/Terminal.Gui/Views/RadioGroup.cs
index 3e4c9d8a8..49e13481f 100644
--- a/Terminal.Gui/Views/RadioGroup.cs
+++ b/Terminal.Gui/Views/RadioGroup.cs
@@ -360,7 +360,7 @@ public class RadioGroup : View, IDesignable, IOrientation
}
///
- protected override bool OnDrawContent (Rectangle viewport)
+ protected override bool OnDrawingContent (Rectangle viewport)
{
Driver?.SetAttribute (GetNormalColor ());
diff --git a/Terminal.Gui/Views/ScrollBarView.cs b/Terminal.Gui/Views/ScrollBarView.cs
index cb72900ef..c466f23d7 100644
--- a/Terminal.Gui/Views/ScrollBarView.cs
+++ b/Terminal.Gui/Views/ScrollBarView.cs
@@ -446,7 +446,7 @@ public class ScrollBarView : View
public virtual void OnChangedPosition () { ChangedPosition?.Invoke (this, EventArgs.Empty); }
///
- 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;
}
}
diff --git a/Terminal.Gui/Views/ScrollView.cs b/Terminal.Gui/Views/ScrollView.cs
index f16beabf9..e19fab1a3 100644
--- a/Terminal.Gui/Views/ScrollView.cs
+++ b/Terminal.Gui/Views/ScrollView.cs
@@ -372,12 +372,12 @@ public class ScrollView : View
}
///
- 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)
{
diff --git a/Terminal.Gui/Views/Slider.cs b/Terminal.Gui/Views/Slider.cs
index bedee5abe..0f1b4ab32 100644
--- a/Terminal.Gui/Views/Slider.cs
+++ b/Terminal.Gui/Views/Slider.cs
@@ -775,7 +775,7 @@ public class Slider : View, IOrientation
#region Drawing
///
- 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 : View, IOrientation
private void DrawSlider ()
{
// TODO: be more surgical on clear
- Clear ();
+ ClearViewport ();
// Attributes
diff --git a/Terminal.Gui/Views/TabView.cs b/Terminal.Gui/Views/TabView.cs
index 90b45be02..ee72994ed 100644
--- a/Terminal.Gui/Views/TabView.cs
+++ b/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); }
///
- protected override bool OnDrawContent (Rectangle viewport)
+ protected override bool OnDrawingContent (Rectangle viewport)
{
if (Tabs.Any ())
{
@@ -640,15 +640,15 @@ public class TabView : View
}
///
- 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 ();
diff --git a/Terminal.Gui/Views/TableView/ListTableSource.cs b/Terminal.Gui/Views/TableView/ListTableSource.cs
index 1286e2660..6a117698f 100644
--- a/Terminal.Gui/Views/TableView/ListTableSource.cs
+++ b/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;
}
///
diff --git a/Terminal.Gui/Views/TableView/TableView.cs b/Terminal.Gui/Views/TableView/TableView.cs
index 50e6634e4..6ae8dd92f 100644
--- a/Terminal.Gui/Views/TableView/TableView.cs
+++ b/Terminal.Gui/Views/TableView/TableView.cs
@@ -910,7 +910,7 @@ public class TableView : View
}
///
- protected override bool OnDrawContent (Rectangle viewport)
+ protected override bool OnDrawingContent (Rectangle viewport)
{
Move (0, 0);
diff --git a/Terminal.Gui/Views/TextField.cs b/Terminal.Gui/Views/TextField.cs
index 2d471f6c6..8a37e5ee6 100644
--- a/Terminal.Gui/Views/TextField.cs
+++ b/Terminal.Gui/Views/TextField.cs
@@ -931,7 +931,7 @@ public class TextField : View
}
///
- protected override bool OnDrawContent (Rectangle viewport)
+ protected override bool OnDrawingContent (Rectangle viewport)
{
_isDrawing = true;
diff --git a/Terminal.Gui/Views/TextValidateField.cs b/Terminal.Gui/Views/TextValidateField.cs
index b97aa818e..fd0edd09f 100644
--- a/Terminal.Gui/Views/TextValidateField.cs
+++ b/Terminal.Gui/Views/TextValidateField.cs
@@ -553,7 +553,7 @@ namespace Terminal.Gui
}
///
- protected override bool OnDrawContent (Rectangle viewport)
+ protected override bool OnDrawingContent (Rectangle viewport)
{
if (_provider is null)
{
diff --git a/Terminal.Gui/Views/TextView.cs b/Terminal.Gui/Views/TextView.cs
index 0fa220bdf..2f1b1c107 100644
--- a/Terminal.Gui/Views/TextView.cs
+++ b/Terminal.Gui/Views/TextView.cs
@@ -3550,7 +3550,7 @@ public class TextView : View
}
///
- protected override bool OnDrawContent (Rectangle viewport)
+ protected override bool OnDrawingContent (Rectangle viewport)
{
_isDrawing = true;
diff --git a/Terminal.Gui/Views/TileView.cs b/Terminal.Gui/Views/TileView.cs
index d52383a9d..9a14c0c04 100644
--- a/Terminal.Gui/Views/TileView.cs
+++ b/Terminal.Gui/Views/TileView.cs
@@ -174,10 +174,10 @@ public class TileView : View
// QUESTION: Does this need to be fixed before events are refactored?
/// Overridden so no Frames get drawn
///
- protected override bool OnDrawAdornments () { return true; }
+ protected override bool OnDrawingAdornments () { return true; }
///
- protected override bool OnRenderLineCanvas () { return false; }
+ protected override bool OnRenderingLineCanvas () { return false; }
///
protected override bool OnDrawComplete (Rectangle viewport)
@@ -973,9 +973,9 @@ public class TileView : View
}
///
- 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 ();
diff --git a/Terminal.Gui/Views/TreeView/TreeView.cs b/Terminal.Gui/Views/TreeView/TreeView.cs
index 749930909..2827dd972 100644
--- a/Terminal.Gui/Views/TreeView/TreeView.cs
+++ b/Terminal.Gui/Views/TreeView/TreeView.cs
@@ -1127,7 +1127,7 @@ public class TreeView : View, ITreeView where T : class
public event EventHandler> ObjectActivated;
///
- protected override bool OnDrawContent (Rectangle viewport)
+ protected override bool OnDrawingContent (Rectangle viewport)
{
if (roots is null)
{
diff --git a/UICatalog/Scenarios/AnimationScenario/AnimationScenario.cs b/UICatalog/Scenarios/AnimationScenario/AnimationScenario.cs
index b8fee02aa..335afe4c2 100644
--- a/UICatalog/Scenarios/AnimationScenario/AnimationScenario.cs
+++ b/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)
{
diff --git a/UICatalog/Scenarios/CharacterMap.cs b/UICatalog/Scenarios/CharacterMap.cs
index a45b01b75..aec05ea3e 100644
--- a/UICatalog/Scenarios/CharacterMap.cs
+++ b/UICatalog/Scenarios/CharacterMap.cs
@@ -657,14 +657,14 @@ internal class CharMap : View
private static int RowWidth => RowLabelWidth + COLUMN_WIDTH * 16;
public event EventHandler 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;
diff --git a/UICatalog/Scenarios/ColorPicker.cs b/UICatalog/Scenarios/ColorPicker.cs
index 8c2682ef3..53c254ed9 100644
--- a/UICatalog/Scenarios/ColorPicker.cs
+++ b/UICatalog/Scenarios/ColorPicker.cs
@@ -249,7 +249,7 @@ public class ColorPickers : Scenario
/// Update a color label from his ColorPicker.
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}";
diff --git a/UICatalog/Scenarios/CsvEditor.cs b/UICatalog/Scenarios/CsvEditor.cs
index a931f3e76..c8f4bda7b 100644
--- a/UICatalog/Scenarios/CsvEditor.cs
+++ b/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;
diff --git a/UICatalog/Scenarios/Editor.cs b/UICatalog/Scenarios/Editor.cs
index dd44d2980..00d6e43a3 100644
--- a/UICatalog/Scenarios/Editor.cs
+++ b/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;
diff --git a/UICatalog/Scenarios/Images.cs b/UICatalog/Scenarios/Images.cs
index 3ee5370b7..1e0ab4620 100644
--- a/UICatalog/Scenarios/Images.cs
+++ b/UICatalog/Scenarios/Images.cs
@@ -114,7 +114,7 @@ public class Images : Scenario
private Image _fullResImage;
private Image _matchSize;
- protected override bool OnDrawContent (Rectangle bounds)
+ protected override bool OnDrawingContent (Rectangle bounds)
{
if (_fullResImage == null)
{
diff --git a/UICatalog/Scenarios/LineDrawing.cs b/UICatalog/Scenarios/LineDrawing.cs
index 068126b4a..d03ac0981 100644
--- a/UICatalog/Scenarios/LineDrawing.cs
+++ b/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
}
///
- protected override bool OnDrawContent (Rectangle viewport)
+ protected override bool OnDrawingContent (Rectangle viewport)
{
Color fg = Value.Foreground;
Color bg = Value.Background;
diff --git a/UICatalog/Scenarios/ListColumns.cs b/UICatalog/Scenarios/ListColumns.cs
index 05859bfbc..867a805d7 100644
--- a/UICatalog/Scenarios/ListColumns.cs
+++ b/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;
diff --git a/UICatalog/Scenarios/ListViewWithSelection.cs b/UICatalog/Scenarios/ListViewWithSelection.cs
index 7e2c99b92..bb05332a8 100644
--- a/UICatalog/Scenarios/ListViewWithSelection.cs
+++ b/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;
diff --git a/UICatalog/Scenarios/ListsAndCombos.cs b/UICatalog/Scenarios/ListsAndCombos.cs
index 8c76a887a..9b9362830 100644
--- a/UICatalog/Scenarios/ListsAndCombos.cs
+++ b/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;
diff --git a/UICatalog/Scenarios/Snake.cs b/UICatalog/Scenarios/Snake.cs
index fd353a1b2..63917b040 100644
--- a/UICatalog/Scenarios/Snake.cs
+++ b/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 ();
diff --git a/UICatalog/Scenarios/SyntaxHighlighting.cs b/UICatalog/Scenarios/SyntaxHighlighting.cs
index 1271e52cb..0803360f8 100644
--- a/UICatalog/Scenarios/SyntaxHighlighting.cs
+++ b/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 ();
}
diff --git a/UICatalog/Scenarios/TableEditor.cs b/UICatalog/Scenarios/TableEditor.cs
index c676eac23..70faf7533 100644
--- a/UICatalog/Scenarios/TableEditor.cs
+++ b/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;
diff --git a/UICatalog/Scenarios/Text.cs b/UICatalog/Scenarios/Text.cs
index 84d6fd01c..5e60530a0 100644
--- a/UICatalog/Scenarios/Text.cs
+++ b/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)
diff --git a/UICatalog/Scenarios/TextEffectsScenario.cs b/UICatalog/Scenarios/TextEffectsScenario.cs
index c9703a50c..9339ce921 100644
--- a/UICatalog/Scenarios/TextEffectsScenario.cs
+++ b/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);
diff --git a/UICatalog/Scenarios/TextViewAutocompletePopup.cs b/UICatalog/Scenarios/TextViewAutocompletePopup.cs
index 4b33c6ae8..4e12c01f6 100644
--- a/UICatalog/Scenarios/TextViewAutocompletePopup.cs
+++ b/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;
diff --git a/UICatalog/Scenarios/TreeViewFileSystem.cs b/UICatalog/Scenarios/TreeViewFileSystem.cs
index 6c46a7996..6679d2bc7 100644
--- a/UICatalog/Scenarios/TreeViewFileSystem.cs
+++ b/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;
diff --git a/UICatalog/Scenarios/Wizards.cs b/UICatalog/Scenarios/Wizards.cs
index 245a95503..dd457588f 100644
--- a/UICatalog/Scenarios/Wizards.cs
+++ b/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;
diff --git a/UnitTests/Application/ApplicationTests.cs b/UnitTests/Application/ApplicationTests.cs
index 621109791..f9ec74a56 100644
--- a/UnitTests/Application/ApplicationTests.cs
+++ b/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)
diff --git a/UnitTests/Input/ResponderTests.cs b/UnitTests/Input/ResponderTests.cs
index 183e06885..db1d39b5d 100644
--- a/UnitTests/Input/ResponderTests.cs
+++ b/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
diff --git a/UnitTests/UICatalog/ScenarioTests.cs b/UnitTests/UICatalog/ScenarioTests.cs
index 7305d51e3..74bb615ad 100644
--- a/UnitTests/UICatalog/ScenarioTests.cs
+++ b/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);
diff --git a/UnitTests/View/Draw/DrawTests.cs b/UnitTests/View/Draw/DrawTests.cs
index 85c6963a8..6404773f0 100644
--- a/UnitTests/View/Draw/DrawTests.cs
+++ b/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 (
@"
diff --git a/UnitTests/View/Layout/LayoutTests.cs b/UnitTests/View/Layout/LayoutTests.cs
index 0bad0a65a..da4d40e9e 100644
--- a/UnitTests/View/Layout/LayoutTests.cs
+++ b/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++;
diff --git a/UnitTests/View/TextTests.cs b/UnitTests/View/TextTests.cs
index ba7cafaa5..c2454d777 100644
--- a/UnitTests/View/TextTests.cs
+++ b/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";
diff --git a/UnitTests/View/ViewTests.cs b/UnitTests/View/ViewTests.cs
index bb142c51a..8778615fe 100644
--- a/UnitTests/View/ViewTests.cs
+++ b/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;
diff --git a/UnitTests/Views/LabelTests.cs b/UnitTests/Views/LabelTests.cs
index 183434940..068ac2119 100644
--- a/UnitTests/Views/LabelTests.cs
+++ b/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);
diff --git a/UnitTests/Views/ScrollBarViewTests.cs b/UnitTests/Views/ScrollBarViewTests.cs
index de543bdf1..efc0f4530 100644
--- a/UnitTests/Views/ScrollBarViewTests.cs
+++ b/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;
}