소스 검색

View.Remove returns added view

Tig 1 년 전
부모
커밋
f99a744ef8
5개의 변경된 파일17개의 추가작업 그리고 9개의 파일을 삭제
  1. 4 2
      Terminal.Gui/View/ViewSubViews.cs
  2. 3 1
      Terminal.Gui/Views/Bar.cs
  3. 4 2
      Terminal.Gui/Views/ScrollView.cs
  4. 2 2
      Terminal.Gui/Views/Toplevel.cs
  5. 4 2
      Terminal.Gui/Views/Wizard/WizardStep.cs

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

@@ -209,11 +209,11 @@ public partial class View
     ///         lifecycle to be transferred to the caller; the caller muse call <see cref="Dispose"/>.
     ///     </para>
     /// </remarks>
-    public virtual void Remove (View view)
+    public virtual View Remove (View view)
     {
         if (view is null || _subviews is null)
         {
-            return;
+            return view;
         }
 
         Rectangle touched = view.Frame;
@@ -238,6 +238,8 @@ public partial class View
         {
             Focused = null;
         }
+
+        return view;
     }
 
     /// <summary>

+ 3 - 1
Terminal.Gui/Views/Bar.cs

@@ -67,10 +67,12 @@ public class Bar : View
     }
 
     /// <inheritdoc />
-    public override void Remove (View view)
+    public override View Remove (View view)
     {
         base.Remove (view);
         AdjustSubviewBorders ();
+
+        return view;
     }
 
 

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

@@ -457,11 +457,11 @@ public class ScrollView : View
 
     /// <summary>Removes the view from the scrollview.</summary>
     /// <param name="view">The view to remove from the scrollview.</param>
-    public override void Remove (View view)
+    public override View Remove (View view)
     {
         if (view is null)
         {
-            return;
+            return view;
         }
 
         SetNeedsDisplay ();
@@ -480,6 +480,8 @@ public class ScrollView : View
         {
             CanFocus = false;
         }
+
+        return view;
     }
 
     /// <summary>Removes all widgets from this container.</summary>

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

@@ -451,14 +451,14 @@ public partial class Toplevel : View
     public event EventHandler Ready;
 
     /// <inheritdoc/>
-    public override void Remove (View view)
+    public override View Remove (View view)
     {
         if (this is Toplevel { MenuBar: { } })
         {
             RemoveMenuStatusBar (view);
         }
 
-        base.Remove (view);
+        return base.Remove (view);
     }
 
     /// <inheritdoc/>

+ 4 - 2
Terminal.Gui/Views/Wizard/WizardStep.cs

@@ -142,11 +142,11 @@ public class WizardStep : FrameView
 
     /// <summary>Removes a <see cref="View"/> from <see cref="WizardStep"/>.</summary>
     /// <remarks></remarks>
-    public override void Remove (View view)
+    public override View Remove (View view)
     {
         if (view is null)
         {
-            return;
+            return view;
         }
 
         SetNeedsDisplay ();
@@ -167,6 +167,8 @@ public class WizardStep : FrameView
         }
 
         ShowHide ();
+
+        return view;
     }
 
     /// <summary>Removes all <see cref="View"/>s from the <see cref="WizardStep"/>.</summary>