Skip to content

InputBindingActionContext

Namespace: Hex1b.Input

Assembly: Hex1b.dll

Context passed to input binding action handlers and widget event handlers. Provides app-level services for focus navigation, cancellation, and other common operations.

csharp
public sealed class InputBindingActionContext

Inheritance

ObjectInputBindingActionContext

Properties

CancellationToken

Cancellation token from the application run loop. Use this for async operations that should be cancelled when the app stops.

Returns: CancellationToken

csharp
public CancellationToken CancellationToken { get; }

Focusables

Gets all focusable nodes in render order.

Returns: IReadOnlyList<Hex1bNode>

csharp
public IReadOnlyList<Hex1bNode> Focusables { get; }

FocusedNode

Gets the currently focused node, or null if none.

Returns: Hex1bNode

csharp
public Hex1bNode? FocusedNode { get; }

MouseX

The absolute X coordinate of the mouse event, if this context was created for a mouse binding. -1 if not applicable (e.g., for keyboard bindings).

Returns: Int32

csharp
public int MouseX { get; }

MouseY

The absolute Y coordinate of the mouse event, if this context was created for a mouse binding. -1 if not applicable (e.g., for keyboard bindings).

Returns: Int32

csharp
public int MouseY { get; }

Notifications

Gets the notification stack for the nearest notification host (typically a NotificationPanel) in the focused node's ancestry. Use this to post notifications from event handlers.

Returns: NotificationStack

csharp
public NotificationStack Notifications { get; }

Popups

Gets the popup stack for the nearest popup host (typically a ZStack) in the focused node's ancestry. Use this to push popups, menus, and dialogs from event handlers. The root ZStack automatically provides a PopupStack, so this is never null within a Hex1bApp.

Returns: PopupStack

csharp
public PopupStack Popups { get; }

this[string]

Gets the window manager for a named WindowPanel.

Parameters:

  • name (String): The name of the WindowPanel.

Returns: WindowManager

csharp
public WindowManager this[string name] { get; }

Windows

Gets the window manager for managing floating windows.

Returns: WindowManager

csharp
public WindowManager Windows { get; }

Methods

CopyToClipboard(string)

Copies the specified text to the system clipboard using the OSC 52 escape sequence. This works on terminals that support the OSC 52 clipboard protocol (most modern terminals).

Parameters:

  • text (String): The text to copy to the clipboard.
csharp
public void CopyToClipboard(string text)

Focus(Hex1bNode)

Focuses a specific node if it's in the ring.

Parameters:

Returns: Boolean

True if the node was found and focused.

csharp
public bool Focus(Hex1bNode node)

FocusNext()

Moves focus to the next focusable widget in the ring. This is the standard way to implement Tab navigation.

Returns: Boolean

True if focus was moved, false if there are no focusables.

csharp
public bool FocusNext()

FocusPrevious()

Moves focus to the previous focusable widget in the ring. This is the standard way to implement Shift+Tab navigation.

Returns: Boolean

True if focus was moved, false if there are no focusables.

csharp
public bool FocusPrevious()

FocusWhere(Func<Hex1bNode, bool>)

Focuses the first node in the ring that matches the predicate.

Parameters:

Returns: Boolean

True if a matching node was found and focused, false otherwise.

csharp
public bool FocusWhere(Func<Hex1bNode, bool> predicate)

Invalidate()

Signals that the UI needs to be re-rendered.

csharp
public void Invalidate()

RequestStop()

Requests the application to stop. The RunAsync call will exit gracefully after the current frame completes.

csharp
public void RequestStop()

TryGetNotifications()

Tries to get the notification stack, returning null if no notification host is found. Use this when notifications are optional and you don't want an exception.

Returns: NotificationStack

csharp
public NotificationStack? TryGetNotifications()

TryGetWindows()

Tries to get the default window manager, returning null if not available.

Returns: WindowManager

csharp
public WindowManager? TryGetWindows()

TryGetWindows(string)

Tries to get a named window manager, returning null if not found.

Parameters:

Returns: WindowManager

csharp
public WindowManager? TryGetWindows(string name)

Released under the MIT License.