diff --git a/Examples/UICatalog/Scenarios/AnimationScenario/AnimationScenario.cs b/Examples/UICatalog/Scenarios/AnimationScenario/AnimationScenario.cs index a35453970..3660eeaeb 100644 --- a/Examples/UICatalog/Scenarios/AnimationScenario/AnimationScenario.cs +++ b/Examples/UICatalog/Scenarios/AnimationScenario/AnimationScenario.cs @@ -173,7 +173,7 @@ public class AnimationScenario : Scenario private Rectangle _oldSize = Rectangle.Empty; public void NextFrame () { _currentFrame = (_currentFrame + 1) % _frameCount; } - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { if (_frameCount == 0) { diff --git a/Examples/UICatalog/Scenarios/Images.cs b/Examples/UICatalog/Scenarios/Images.cs index 97c612674..91803b817 100644 --- a/Examples/UICatalog/Scenarios/Images.cs +++ b/Examples/UICatalog/Scenarios/Images.cs @@ -631,7 +631,7 @@ public class Images : Scenario public Image FullResImage; private Image _matchSize; - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { if (FullResImage == null) { @@ -708,7 +708,7 @@ public class Images : Scenario return (columns, rows); } - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { if (_palette == null || _palette.Count == 0) { diff --git a/Examples/UICatalog/Scenarios/LineDrawing.cs b/Examples/UICatalog/Scenarios/LineDrawing.cs index 217aea27b..7e0335994 100644 --- a/Examples/UICatalog/Scenarios/LineDrawing.cs +++ b/Examples/UICatalog/Scenarios/LineDrawing.cs @@ -273,7 +273,7 @@ public class DrawingArea : View public ITool CurrentTool { get; set; } = new DrawLineTool (); public DrawingArea () { AddLayer (); } - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { foreach (LineCanvas canvas in Layers) { @@ -380,7 +380,7 @@ public class AttributeView : View } /// - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { Color fg = Value.Foreground; Color bg = Value.Background; diff --git a/Examples/UICatalog/Scenarios/RegionScenario.cs b/Examples/UICatalog/Scenarios/RegionScenario.cs index 495d90d6a..93784ccdf 100644 --- a/Examples/UICatalog/Scenarios/RegionScenario.cs +++ b/Examples/UICatalog/Scenarios/RegionScenario.cs @@ -268,7 +268,7 @@ public class AttributeView : View } /// - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { Color fg = Value?.Foreground ?? Color.Black; Color bg = Value?.Background ?? Color.Black; diff --git a/Examples/UICatalog/Scenarios/Snake.cs b/Examples/UICatalog/Scenarios/Snake.cs index 582a130f4..8632facda 100644 --- a/Examples/UICatalog/Scenarios/Snake.cs +++ b/Examples/UICatalog/Scenarios/Snake.cs @@ -322,7 +322,7 @@ public class Snake : Scenario private SnakeState State { get; } - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { SetAttribute (white); ClearViewport (); diff --git a/Examples/UICatalog/Scenarios/TextEffectsScenario.cs b/Examples/UICatalog/Scenarios/TextEffectsScenario.cs index ba25683e5..cf0745b86 100644 --- a/Examples/UICatalog/Scenarios/TextEffectsScenario.cs +++ b/Examples/UICatalog/Scenarios/TextEffectsScenario.cs @@ -109,7 +109,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 OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { DrawTopLineGradient (Viewport); diff --git a/Terminal.Gui/ViewBase/Adornment/Border.cs b/Terminal.Gui/ViewBase/Adornment/Border.cs index 951879e9f..65a38f811 100644 --- a/Terminal.Gui/ViewBase/Adornment/Border.cs +++ b/Terminal.Gui/ViewBase/Adornment/Border.cs @@ -241,7 +241,7 @@ public partial class Border : Adornment /// - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { if (Thickness == Thickness.Empty) { @@ -539,8 +539,6 @@ public partial class Border : Adornment } return true; - - ; } /// diff --git a/Terminal.Gui/ViewBase/Adornment/ShadowView.cs b/Terminal.Gui/ViewBase/Adornment/ShadowView.cs index cbb484fb7..90f84219c 100644 --- a/Terminal.Gui/ViewBase/Adornment/ShadowView.cs +++ b/Terminal.Gui/ViewBase/Adornment/ShadowView.cs @@ -20,7 +20,7 @@ internal class ShadowView : View } /// - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { switch (ShadowStyle) { diff --git a/Terminal.Gui/ViewBase/View.Drawing.cs b/Terminal.Gui/ViewBase/View.Drawing.cs index 7ed6db098..3a523de7d 100644 --- a/Terminal.Gui/ViewBase/View.Drawing.cs +++ b/Terminal.Gui/ViewBase/View.Drawing.cs @@ -504,12 +504,6 @@ public partial class View // Drawing APIs return; } - // TODO: Upgrade all overrides of OnDrawingContent to use DrawContext and remove this override - if (OnDrawingContent ()) - { - return; - } - var dev = new DrawEventArgs (Viewport, Rectangle.Empty, context); DrawingContent?.Invoke (this, dev); @@ -528,12 +522,6 @@ public partial class View // Drawing APIs /// to stop further drawing content. protected virtual bool OnDrawingContent (DrawContext? context) { return false; } - /// - /// Called when the View's content is to be drawn. The default implementation does nothing. - /// - /// to stop further drawing content. - protected virtual bool OnDrawingContent () { return false; } - /// Raised when the View's content is to be drawn. /// /// Will be invoked before any subviews added with have been drawn. diff --git a/Terminal.Gui/Views/Autocomplete/PopupAutocomplete.PopUp.cs b/Terminal.Gui/Views/Autocomplete/PopupAutocomplete.PopUp.cs index 18bd89b52..8457844a0 100644 --- a/Terminal.Gui/Views/Autocomplete/PopupAutocomplete.PopUp.cs +++ b/Terminal.Gui/Views/Autocomplete/PopupAutocomplete.PopUp.cs @@ -15,7 +15,7 @@ public abstract partial class PopupAutocomplete private readonly PopupAutocomplete _autoComplete; - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { if (!_autoComplete.LastPopupPos.HasValue) { diff --git a/Terminal.Gui/Views/CharMap/CharMap.cs b/Terminal.Gui/Views/CharMap/CharMap.cs index d61e4f87d..c9adeedb3 100644 --- a/Terminal.Gui/Views/CharMap/CharMap.cs +++ b/Terminal.Gui/Views/CharMap/CharMap.cs @@ -580,7 +580,7 @@ public class CharMap : View, IDesignable private static int RowLabelWidth => $"U+{MAX_CODE_POINT:x5}".Length + 1; /// - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { if (Viewport.Height == 0 || Viewport.Width == 0) { diff --git a/Terminal.Gui/Views/Color/ColorBar.cs b/Terminal.Gui/Views/Color/ColorBar.cs index 66503d21c..cea52f3de 100644 --- a/Terminal.Gui/Views/Color/ColorBar.cs +++ b/Terminal.Gui/Views/Color/ColorBar.cs @@ -101,7 +101,7 @@ internal abstract class ColorBar : View, IColorBar } /// - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { if (!string.IsNullOrWhiteSpace (Text)) { diff --git a/Terminal.Gui/Views/Color/ColorPicker.16.cs b/Terminal.Gui/Views/Color/ColorPicker.16.cs index 6c1eda4cb..23620cfe0 100644 --- a/Terminal.Gui/Views/Color/ColorPicker.16.cs +++ b/Terminal.Gui/Views/Color/ColorPicker.16.cs @@ -132,7 +132,7 @@ public class ColorPicker16 : View } /// - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { SetAttribute (HasFocus ? GetAttributeForRole (VisualRole.Focus) : GetAttributeForRole (VisualRole.Normal)); var colorIndex = 0; diff --git a/Terminal.Gui/Views/Color/ColorPicker.cs b/Terminal.Gui/Views/Color/ColorPicker.cs index 60badf165..7de824f91 100644 --- a/Terminal.Gui/Views/Color/ColorPicker.cs +++ b/Terminal.Gui/Views/Color/ColorPicker.cs @@ -99,7 +99,7 @@ public partial class ColorPicker : View, IDesignable public event EventHandler>? ColorChanged; /// - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { Attribute normal = GetAttributeForRole (VisualRole.Normal); SetAttribute (new (SelectedColor, normal.Background, Enabled ? TextStyle.None : TextStyle.Faint)); diff --git a/Terminal.Gui/Views/ComboBox.cs b/Terminal.Gui/Views/ComboBox.cs index 83e72ac79..e43c465db 100644 --- a/Terminal.Gui/Views/ComboBox.cs +++ b/Terminal.Gui/Views/ComboBox.cs @@ -287,7 +287,7 @@ public class ComboBox : View, IDesignable public virtual void OnCollapsed () { Collapsed?.Invoke (this, EventArgs.Empty); } /// - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { if (!_autoHide) @@ -881,7 +881,7 @@ public class ComboBox : View, IDesignable return res; } - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { Attribute current = GetAttributeForRole (VisualRole.Focus); SetAttribute (current); diff --git a/Terminal.Gui/Views/FileDialogs/FileDialog.cs b/Terminal.Gui/Views/FileDialogs/FileDialog.cs index afaa624c8..9f93cdda2 100644 --- a/Terminal.Gui/Views/FileDialogs/FileDialog.cs +++ b/Terminal.Gui/Views/FileDialogs/FileDialog.cs @@ -409,7 +409,7 @@ public class FileDialog : Dialog, IDesignable } /// - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { if (!string.IsNullOrWhiteSpace (_feedback)) { diff --git a/Terminal.Gui/Views/GraphView/GraphView.cs b/Terminal.Gui/Views/GraphView/GraphView.cs index 03cda9fed..9a3be3f19 100644 --- a/Terminal.Gui/Views/GraphView/GraphView.cs +++ b/Terminal.Gui/Views/GraphView/GraphView.cs @@ -198,7 +198,7 @@ public class GraphView : View, IDesignable } /// - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { if (CellSize.X == 0 || CellSize.Y == 0) { diff --git a/Terminal.Gui/Views/HexView.cs b/Terminal.Gui/Views/HexView.cs index ee81eb832..b05f0b506 100644 --- a/Terminal.Gui/Views/HexView.cs +++ b/Terminal.Gui/Views/HexView.cs @@ -431,7 +431,7 @@ public class HexView : View, IDesignable } /// - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { if (Source is null) { diff --git a/Terminal.Gui/Views/Line.cs b/Terminal.Gui/Views/Line.cs index 04ba5703f..90b93072b 100644 --- a/Terminal.Gui/Views/Line.cs +++ b/Terminal.Gui/Views/Line.cs @@ -217,7 +217,7 @@ public class Line : View, IOrientation /// This method adds the line to the LineCanvas for rendering. /// The actual rendering is performed by the parent view through . /// - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { Point pos = ViewportToScreen (Viewport).Location; int length = Orientation == Orientation.Horizontal ? Frame.Width : Frame.Height; diff --git a/Terminal.Gui/Views/ListView.cs b/Terminal.Gui/Views/ListView.cs index e958844bf..453737c85 100644 --- a/Terminal.Gui/Views/ListView.cs +++ b/Terminal.Gui/Views/ListView.cs @@ -721,11 +721,11 @@ public class ListView : View, IDesignable protected virtual void OnCollectionChanged (NotifyCollectionChangedEventArgs e) { CollectionChanged?.Invoke (this, e); } /// - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { if (Source is null) { - return base.OnDrawingContent (); + return base.OnDrawingContent (context); } var current = Attribute.Default; diff --git a/Terminal.Gui/Views/ProgressBar.cs b/Terminal.Gui/Views/ProgressBar.cs index b7cf3a2e0..5f21b3020 100644 --- a/Terminal.Gui/Views/ProgressBar.cs +++ b/Terminal.Gui/Views/ProgressBar.cs @@ -132,7 +132,7 @@ public class ProgressBar : View, IDesignable } /// - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { SetAttribute (GetAttributeForRole (VisualRole.Active)); diff --git a/Terminal.Gui/Views/Slider/Slider.cs b/Terminal.Gui/Views/Slider/Slider.cs index 985f9d16a..b23001e15 100644 --- a/Terminal.Gui/Views/Slider/Slider.cs +++ b/Terminal.Gui/Views/Slider/Slider.cs @@ -779,7 +779,7 @@ public class Slider : View, IOrientation #region Drawing /// - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { // TODO: make this more surgical to reduce repaint diff --git a/Terminal.Gui/Views/SpinnerView/SpinnerView.cs b/Terminal.Gui/Views/SpinnerView/SpinnerView.cs index be1337591..127c0fa50 100644 --- a/Terminal.Gui/Views/SpinnerView/SpinnerView.cs +++ b/Terminal.Gui/Views/SpinnerView/SpinnerView.cs @@ -172,7 +172,7 @@ public class SpinnerView : View, IDesignable protected override bool OnClearingViewport () { return true; } /// - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { Render (); diff --git a/Terminal.Gui/Views/TableView/TableView.cs b/Terminal.Gui/Views/TableView/TableView.cs index 5d1e79f7f..98976be15 100644 --- a/Terminal.Gui/Views/TableView/TableView.cs +++ b/Terminal.Gui/Views/TableView/TableView.cs @@ -931,7 +931,7 @@ public class TableView : View, IDesignable } /// - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { Move (0, 0); diff --git a/Terminal.Gui/Views/TextInput/TextField.cs b/Terminal.Gui/Views/TextInput/TextField.cs index 794b09b40..c1c43b6e8 100644 --- a/Terminal.Gui/Views/TextInput/TextField.cs +++ b/Terminal.Gui/Views/TextInput/TextField.cs @@ -922,7 +922,7 @@ public class TextField : View, IDesignable } /// - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { _isDrawing = true; diff --git a/Terminal.Gui/Views/TextInput/TextValidateField.cs b/Terminal.Gui/Views/TextInput/TextValidateField.cs index db4cbbd54..934d09c8f 100644 --- a/Terminal.Gui/Views/TextInput/TextValidateField.cs +++ b/Terminal.Gui/Views/TextInput/TextValidateField.cs @@ -172,7 +172,7 @@ public class TextValidateField : View, IDesignable } /// - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { if (_provider is null) { diff --git a/Terminal.Gui/Views/TextInput/TextView.cs b/Terminal.Gui/Views/TextInput/TextView.cs index b16c85da3..caa3c111b 100644 --- a/Terminal.Gui/Views/TextInput/TextView.cs +++ b/Terminal.Gui/Views/TextInput/TextView.cs @@ -1781,7 +1781,7 @@ public class TextView : View, IDesignable } /// - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { _isDrawing = true; diff --git a/Terminal.Gui/Views/TreeView/TreeView.cs b/Terminal.Gui/Views/TreeView/TreeView.cs index fd33ad0ff..a167ccc10 100644 --- a/Terminal.Gui/Views/TreeView/TreeView.cs +++ b/Terminal.Gui/Views/TreeView/TreeView.cs @@ -1148,7 +1148,7 @@ public class TreeView : View, ITreeView where T : class public event EventHandler> ObjectActivated; /// - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { if (roots is null) { diff --git a/Tests/UnitTests/View/Draw/DrawTests.cs b/Tests/UnitTests/View/Draw/DrawTests.cs index 7cce52b6b..76df1c973 100644 --- a/Tests/UnitTests/View/Draw/DrawTests.cs +++ b/Tests/UnitTests/View/Draw/DrawTests.cs @@ -906,7 +906,7 @@ At 0,0 public bool IsKeyUp { get; set; } public override string Text { get; set; } = null!; - protected override bool OnDrawingContent () + protected override bool OnDrawingContent (DrawContext? context) { var idx = 0; diff --git a/Tests/UnitTestsParallelizable/ViewBase/Adornment/AdornmentTests.cs b/Tests/UnitTestsParallelizable/ViewBase/Adornment/AdornmentTests.cs index ea04decd7..2efa50c5e 100644 --- a/Tests/UnitTestsParallelizable/ViewBase/Adornment/AdornmentTests.cs +++ b/Tests/UnitTestsParallelizable/ViewBase/Adornment/AdornmentTests.cs @@ -10,7 +10,7 @@ public class AdornmentTests // public bool PaddingDrawn { get; set; } // /// - // protected override bool OnDrawingContent () + // protected override bool OnDrawingContent (DrawContext? context) // { // if (Border is { } && Border.Thickness != Thickness.Empty) // {