More prototyping 2

This commit is contained in:
Tig
2024-10-16 17:24:36 -06:00
parent 70bf627d62
commit f5ddf6b584
7 changed files with 15 additions and 17 deletions

View File

@@ -514,7 +514,7 @@ public static partial class Application // Run (Begin, Run, End, Stop)
{
if (clear)
{
tl.SetNeedsDisplay();
tl.SetNeedsDisplay(Screen);
}
tl.Draw ();
}

View File

@@ -220,7 +220,7 @@ public partial class View // Drawing APIs
if (IsLayoutNeeded ())
{
Debug.WriteLine ($"Layout should be de-coupled from drawing: {this}");
//Debug.WriteLine ($"Layout should be de-coupled from drawing: {this}");
}
//// TODO: This ensures overlapped views are drawn correctly. However, this is inefficient.
@@ -573,7 +573,7 @@ public partial class View // Drawing APIs
{
if (view.IsLayoutNeeded ())
{
Debug.WriteLine ($"Layout should be de-coupled from drawing: {view}");
//Debug.WriteLine ($"Layout should be de-coupled from drawing: {view}");
//view.LayoutSubviews ();
}

View File

@@ -85,15 +85,7 @@ public partial class View // SuperView/SubView hierarchy management (SuperView,
view.EndInit ();
}
SetLayoutNeeded();
//CheckDimAuto ();
// view.SetRelativeLayout(Application.Screen.Size);
//if (view.Visible)
//{
// SetNeedsDisplay();
//};
return view;
}

View File

@@ -657,7 +657,7 @@ public partial class View // Layout APIs
SetTitleTextFormatterSize ();
}
SetNeedsDisplay ();
//SetNeedsDisplay ();
SuperView?.SetNeedsDisplay ();
}
@@ -821,6 +821,10 @@ public partial class View // Layout APIs
if (!current.IsLayoutNeeded ())
{
current._layoutNeeded = true;
current.Margin?.SetLayoutNeeded ();
current.Border?.SetLayoutNeeded ();
current.Padding?.SetLayoutNeeded ();
foreach (View subview in current.Subviews)
{
stack.Push (subview);

View File

@@ -229,6 +229,7 @@ public partial class View : Responder, ISupportInitializeNotification
// These calls were moved from BeginInit as they access Viewport which is indeterminate until EndInit is called.
UpdateTextDirection (TextDirection);
UpdateTextFormatterText ();
SetLayoutNeeded ();
if (_subviews is { })
@@ -242,6 +243,9 @@ public partial class View : Responder, ISupportInitializeNotification
}
}
// TOOD: Figure out how to move this out of here and just depend on IsLayoutNeeded in Mainloop
LayoutSubviews();
Initialized?.Invoke (this, EventArgs.Empty);
}

View File

@@ -82,7 +82,6 @@ public class Bar : View, IOrientation, IDesignable
{
base.EndInit ();
ColorScheme = Colors.ColorSchemes ["Menu"];
LayoutBarItems (GetContentSize ());
}
/// <inheritdoc/>
@@ -121,7 +120,7 @@ public class Bar : View, IOrientation, IDesignable
/// <param name="newOrientation"></param>
public void OnOrientationChanged (Orientation newOrientation)
{
SetLayoutNeeded ();
LayoutBarItems (SuperView?.GetContentSize() ?? Application.Screen.Size);
}
#endregion

View File

@@ -384,7 +384,6 @@ public class AllViewsTester : Scenario
_curView = view;
_hostPane.Add (_curView);
// Application.Refresh();
}
private void DisposeCurrentView ()
@@ -558,12 +557,12 @@ public class AllViewsTester : Scenario
return;
}
if (!view.Width!.Has<DimAuto> (out _) || (view.Width is null || view.Frame.Width == 0))
if (!view.Width!.Has<DimAuto> (out _) || (view.Width is null))
{
view.Width = Dim.Fill ();
}
if (!view.Height!.Has<DimAuto> (out _) || (view.Height is null || view.Frame.Height == 0))
if (!view.Height!.Has<DimAuto> (out _) || (view.Height is null))
{
view.Height = Dim.Fill ();
}