Bladeren bron

Fixed more menubar/statusbar

Tig 9 maanden geleden
bovenliggende
commit
7630b35d86

+ 1 - 1
Terminal.Gui/Application/Application.Mouse.cs

@@ -224,7 +224,7 @@ public static partial class Application // Mouse handling
         {
             // The mouse was outside any View's Viewport.
 
-            Debug.Fail ("This should never happen. If it does please file an Issue!!");
+           // Debug.Fail ("This should never happen. If it does please file an Issue!!");
 
             return;
         }

+ 1 - 1
UICatalog/Scenarios/ASCIICustomButton.cs

@@ -54,7 +54,7 @@ public class ASCIICustomButtonTest : Scenario
             ]
         };
 
-        _scrollViewTestWindow = new ScrollViewTestWindow ();
+        _scrollViewTestWindow = new ScrollViewTestWindow { Y = Pos.Bottom (menu) };
 
         top.Add (menu, _scrollViewTestWindow);
         Application.Run (top);

+ 6 - 5
UICatalog/Scenarios/ClassExplorer.cs

@@ -22,11 +22,6 @@ public class ClassExplorer : Scenario
         Application.Init ();
         var top = new Toplevel ();
 
-        var win = new Window
-        {
-            Title = GetName ()
-        };
-
         var menu = new MenuBar
         {
             Menus =
@@ -61,6 +56,12 @@ public class ClassExplorer : Scenario
         };
         top.Add (menu);
 
+        var win = new Window
+        {
+            Title = GetName (),
+            Y = Pos.Bottom (menu)
+        };
+
         _treeView = new TreeView<object> { X = 0, Y = 1, Width = Dim.Percent (50), Height = Dim.Fill () };
 
         var lblSearch = new Label { Text = "Search" };

+ 3 - 12
UICatalog/Scenarios/ContextMenus.cs

@@ -25,7 +25,8 @@ public class ContextMenus : Scenario
         // Setup - Create a top-level application window and configure it.
         Window appWindow = new ()
         {
-            Title = GetQuitKeyAndName ()
+            Title = GetQuitKeyAndName (),
+            Arrangement = ViewArrangement.Fixed
         };
 
         var text = "Context Menu";
@@ -93,18 +94,8 @@ public class ContextMenus : Scenario
                                 Application.MouseEvent -= ApplicationMouseEvent;
                             };
 
-        var menu = new MenuBar
-        {
-            Menus =
-            [
-                new (
-                     "_File",
-                     new MenuItem [] { new ("_Quit", "", () => Application.RequestStop (), null, null, Application.QuitKey) })
-            ]
-        };
-
         var top = new Toplevel ();
-        top.Add (appWindow, menu);
+        top.Add (appWindow);
 
         // Run - Start the application.
         Application.Run (top);

+ 4 - 26
UICatalog/Scenarios/LineViewExample.cs

@@ -13,23 +13,12 @@ public class LineViewExample : Scenario
     public override void Main ()
     {
         Application.Init ();
-        // Setup - Create a top-level application window and configure it.
-        Toplevel top = new ();
 
-        var menu = new MenuBar
+        var appWindow = new Window()
         {
-            Menus =
-            [
-                new ("_File", new MenuItem [] { new ("_Quit", "", () => Quit ()) })
-            ]
+            Title = GetQuitKeyAndName (),
         };
-        top.Add (menu);
 
-        var appWindow = new Window ()
-        {
-            Y = 1,
-            Height = Dim.Fill (1) // BUGBUG: what if StatusBar is taller than 1?
-        };
         appWindow.Add (new Label { Y = 1, Text = "Regular Line" });
 
         // creates a horizontal line
@@ -78,22 +67,11 @@ public class LineViewExample : Scenario
 
         appWindow.Add (verticalArrow);
 
-        var statusBar = new StatusBar (
-                                       new Shortcut []
-                                       {
-                                           new (Application.QuitKey, "Quit", Quit)
-                                       }
-                                      );
-        top.Add (appWindow);
-        top.Add (statusBar);
-
         // Run - Start the application.
-        Application.Run (top);
-        top.Dispose ();
+        Application.Run (appWindow);
+        appWindow.Dispose ();
 
         // Shutdown - Calling Application.Shutdown is required.
         Application.Shutdown ();
     }
-
-    private void Quit () { Application.RequestStop (); }
 }

+ 2 - 0
UICatalog/Scenarios/Localization.cs

@@ -177,6 +177,8 @@ public class Localization : Scenario
         win.Add (wizardButton);
 
         win.Unloaded += (sender, e) => Quit ();
+
+        win.Y = Pos.Bottom (menu);
         top.Add (win);
 
         Application.Run (top);

+ 1 - 0
UICatalog/Scenarios/WizardAsView.cs

@@ -147,6 +147,7 @@ public class WizardAsView : Scenario
         lastStep.HelpText =
             "The wizard is complete!\n\nPress the Finish button to continue.\n\nPressing Esc will cancel.";
 
+        wizard.Y = Pos.Bottom (menu);
         topLevel.Add (wizard);
         Application.Run (topLevel);
         topLevel.Dispose ();