浏览代码

Removed ClearFrame API. Not needed.

Tig 1 年之前
父节点
当前提交
3f1e184e7e
共有 4 个文件被更改,包括 2 次插入55 次删除
  1. 1 1
      Terminal.Gui/View/View.cs
  2. 0 20
      Terminal.Gui/View/ViewDrawing.cs
  3. 1 1
      Terminal.Gui/Views/Toplevel.cs
  4. 0 33
      UnitTests/View/DrawTests.cs

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

@@ -201,7 +201,7 @@ public partial class View : Responder, ISupportInitializeNotification
 
 
                     if (ClearOnVisibleFalse)
                     if (ClearOnVisibleFalse)
                     {
                     {
-                        ClearFrame();
+                        Clear ();
                     }
                     }
                 }
                 }
 
 

+ 0 - 20
Terminal.Gui/View/ViewDrawing.cs

@@ -102,26 +102,6 @@ public partial class View
         Driver.SetAttribute (prev);
         Driver.SetAttribute (prev);
     }
     }
 
 
-    /// <summary>Clears the entire view (<see cref="Frame"/>) with the normal background color.</summary>
-    /// <remarks>
-    ///     <para>This method will clear the area occupied by the <see cref="Margin"/>, <see cref="Border"/>, and <see cref="Padding"/>, as
-    ///     well as the <see cref="Bounds"/>. Use <see cref="Clear()"/> to clear just the <see cref="Bounds"/>.</para>
-    /// </remarks>
-    public void ClearFrame ()
-    {
-        if (IsInitialized)
-        {
-            if (Driver is null)
-            {
-                return;
-            }
-
-            Attribute prev = Driver.SetAttribute (GetNormalColor ());
-            Driver.FillRect (FrameToScreen ());
-            Driver.SetAttribute (prev);
-        }
-    }
-
     /// <summary>Expands the <see cref="ConsoleDriver"/>'s clip region to include <see cref="Bounds"/>.</summary>
     /// <summary>Expands the <see cref="ConsoleDriver"/>'s clip region to include <see cref="Bounds"/>.</summary>
     /// <returns>
     /// <returns>
     ///     The current screen-relative clip region, which can be then re-applied by setting
     ///     The current screen-relative clip region, which can be then re-applied by setting

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

@@ -360,7 +360,7 @@ public partial class Toplevel : View
         {
         {
             //Driver.SetAttribute (GetNormalColor ());
             //Driver.SetAttribute (GetNormalColor ());
             // TODO: It's bad practice for views to always clear. Defeats the purpose of clipping etc...
             // TODO: It's bad practice for views to always clear. Defeats the purpose of clipping etc...
-            ClearFrame ();
+            Clear ();
             LayoutSubviews ();
             LayoutSubviews ();
             PositionToplevels ();
             PositionToplevels ();
 
 

+ 0 - 33
UnitTests/View/DrawTests.cs

@@ -10,39 +10,6 @@ public class DrawTests
     private readonly ITestOutputHelper _output;
     private readonly ITestOutputHelper _output;
     public DrawTests (ITestOutputHelper output) { _output = output; }
     public DrawTests (ITestOutputHelper output) { _output = output; }
 
 
-    [Theory]
-    [InlineData (0, 0, 2, 2)]
-    [SetupFakeDriver]
-    public void ClearFrame_Clears_Frame (int x, int y, int width, int height)
-    {
-        var superView = new View { Width = Dim.Fill (), Height = Dim.Fill () };
-
-        var view = new View
-        {
-            X = x, Y = y,
-            Width = width, Height = height,
-            BorderStyle = LineStyle.Single
-        };
-        superView.Add (view);
-        superView.BeginInit ();
-        superView.EndInit ();
-        superView.LayoutSubviews ();
-
-        superView.Draw ();
-
-        TestHelpers.AssertDriverContentsWithFrameAre (
-                                                      @"
-┌┐
-└┘",
-                                                      _output);
-
-        view.ClearFrame ();
-        TestHelpers.AssertDriverContentsWithFrameAre (
-                                                      @"",
-                                                      _output);
-
-    }
-
     [Theory]
     [Theory]
     [InlineData (0, 0, 1, 1)]
     [InlineData (0, 0, 1, 1)]
     [InlineData (0, 0, 2, 2)]
     [InlineData (0, 0, 2, 2)]