Skip to content

WindowManager

Namespace: Hex1b

Assembly: Hex1b.dll

Manages floating windows within a . Handles window registration, z-ordering, and modal window stacking.

csharp
public sealed class WindowManager

Inheritance

ObjectWindowManager

Properties

ActiveWindow

Gets the currently active (topmost non-modal or topmost modal) window.

Returns: WindowEntry

csharp
public WindowEntry? ActiveWindow { get; }

All

Gets all open windows in z-order (bottom to top).

Returns: IReadOnlyList<WindowEntry>

csharp
public IReadOnlyList<WindowEntry> All { get; }

Count

Gets the count of open windows.

Returns: Int32

csharp
public int Count { get; }

HasModalWindow

Checks if there are any modal windows open. When modal windows are open, non-modal windows should not receive input.

Returns: Boolean

csharp
public bool HasModalWindow { get; }

Methods

BringToFront(WindowEntry)

Brings a window to the front (highest z-index).

Parameters:

csharp
public void BringToFront(WindowEntry entry)

BringToFront(WindowHandle)

Brings a window to the front by its handle.

Parameters:

csharp
public void BringToFront(WindowHandle handle)

Close(WindowEntry)

Closes a window by its entry.

Parameters:

Returns: Boolean

True if the window was found and closed.

csharp
public bool Close(WindowEntry entry)

Close(WindowHandle)

Closes a window by its handle.

Parameters:

Returns: Boolean

True if the window was found and closed.

csharp
public bool Close(WindowHandle handle)

CloseAll()

Closes all windows.

csharp
public void CloseAll()

Get(WindowHandle)

Gets a window entry by its handle.

Parameters:

Returns: WindowEntry

The window entry, or null if not found.

csharp
public WindowEntry? Get(WindowHandle handle)

IsOpen(WindowHandle)

Checks if a window with the given handle is open.

Parameters:

Returns: Boolean

True if the window is open.

csharp
public bool IsOpen(WindowHandle handle)

Open(WindowHandle)

Opens a window from a window handle. If the window is already open, it is brought to front instead.

Parameters:

Returns: WindowEntry

The window entry.

csharp
public WindowEntry Open(WindowHandle handle)

Window(Func<WindowContentContext<Hex1bWidget>, Hex1bWidget>)

Creates a new window handle with the specified content builder. The window is not opened until is called.

Parameters:

  • content (Func<Hex1bWidget>, Hex1bWidget>): Builder function for window content. Receives a
    that provides access to the window handle via the Window property.

Returns: WindowHandle

A window handle that can be configured with fluent methods and opened.

csharp
public WindowHandle Window(Func<WindowContentContext<Hex1bWidget>, Hex1bWidget> content)

Events

Changed

Event raised when the window collection or state changes.

Returns: Action

csharp
public event Action? Changed

Remarks

The window manager is the central coordinator for all floating windows in an application. It tracks: All open windows and their z-orderThe currently active (focused) windowModal window stack for blocking interaction

Access the window manager from event handlers via e.Context.Windows or through the property.

Examples

Opening a window from a button click:

csharp
ctx.Button("Open Settings").OnClick(e => {
    var window = e.Windows.Window(w => w.VStack(v => [
        v.Text("Settings content here"),
        v.Button("Close").OnClick(ev => ev.Windows.Close(w.Window))
    ]))
    .Title("Settings")
    .Size(60, 20);

    e.Windows.Open(window);
});

Released under the MIT License.