Enabled ViewArrangement.Overlapped zorder hack

This commit is contained in:
Tig
2024-08-02 14:47:49 -06:00
parent eaa5b01cc5
commit 09c1003716
2 changed files with 26 additions and 4 deletions

View File

@@ -501,16 +501,31 @@ public partial class View // Drawing APIs
// TODO: Implement OnDrawSubviews (cancelable);
if (_subviews is { } && SubViewNeedsDisplay)
{
IEnumerable<View> subviewsNeedingDraw = _subviews.Where (
view => view.Visible
&& (view.NeedsDisplay || view.SubViewNeedsDisplay || view.LayoutNeeded)
);
IEnumerable<View> subviewsNeedingDraw;
if (TabStop == TabBehavior.TabGroup && _subviews.Count(v => v.Arrangement.HasFlag (ViewArrangement.Overlapped)) > 0)
{
// TODO: This is a temporary hack to make overlapped non-Toplevels have a zorder. See also View.SetFocus
subviewsNeedingDraw = _tabIndexes.Where (
view => view.Visible
&& (view.NeedsDisplay || view.SubViewNeedsDisplay || view.LayoutNeeded)
).Reverse ();
}
else
{
subviewsNeedingDraw = _subviews.Where (
view => view.Visible
&& (view.NeedsDisplay || view.SubViewNeedsDisplay || view.LayoutNeeded)
);
}
foreach (View view in subviewsNeedingDraw)
{
if (view.LayoutNeeded)
{
view.LayoutSubviews ();
}
view.Draw ();
}
}

View File

@@ -605,6 +605,13 @@ public partial class View // Focus and cross-view navigation management (TabStop
// If there is no SuperView, then this is a top-level view
SetFocus (this);
}
// TODO: This is a temporary hack to make overlapped non-Toplevels have a zorder. See also: View.OnDrawContent.
if (viewToEnterFocus is { } && (viewToEnterFocus.TabStop == TabBehavior.TabGroup && viewToEnterFocus.Arrangement.HasFlag (ViewArrangement.Overlapped)))
{
viewToEnterFocus.TabIndex = 0;
}
}
/// <summary>