Charlie Kindel 4 years ago
parent
commit
473afe0732

+ 4 - 4
Example/demo.cs

@@ -185,16 +185,16 @@ static class Demo {
 		};
 
 		var tf = new Button (3, 19, "Ok");
+		var frameView = new FrameView (new Rect (3, 10, 25, 6), "Options");
+		frameView.Add (new CheckBox (1, 0, "Remember me"));
+		frameView.Add (new RadioGroup (1, 2, new ustring [] { "_Personal", "_Company" }));
 		// Add some content
 		container.Add (
 			login,
 			loginText,
 			password,
 			passText,
-			new FrameView (new Rect (3, 10, 25, 6), "Options"){
-				new CheckBox (1, 0, "Remember me"),
-				new RadioGroup (1, 2, new ustring [] { "_Personal", "_Company" }),
-			},
+			frameView,
 			new ListView (new Rect (59, 6, 16, 4), new string [] {
 				"First row",
 				"<>",

+ 10 - 10
Terminal.Gui/Core/View.cs

@@ -111,7 +111,7 @@ namespace Terminal.Gui {
 	///    frames for the vies that use <see cref="LayoutStyle.Computed"/>.
 	/// </para>
 	/// </remarks>
-	public partial class View : Responder, IEnumerable, ISupportInitializeNotification {
+	public partial class View : Responder, ISupportInitializeNotification {
 
 		internal enum Direction {
 			Forward,
@@ -386,15 +386,15 @@ namespace Terminal.Gui {
 			}
 		}
 
-		/// <summary>
-		/// Gets an enumerator that enumerates the subviews in this view.
-		/// </summary>
-		/// <returns>The enumerator.</returns>
-		public IEnumerator GetEnumerator ()
-		{
-			foreach (var v in InternalSubviews)
-				yield return v;
-		}
+		///// <summary>
+		///// Gets an enumerator that enumerates the subviews in this view.
+		///// </summary>
+		///// <returns>The enumerator.</returns>
+		//public IEnumerator GetEnumerator ()
+		//{
+		//	foreach (var v in InternalSubviews)
+		//		yield return v;
+		//}
 
 		LayoutStyle layoutStyle;
 

+ 9 - 9
Terminal.Gui/Core/Window.cs

@@ -20,7 +20,7 @@ namespace Terminal.Gui {
 	/// The 'client area' of a <see cref="Window"/> is a rectangle deflated by one or more rows/columns from <see cref="View.Bounds"/>. A this time there is no
 	/// API to determine this rectangle.
 	/// </remarks>
-	public class Window : Toplevel, IEnumerable {
+	public class Window : Toplevel {
 		View contentView;
 		ustring title;
 
@@ -122,14 +122,14 @@ namespace Terminal.Gui {
 			base.Add (contentView);
 		}
 
-		/// <summary>
-		/// Enumerates the various <see cref="View"/>s in the embedded <see cref="ContentView"/>.
-		/// </summary>
-		/// <returns>The enumerator.</returns>
-		public new IEnumerator GetEnumerator ()
-		{
-			return contentView.GetEnumerator ();
-		}
+		///// <summary>
+		///// Enumerates the various <see cref="View"/>s in the embedded <see cref="ContentView"/>.
+		///// </summary>
+		///// <returns>The enumerator.</returns>
+		//public new IEnumerator GetEnumerator ()
+		//{
+		//	return contentView.GetEnumerator ();
+		//}
 
 		/// <inheritdoc/>
 		public override void Add (View view)

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

@@ -643,7 +643,7 @@ namespace Terminal.Gui {
 
 		void SetViewsNeedsDisplay ()
 		{
-			foreach (View view in contentView) {
+			foreach (View view in contentView.Subviews) {
 				view.SetNeedsDisplay ();
 			}
 		}

+ 0 - 3
UnitTests/ViewTests.cs

@@ -35,7 +35,6 @@ namespace Terminal.Gui {
 			Assert.Empty (r.Subviews);
 			Assert.False (r.WantContinuousButtonPressed);
 			Assert.False (r.WantMousePositionReports);
-			Assert.Null (r.GetEnumerator ().Current);
 			Assert.Null (r.SuperView);
 			Assert.Null (r.MostFocused);
 
@@ -59,7 +58,6 @@ namespace Terminal.Gui {
 			Assert.Empty (r.Subviews);
 			Assert.False (r.WantContinuousButtonPressed);
 			Assert.False (r.WantMousePositionReports);
-			Assert.Null (r.GetEnumerator ().Current);
 			Assert.Null (r.SuperView);
 			Assert.Null (r.MostFocused);
 
@@ -83,7 +81,6 @@ namespace Terminal.Gui {
 			Assert.Empty (r.Subviews);
 			Assert.False (r.WantContinuousButtonPressed);
 			Assert.False (r.WantMousePositionReports);
-			Assert.Null (r.GetEnumerator ().Current);
 			Assert.Null (r.SuperView);
 			Assert.Null (r.MostFocused);