feat(ui): centralize retained window lifecycle
This commit is contained in:
parent
4bb37e302e
commit
6e9e10367f
12 changed files with 778 additions and 57 deletions
|
|
@ -37,6 +37,7 @@ namespace AcDream.App.UI;
|
|||
public sealed class UiHost : System.IDisposable
|
||||
{
|
||||
public UiRoot Root { get; } = new();
|
||||
public RetailWindowManager WindowManager => Root.WindowManager;
|
||||
public TextRenderer TextRenderer { get; }
|
||||
public BitmapFont? DefaultFont { get; set; }
|
||||
|
||||
|
|
@ -106,7 +107,14 @@ public sealed class UiHost : System.IDisposable
|
|||
// ── Window manager forwarders (delegate to UiRoot) ─────────────────
|
||||
|
||||
/// <summary>Register a top-level window for Show/Hide/Toggle. See <see cref="UiRoot.RegisterWindow"/>.</summary>
|
||||
public void RegisterWindow(string name, UiElement window) => Root.RegisterWindow(name, window);
|
||||
public RetailWindowHandle RegisterWindow(
|
||||
string name,
|
||||
UiElement window,
|
||||
UiElement? contentRoot = null,
|
||||
IRetainedPanelController? controller = null)
|
||||
=> Root.RegisterWindow(name, window, contentRoot, controller);
|
||||
|
||||
public bool UnregisterWindow(string name) => Root.UnregisterWindow(name);
|
||||
|
||||
/// <summary>Show a registered window; returns false if the name is unknown.</summary>
|
||||
public bool ShowWindow(string name) => Root.ShowWindow(name);
|
||||
|
|
@ -114,6 +122,8 @@ public sealed class UiHost : System.IDisposable
|
|||
/// <summary>Hide a registered window; returns false if the name is unknown.</summary>
|
||||
public bool HideWindow(string name) => Root.HideWindow(name);
|
||||
|
||||
public bool CloseWindow(string name) => Root.CloseWindow(name);
|
||||
|
||||
/// <summary>Return the current visibility of a registered window.</summary>
|
||||
public bool IsWindowVisible(string name) => Root.IsWindowVisible(name);
|
||||
|
||||
|
|
@ -122,6 +132,7 @@ public sealed class UiHost : System.IDisposable
|
|||
|
||||
public void Dispose()
|
||||
{
|
||||
WindowManager.Dispose();
|
||||
TextRenderer.Dispose();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue