Browse Source

Convert to full properties

tznind 2 years ago
parent
commit
90c08ef3a0
1 changed files with 34 additions and 7 deletions
  1. 34 7
      Terminal.Gui/Views/SplitContainer.cs

+ 34 - 7
Terminal.Gui/Views/SplitContainer.cs

@@ -8,6 +8,8 @@ namespace Terminal.Gui {
 		private LineView splitterLine = new LineView ();
 		private LineView splitterLine = new LineView ();
 		private bool panel1Collapsed;
 		private bool panel1Collapsed;
 		private bool panel2Collapsed;
 		private bool panel2Collapsed;
+		private Pos splitterDistance = Pos.Percent (50);
+		private Orientation orientation = Orientation.Vertical;
 
 
 		public SplitContainer ()
 		public SplitContainer ()
 		{
 		{
@@ -18,18 +20,18 @@ namespace Terminal.Gui {
 			this.Add (Panel1);
 			this.Add (Panel1);
 			this.Add (Panel2);
 			this.Add (Panel2);
 
 
-			SetOrientation (Orientation.Vertical, Pos.Percent (50));
+			Setup ();
 
 
 			// TODO: Actually respect collapsed statuses
 			// TODO: Actually respect collapsed statuses
 		}
 		}
 
 
-		private void SetOrientation (Orientation orientation, Pos splitterDistance)
+		private void Setup ()
 		{
 		{
 			// TODO: Enforce minimum sizes
 			// TODO: Enforce minimum sizes
 
 
-			splitterLine.Orientation = orientation;
+			splitterLine.Orientation = Orientation;
 
 
-			switch (orientation) {
+			switch (Orientation) {
 			case Orientation.Horizontal:
 			case Orientation.Horizontal:
 				splitterLine.X = 0;
 				splitterLine.X = 0;
 				splitterLine.Y = splitterDistance;
 				splitterLine.Y = splitterDistance;
@@ -78,6 +80,10 @@ namespace Terminal.Gui {
 		/// to this <see cref="View"/> using <see cref="View.Add(View)"/>.
 		/// to this <see cref="View"/> using <see cref="View.Add(View)"/>.
 		/// </summary>
 		/// </summary>
 		public View Panel1 { get; } = new View ();
 		public View Panel1 { get; } = new View ();
+
+		/// <summary>
+		/// TODO: not implemented yet
+		/// </summary>
 		public int Panel1MinSize { get; set; }
 		public int Panel1MinSize { get; set; }
 
 
 		/// <summary>
 		/// <summary>
@@ -89,7 +95,9 @@ namespace Terminal.Gui {
 				panel1Collapsed = value;
 				panel1Collapsed = value;
 				if (value && panel2Collapsed) {
 				if (value && panel2Collapsed) {
 					panel2Collapsed = false;
 					panel2Collapsed = false;
-				}	
+				}
+
+				Setup ();
 			}
 			}
 
 
 		}
 		}
@@ -100,6 +108,10 @@ namespace Terminal.Gui {
 		/// to this <see cref="View"/> using <see cref="View.Add(View)"/>
 		/// to this <see cref="View"/> using <see cref="View.Add(View)"/>
 		/// </summary>
 		/// </summary>
 		public View Panel2 { get; } = new View ();
 		public View Panel2 { get; } = new View ();
+
+		/// <summary>
+		/// TODO: not implemented yet
+		/// </summary>
 		public int Panel2MinSize { get; set; }
 		public int Panel2MinSize { get; set; }
 
 
 		/// <summary>
 		/// <summary>
@@ -112,9 +124,24 @@ namespace Terminal.Gui {
 				if (value && panel1Collapsed) {
 				if (value && panel1Collapsed) {
 					panel1Collapsed = false;
 					panel1Collapsed = false;
 				}
 				}
+				Setup ();
+			}
+		}
+
+		public Orientation Orientation {
+			get { return orientation; }
+			set {
+				orientation = value;
+				Setup ();
+			}
+		}
+
+		public Pos SplitterDistance {
+			get { return splitterDistance; }
+			set {
+				splitterDistance = value;
+				Setup ();
 			}
 			}
 		}
 		}
-		public Orientation Orientation { get; set; }
-		public Pos SplitterDistance { get; set; }
 	}
 	}
 }
 }