Skip to content

InputBinding

Namespace: Hex1b.Input

Assembly: Hex1b.dll

Represents a key binding that matches a sequence of key steps and executes an action. Supports both single-key bindings and multi-step chords.

csharp
public sealed class InputBinding

Inheritance

ObjectInputBinding

Constructors

InputBinding(IReadOnlyList<KeyStep>, Action, string?, bool, ActionId?, bool)

Creates an input binding with a simple action handler (no context).

Parameters:

csharp
public InputBinding(IReadOnlyList<KeyStep> steps, Action action, string? description = null, bool isGlobal = false, ActionId? actionId = null, bool overridesCapture = false)

InputBinding(IReadOnlyList<KeyStep>, Action<InputBindingActionContext>, string?, bool, ActionId?, bool)

Creates an input binding with a synchronous context-aware action handler.

Parameters:

csharp
public InputBinding(IReadOnlyList<KeyStep> steps, Action<InputBindingActionContext> action, string? description = null, bool isGlobal = false, ActionId? actionId = null, bool overridesCapture = false)

InputBinding(IReadOnlyList<KeyStep>, Func<InputBindingActionContext, Task>, string?, bool, ActionId?, bool)

Creates an input binding with an async context-aware action handler.

Parameters:

csharp
public InputBinding(IReadOnlyList<KeyStep> steps, Func<InputBindingActionContext, Task> handler, string? description = null, bool isGlobal = false, ActionId? actionId = null, bool overridesCapture = false)

Properties

ActionId

A stable identifier for the action this binding performs. Used for programmatic rebinding via . Convention: "WidgetName.ActionName" (e.g., "List.MoveUp").

Returns: Nullable<ActionId>

csharp
public ActionId? ActionId { get; }

Description

Optional description for this binding (for help/documentation).

Returns: String

csharp
public string? Description { get; }

FirstStep

Gets the first key step of this binding (for trie insertion).

Returns: KeyStep

csharp
public KeyStep FirstStep { get; }

IsGlobal

Whether this binding is global (evaluated regardless of focus). Global bindings are checked before focus-based routing.

Returns: Boolean

csharp
public bool IsGlobal { get; }

IsSingleKey

Gets whether this is a single-key binding (vs a chord).

Returns: Boolean

csharp
public bool IsSingleKey { get; }

OverridesCapture

Whether this binding overrides input capture. When true, this binding is checked even when another node has captured all input. Use this for menu accelerators and other app-level shortcuts that should always work.

Returns: Boolean

csharp
public bool OverridesCapture { get; }

OwnerNode

The node that owns this binding (for conflict detection and debugging).

Returns: Hex1bNode

csharp
public Hex1bNode? OwnerNode { get; }

Steps

The sequence of key steps that trigger this binding. Single-key bindings have exactly one step; chords have multiple steps.

Returns: IReadOnlyList<KeyStep>

csharp
public IReadOnlyList<KeyStep> Steps { get; }

Methods

Alt(Hex1bKey, Action, string?)

Creates a binding for Alt+Key.

Parameters:

Returns: InputBinding

csharp
[Obsolete("Use InputBindingsBuilder fluent API instead.")]
public static InputBinding Alt(Hex1bKey key, Action handler, string? description = null)

Ctrl(Hex1bKey, Action, string?)

Creates a binding for Ctrl+Key.

Parameters:

Returns: InputBinding

csharp
[Obsolete("Use InputBindingsBuilder fluent API instead.")]
public static InputBinding Ctrl(Hex1bKey key, Action handler, string? description = null)

CtrlShift(Hex1bKey, Action, string?)

Creates a binding for Ctrl+Shift+Key.

Parameters:

Returns: InputBinding

csharp
[Obsolete("Use InputBindingsBuilder fluent API instead.")]
public static InputBinding CtrlShift(Hex1bKey key, Action handler, string? description = null)

ExecuteAsync(InputBindingActionContext)

Executes the binding's handler with the given context.

Parameters:

Returns: Task

csharp
public Task ExecuteAsync(InputBindingActionContext context)

Plain(Hex1bKey, Action, string?)

Creates a binding for a plain key (no modifiers).

Parameters:

Returns: InputBinding

csharp
[Obsolete("Use InputBindingsBuilder fluent API instead.")]
public static InputBinding Plain(Hex1bKey key, Action handler, string? description = null)

Shift(Hex1bKey, Action, string?)

Creates a binding for Shift+Key.

Parameters:

Returns: InputBinding

csharp
[Obsolete("Use InputBindingsBuilder fluent API instead.")]
public static InputBinding Shift(Hex1bKey key, Action handler, string? description = null)

ToString()

Returns a string that represents the current object.

Returns: String

A string that represents the current object.

csharp
public override string ToString()

Released under the MIT License.