From b1e28baa2a7aaf5add5b0bef40703dd0363505ab Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Tue, 29 Sep 2020 13:07:38 -0700 Subject: [PATCH 1/2] enables hiding statusbar --- Terminal.Gui/Core/Toplevel.cs | 12 ++++++------ Terminal.Gui/Views/StatusBar.cs | 4 ++-- UICatalog/UICatalog.cs | 14 ++++++++++++-- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Terminal.Gui/Core/Toplevel.cs b/Terminal.Gui/Core/Toplevel.cs index 9741f5d8a..213b86f9c 100644 --- a/Terminal.Gui/Core/Toplevel.cs +++ b/Terminal.Gui/Core/Toplevel.cs @@ -333,9 +333,9 @@ namespace Terminal.Gui { } ny = Math.Max (y, l); if (SuperView == null || SuperView.GetType () != typeof (Toplevel)) { - s = Application.Top.StatusBar != null; + s = Application.Top.StatusBar != null && Application.Top.StatusBar.Visible; } else { - s = ((Toplevel)SuperView).StatusBar != null; + s = ((Toplevel)SuperView).StatusBar != null && ((Toplevel)SuperView).StatusBar.Visible; } if (SuperView == null || SuperView is Toplevel) { l = s ? Driver.Rows - 1 : Driver.Rows; @@ -368,12 +368,12 @@ namespace Terminal.Gui { } } if (top.StatusBar != null) { - if (ny + top.Frame.Height > top.Frame.Height - 1) { + if (ny + top.Frame.Height > top.Frame.Height - (top.StatusBar.Visible ? 1 : 0)) { if (top.Height is Dim.DimFill) - top.Height = Dim.Fill () - 1; + top.Height = Dim.Fill () - (top.StatusBar.Visible ? 1 : 0); } - if (top.StatusBar.Frame.Y != top.Frame.Height - 1) { - top.StatusBar.Y = top.Frame.Height - 1; + if (top.StatusBar.Frame.Y != top.Frame.Height - (top.StatusBar.Visible ? 1 : 0)) { + top.StatusBar.Y = top.Frame.Height - (top.StatusBar.Visible ? 1 : 0); top.LayoutSubviews (); } top.BringSubviewToFront (top.StatusBar); diff --git a/Terminal.Gui/Views/StatusBar.cs b/Terminal.Gui/Views/StatusBar.cs index 75e4b858c..670e34b34 100644 --- a/Terminal.Gui/Views/StatusBar.cs +++ b/Terminal.Gui/Views/StatusBar.cs @@ -105,8 +105,8 @@ namespace Terminal.Gui { return delegate { X = 0; Height = 1; - if (SuperView == null || SuperView is Toplevel) { - Y = SuperView.Frame.Height - 1; + if (SuperView != null || SuperView is Toplevel) { + Y = SuperView.Frame.Height - (Visible ? 1 : 0); } else { //Y = Pos.Bottom (SuperView); } diff --git a/UICatalog/UICatalog.cs b/UICatalog/UICatalog.cs index 95f9b711b..3a45e9584 100644 --- a/UICatalog/UICatalog.cs +++ b/UICatalog/UICatalog.cs @@ -215,7 +215,10 @@ namespace UICatalog { _numlock = new StatusItem (Key.CharMask, "Num", null); _scrolllock = new StatusItem (Key.CharMask, "Scroll", null); - _statusBar = new StatusBar (new StatusItem [] { + _statusBar = new StatusBar () { + Visible = true, + }; + _statusBar.Items = new StatusItem [] { _capslock, _numlock, _scrolllock, @@ -228,7 +231,14 @@ namespace UICatalog { _runningScenario.RequestStop(); } }), - }); + new StatusItem(Key.F10, "~F10~ Hide/Show Status Bar", () => { + _statusBar.Visible = !_statusBar.Visible; + _leftPane.Height = Dim.Fill(_statusBar.Visible ? 1 : 0); + _rightPane.Height = Dim.Fill(_statusBar.Visible ? 1 : 0); + _top.LayoutSubviews(); + _top.ChildNeedsDisplay(); + }), + }; SetColorScheme (); _top = Application.Top; From a2f95c4fd9e5f2a3ded044b969bc83d8a9b7247d Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Tue, 29 Sep 2020 13:28:39 -0700 Subject: [PATCH 2/2] added relnote --- Terminal.Gui/Terminal.Gui.csproj | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Terminal.Gui/Terminal.Gui.csproj b/Terminal.Gui/Terminal.Gui.csproj index ea08ba4a9..94d6e5908 100644 --- a/Terminal.Gui/Terminal.Gui.csproj +++ b/Terminal.Gui/Terminal.Gui.csproj @@ -22,7 +22,10 @@ Application framework for creating modern console applications using .NET Terminal.Gui is a framework for creating console user interfaces - This (0.90) is the "Feature Complete" pre-release of Terminal.Gui (aka gui.cs) 1.0. This release is a signficant upgrade from the previous published release (0.81). Most of the major changes and bug fixes are listed below. NOTE: This release includes breaking changes to the API; we will strive to avoid any more breaking changes before 1.0. + v1.00 - + * If StatusBar.Visible is set to false, TopLevel resizes correctly enabling hiding/showing of a StatusBar. UICatalog demonstrates. + + v0.90 - "Feature Complete" pre-release of Terminal.Gui (aka gui.cs) 1.0. This release is a signficant upgrade from the previous published release (0.81). Most of the major changes and bug fixes are listed below. NOTE: This release includes breaking changes to the API; we will strive to avoid any more breaking changes before 1.0. What's new: * New sample/demo app - UI Catalog - Replaces demo.cs with an easy to use and extend set of demo scenarios. (Thanks @tig!)