Browse Source

Disabled line-based border POC and prototype close button

Tig 1 year ago
parent
commit
796e797586

+ 2 - 0
Terminal.Gui/View/Adornment/Adornment.cs

@@ -308,6 +308,7 @@ public class Adornment : View
         }
     }
 
+    /// <inheritdoc />
     protected internal override bool OnMouseEnter (MouseEvent mouseEvent)
     {
         // Invert Normal
@@ -322,6 +323,7 @@ public class Adornment : View
         return base.OnMouseEnter (mouseEvent);
     }
 
+    /// <inheritdoc />
     protected internal override bool OnMouseLeave (MouseEvent mouseEvent)
     {
         // Invert Normal

+ 18 - 9
Terminal.Gui/View/Adornment/Border.cs

@@ -56,18 +56,21 @@ public class Border : Adornment
         Parent = parent;
     }
 
+#if SUBVIEW_BASED_BORDER
     private Line _left;
 
     /// <summary>
     ///    The close button for the border. Set to <see cref="View.Visible"/>, to <see langword="true"/> to enable.
     /// </summary>
     public Button CloseButton { get; internal set; }
+#endif
 
     /// <inheritdoc/>
     public override void BeginInit ()
     {
         base.BeginInit ();
 
+#if SUBVIEW_BASED_BORDER
         if (Parent is { })
         {
             // Left
@@ -90,9 +93,11 @@ public class Border : Adornment
             Add (CloseButton);
 
             LayoutStarted += OnLayoutStarted;
-        }
     }
+#endif
+}
 
+#if SUBVIEW_BASED_BORDER
     private void OnLayoutStarted (object sender, LayoutEventArgs e)
     {
         _left.Border.LineStyle = LineStyle;
@@ -106,7 +111,8 @@ public class Border : Adornment
                         (Pos.Right (CloseButton) -
                          Pos.Left (CloseButton));
         CloseButton.Y = 0;
-    }
+}
+#endif
 
     /// <summary>
     ///     The color scheme for the Border. If set to <see langword="null"/>, gets the <see cref="Adornment.Parent"/>
@@ -380,16 +386,19 @@ public class Border : Adornment
                 }
             }
 
+#if !SUBVIEW_BASED_BORDER
+
             if (drawLeft)
             {
-                //lc.AddLine (
-                //            new (borderBounds.Location.X, titleY),
-                //            sideLineLength,
-                //            Orientation.Vertical,
-                //            LineStyle,
-                //            Driver.GetAttribute ()
-                //           );
+                lc.AddLine (
+                            new (borderBounds.Location.X, titleY),
+                            sideLineLength,
+                            Orientation.Vertical,
+                            LineStyle,
+                            Driver.GetAttribute ()
+                           );
             }
+#endif
 
             if (drawBottom)
             {

+ 3 - 0
UICatalog/Scenarios/Adornments.cs

@@ -102,6 +102,8 @@ public class Adornments : Scenario
                                 btnButtonInPadding.BorderStyle = LineStyle.Dashed;
                                 btnButtonInPadding.Border.Thickness = new (1,1,1,1);
                                 view.Padding.Add (btnButtonInPadding);
+
+#if SUBVIEW_BASED_BORDER
                                 btnButtonInPadding.Border.CloseButton.Visible = true;
 
                                 view.Border.CloseButton.Visible = true;
@@ -112,6 +114,7 @@ public class Adornments : Scenario
                                                                   };
 
                                 view.Accept += (s, e) => MessageBox.Query (20, 7, "Hi", "Window Close Button Pressed!", "Ok");
+#endif
                             };
 
         Application.Top.Closed += (s, e) => View.Diagnostics = _diagnosticFlags;