|
@@ -1248,7 +1248,7 @@ namespace Terminal.Gui {
|
|
|
}
|
|
|
|
|
|
// https://en.wikipedia.org/wiki/Topological_sorting
|
|
|
- static List<View> TopologicalSort (HashSet<View> nodes, HashSet<(View, View)> edges)
|
|
|
+ List<View> TopologicalSort (HashSet<View> nodes, HashSet<(View, View)> edges)
|
|
|
{
|
|
|
var result = new List<View> ();
|
|
|
|
|
@@ -1261,7 +1261,8 @@ namespace Terminal.Gui {
|
|
|
S.Remove (n);
|
|
|
|
|
|
// add n to tail of L
|
|
|
- result.Add (n);
|
|
|
+ if (n != this?.SuperView)
|
|
|
+ result.Add (n);
|
|
|
|
|
|
// for each node m with an edge e from n to m do
|
|
|
foreach (var e in edges.Where (e => e.Item1.Equals (n)).ToList ()) {
|
|
@@ -1271,7 +1272,7 @@ namespace Terminal.Gui {
|
|
|
edges.Remove (e);
|
|
|
|
|
|
// if m has no other incoming edges then
|
|
|
- if (edges.All (me => me.Item2.Equals (m) == false)) {
|
|
|
+ if (edges.All (me => me.Item2.Equals (m) == false) && m != this?.SuperView) {
|
|
|
// insert m into S
|
|
|
S.Add (m);
|
|
|
}
|
|
@@ -1325,11 +1326,15 @@ namespace Terminal.Gui {
|
|
|
if (v.LayoutStyle == LayoutStyle.Computed)
|
|
|
v.RelativeLayout (Frame);
|
|
|
|
|
|
- if (this?.SuperView != v)
|
|
|
- v.LayoutSubviews ();
|
|
|
+ v.LayoutSubviews ();
|
|
|
v.layoutNeeded = false;
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ if (SuperView == Application.Top && layoutNeeded && ordered.Count == 0 && LayoutStyle == LayoutStyle.Computed) {
|
|
|
+ RelativeLayout (Frame);
|
|
|
+ }
|
|
|
+
|
|
|
layoutNeeded = false;
|
|
|
}
|
|
|
|
|
@@ -1569,7 +1574,7 @@ namespace Terminal.Gui {
|
|
|
}
|
|
|
foreach (var view in Subviews) {
|
|
|
if (view.Frame.IntersectsWith (region)) {
|
|
|
- //view.SetNeedsLayout ();
|
|
|
+ view.SetNeedsLayout ();
|
|
|
view.SetNeedsDisplay (view.Bounds);
|
|
|
}
|
|
|
}
|
|
@@ -2142,6 +2147,11 @@ namespace Terminal.Gui {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Action that is invoked once at beginning.
|
|
|
+ /// </summary>
|
|
|
+ static public Action OnLoad;
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// Building block API: Prepares the provided toplevel for execution.
|
|
|
/// </summary>
|
|
@@ -2176,6 +2186,7 @@ namespace Terminal.Gui {
|
|
|
if (toplevel.LayoutStyle == LayoutStyle.Computed)
|
|
|
toplevel.RelativeLayout (new Rect (0, 0, Driver.Cols, Driver.Rows));
|
|
|
toplevel.LayoutSubviews ();
|
|
|
+ OnLoad?.Invoke ();
|
|
|
toplevel.WillPresent ();
|
|
|
Redraw (toplevel);
|
|
|
toplevel.PositionCursor ();
|