|
@@ -63,6 +63,8 @@ namespace Terminal.Gui {
|
|
/// So for each context must be a new instance of a statusbar.
|
|
/// So for each context must be a new instance of a statusbar.
|
|
/// </summary>
|
|
/// </summary>
|
|
public class StatusBar : View {
|
|
public class StatusBar : View {
|
|
|
|
+ bool disposedValue;
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// The items that compose the <see cref="StatusBar"/>
|
|
/// The items that compose the <see cref="StatusBar"/>
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -73,6 +75,8 @@ namespace Terminal.Gui {
|
|
/// </summary>
|
|
/// </summary>
|
|
public StatusBar () : this (items: new StatusItem [] { }) { }
|
|
public StatusBar () : this (items: new StatusItem [] { }) { }
|
|
|
|
|
|
|
|
+ Action<Application.ResizedEventArgs> cachedResizedHandler;
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="StatusBar"/> class with the specified set of <see cref="StatusItem"/>s.
|
|
/// Initializes a new instance of the <see cref="StatusBar"/> class with the specified set of <see cref="StatusItem"/>s.
|
|
/// The <see cref="StatusBar"/> will be drawn on the lowest line of the terminal or <see cref="View.SuperView"/> (if not null).
|
|
/// The <see cref="StatusBar"/> will be drawn on the lowest line of the terminal or <see cref="View.SuperView"/> (if not null).
|
|
@@ -90,7 +94,7 @@ namespace Terminal.Gui {
|
|
Width = Dim.Fill ();
|
|
Width = Dim.Fill ();
|
|
Height = 1;
|
|
Height = 1;
|
|
|
|
|
|
- Application.Resized += (e) => {
|
|
|
|
|
|
+ cachedResizedHandler = (action) => {
|
|
X = 0;
|
|
X = 0;
|
|
Height = 1;
|
|
Height = 1;
|
|
if (SuperView == null || SuperView == Application.Top) {
|
|
if (SuperView == null || SuperView == Application.Top) {
|
|
@@ -99,6 +103,8 @@ namespace Terminal.Gui {
|
|
Y = Pos.Bottom (SuperView);
|
|
Y = Pos.Bottom (SuperView);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+
|
|
|
|
+ Application.Resized += cachedResizedHandler;
|
|
}
|
|
}
|
|
|
|
|
|
Attribute ToggleScheme (Attribute scheme)
|
|
Attribute ToggleScheme (Attribute scheme)
|
|
@@ -192,5 +198,16 @@ namespace Terminal.Gui {
|
|
return false;
|
|
return false;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /// <inheritdoc/>
|
|
|
|
+ protected override void Dispose (bool disposing)
|
|
|
|
+ {
|
|
|
|
+ if (!disposedValue) {
|
|
|
|
+ if (disposing) {
|
|
|
|
+ Application.Resized -= cachedResizedHandler;
|
|
|
|
+ }
|
|
|
|
+ disposedValue = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|