feat(ui): persist retained window layouts

This commit is contained in:
Erik 2026-07-10 23:17:29 +02:00
parent a8e9503d2e
commit 921c388e2c
22 changed files with 705 additions and 141 deletions

View file

@ -10,7 +10,7 @@ namespace AcDream.App.UI;
/// the dragged height to the nearer stop so the frame always rests collapsed or expanded — never a
/// half-row. Toolkit UX (keystone.dll has no decomp; the dat stacks both rows always) — see IA-17.
/// </summary>
public sealed class UiCollapsibleFrame : UiNineSlicePanel
public sealed class UiCollapsibleFrame : UiNineSlicePanel, IRetainedWindowStateController
{
public UiCollapsibleFrame(Func<uint, (uint, int, int)> resolve) : base(resolve) { }
@ -33,4 +33,15 @@ public sealed class UiCollapsibleFrame : UiNineSlicePanel
/// <summary>Test hook — OnTick is protected. Drives one snap+visibility reconcile.</summary>
internal void TickForTest(double dt) => OnTick(dt);
public RetainedWindowState CaptureWindowState()
=> new(Collapsed: !IsExpanded);
public void RestoreWindowState(RetainedWindowState state)
{
if (ExpandedHeight <= CollapsedHeight) return;
Height = state.Collapsed ? CollapsedHeight : ExpandedHeight;
for (int i = 0; i < SecondRow.Count; i++)
SecondRow[i].Visible = !state.Collapsed;
}
}