Rename Frame to FillContainer.

This commit is contained in:
2025-06-24 23:48:31 +02:00
parent 389a73cf24
commit 5bf052db96
2 changed files with 9 additions and 10 deletions

View File

@@ -0,0 +1,61 @@
using Voile.Rendering;
namespace Voile.UI.Containers;
/// <summary>
/// A special container that occupies the entire available size of the parent. <br />
/// Usually used as a root element for the UI system.
/// </summary>
public class FillContainer : Container
{
public FillContainer()
{
}
public FillContainer(Rect minimumSize) : base(minimumSize)
{
}
public override void Arrange()
{
}
public override void Render(RenderSystem renderer, Style style)
{
base.Render(renderer, style);
Rect parentSize;
if (Parent != null)
{
parentSize = Parent.Size;
}
else
{
var windowSize = renderer.WindowSize;
var windowRect = new Rect(windowSize.X, windowSize.Y);
parentSize = windowRect;
}
if (_lastParentSize != parentSize)
{
Size = parentSize;
_lastParentSize = parentSize;
}
}
protected override void OnUpdate()
{
base.OnUpdate();
if (Size == _lastParentSize) return;
Size = _lastParentSize;
}
private Rect _lastParentSize = Rect.Zero;
}