Merge pull request #926 from tig/statusbar_hide

StatusBar.Visible = false support
This commit is contained in:
Charlie Kindel
2020-09-29 16:18:29 -06:00
committed by GitHub
4 changed files with 24 additions and 11 deletions

View File

@@ -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);

View File

@@ -22,7 +22,10 @@
<Summary>Application framework for creating modern console applications using .NET</Summary>
<Title>Terminal.Gui is a framework for creating console user interfaces</Title>
<PackageReleaseNotes>
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!)

View File

@@ -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);
}

View File

@@ -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;