WindowHandle
Namespace: Hex1b
Assembly: Hex1b.dll
A factory/descriptor for creating windows using the fluent builder pattern. WindowHandle captures the configuration and content callback, which are invoked during reconciliation to build the actual widget tree.
public sealed class WindowHandleInheritance
Object → WindowHandle
Methods
AllowOutOfBounds()
Allows this window to be moved outside the panel bounds.
Returns: WindowHandle
This handle for fluent chaining.
public WindowHandle AllowOutOfBounds()Cancel()
Closes this window without a result, signaling cancellation. The OnResult callback will receive IsCancelled = true.
public void Cancel()CloseWithResult<T>(T)
Closes this window with a typed result value. Used for modal dialogs that return a result to the caller.
Parameters:
result(<T>): The result value to return.
public void CloseWithResult<T>(T result)EscapeBehavior(WindowEscapeBehavior)
Sets the escape key behavior for this window.
Parameters:
behavior(WindowEscapeBehavior): The escape behavior.
Returns: WindowHandle
This handle for fluent chaining.
public WindowHandle EscapeBehavior(WindowEscapeBehavior behavior)LeftTitleActions(Func<TitleActionBuilder, IEnumerable<TitleAction>>)
Configures the actions displayed on the left side of the title bar.
Parameters:
builder(Func<TitleActionBuilder, TitleAction>>): Builder function that receives a and returns title actions.
Returns: WindowHandle
This handle for fluent chaining.
public WindowHandle LeftTitleActions(Func<TitleActionBuilder, IEnumerable<TitleAction>> builder)Modal()
Makes this a modal window that blocks interaction with other windows.
Returns: WindowHandle
This handle for fluent chaining.
public WindowHandle Modal()NoTitleBar()
Hides the title bar, creating a frameless window.
Returns: WindowHandle
This handle for fluent chaining.
public WindowHandle NoTitleBar()OnActivated(Action)
Registers a callback to be invoked when the window becomes active (brought to front).
Parameters:
onActivated(Action): The callback to invoke on activation.
Returns: WindowHandle
This handle for fluent chaining.
public WindowHandle OnActivated(Action onActivated)OnClose(Action)
Registers a callback to be invoked when the window is closed.
Parameters:
onClose(Action): The callback to invoke on close.
Returns: WindowHandle
This handle for fluent chaining.
public WindowHandle OnClose(Action onClose)OnDeactivated(Action)
Registers a callback to be invoked when the window loses active status.
Parameters:
onDeactivated(Action): The callback to invoke on deactivation.
Returns: WindowHandle
This handle for fluent chaining.
public WindowHandle OnDeactivated(Action onDeactivated)OnResult<T>(Action<WindowResultContext<T>>)
Registers a callback to be invoked when the window closes with a typed result.
Parameters:
callback(Action<WindowResultContext<<T>>>): The callback to invoke with the result context.
Returns: WindowHandle
This handle for fluent chaining.
public WindowHandle OnResult<T>(Action<WindowResultContext<T>> callback)Open(WindowManager)
Opens this window using the specified window manager. Convenience method for fluent chaining.
Parameters:
manager(WindowManager): The window manager to open the window with.
Returns: WindowEntry
The opened window entry.
public WindowEntry Open(WindowManager manager)Position(int, int)
Sets the initial position of the window.
Parameters:
Returns: WindowHandle
This handle for fluent chaining.
public WindowHandle Position(int x, int y)Position(WindowPositionSpec)
Sets the positioning strategy for initial placement.
Parameters:
position(WindowPositionSpec): The position specification.
Returns: WindowHandle
This handle for fluent chaining.
public WindowHandle Position(WindowPositionSpec position)Resizable(int, int, int?, int?)
Makes this window resizable by dragging edges and corners.
Parameters:
minWidth(Int32): Minimum width constraint.minHeight(Int32): Minimum height constraint.maxWidth(Nullable<Int32>): Maximum width constraint (null = unbounded).maxHeight(Nullable<Int32>): Maximum height constraint (null = unbounded).
Returns: WindowHandle
This handle for fluent chaining.
public WindowHandle Resizable(int minWidth = 10, int minHeight = 5, int? maxWidth = null, int? maxHeight = null)RightTitleActions(Func<TitleActionBuilder, IEnumerable<TitleAction>>)
Configures the actions displayed on the right side of the title bar. If not called, defaults to a single close button.
Parameters:
builder(Func<TitleActionBuilder, TitleAction>>): Builder function that receives a and returns title actions.
Returns: WindowHandle
This handle for fluent chaining.
public WindowHandle RightTitleActions(Func<TitleActionBuilder, IEnumerable<TitleAction>> builder)Size(int, int)
Sets the initial size of the window.
Parameters:
Returns: WindowHandle
This handle for fluent chaining.
public WindowHandle Size(int width, int height)Title(string)
Sets the window title displayed in the title bar.
Parameters:
title(String): The window title.
Returns: WindowHandle
This handle for fluent chaining.
public WindowHandle Title(string title)Remarks
WindowHandle provides a fluent API for defining windows that integrates with the widget builder experience. The handle itself serves as the identity for the window - no string ID is required.
Example usage:
var window = e.Windows.Window(w => w.VStack(v => [
v.Text("Settings"),
v.Button("Close").OnClick(ev => ev.Windows.Close(w.Window))
]))
.Title("Settings")
.Size(40, 20)
.RightTitleActions(t => [t.Close()]);
e.Windows.Open(window);