Skip to content

MouseBinding

Namespace: Hex1b.Input

Assembly: Hex1b.dll

A binding that triggers an action on a mouse event.

csharp
public sealed class MouseBinding

Inheritance

ObjectMouseBinding

Constructors

MouseBinding(MouseButton, MouseAction, Hex1bModifiers, Action, string?, ActionId?, bool)

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

Parameters:

csharp
public MouseBinding(MouseButton button, MouseAction action, Hex1bModifiers modifiers, Action handler, string? description, ActionId? actionId = null, bool overridesCapture = false)

MouseBinding(MouseButton, MouseAction, Hex1bModifiers, int, Action, string?, ActionId?, bool)

Creates a mouse binding with a simple action handler and click count (no context).

Parameters:

csharp
public MouseBinding(MouseButton button, MouseAction action, Hex1bModifiers modifiers, int clickCount, Action handler, string? description, ActionId? actionId = null, bool overridesCapture = false)

MouseBinding(MouseButton, MouseAction, Hex1bModifiers, int, Action<InputBindingActionContext>, string?, ActionId?, bool)

Creates a mouse binding with a synchronous context-aware handler.

Parameters:

csharp
public MouseBinding(MouseButton button, MouseAction action, Hex1bModifiers modifiers, int clickCount, Action<InputBindingActionContext> handler, string? description, ActionId? actionId = null, bool overridesCapture = false)

MouseBinding(MouseButton, MouseAction, Hex1bModifiers, int, Func<InputBindingActionContext, Task>, string?, ActionId?, bool)

Creates a mouse binding with an async context-aware handler.

Parameters:

csharp
public MouseBinding(MouseButton button, MouseAction action, Hex1bModifiers modifiers, int clickCount, Func<InputBindingActionContext, Task> handler, string? description, ActionId? actionId = null, bool overridesCapture = false)

Properties

Action

The mouse action that triggers this binding (default: Down for click).

Returns: MouseAction

csharp
public MouseAction Action { get; }

ActionId

A stable identifier for the action this binding performs. Used for programmatic rebinding via .

Returns: Nullable<ActionId>

csharp
public ActionId? ActionId { get; }

Button

The mouse button that triggers this binding.

Returns: MouseButton

csharp
public MouseButton Button { get; }

ClickCount

The minimum click count required to trigger this binding. 1 = single click (default), 2 = double click, 3 = triple click. A binding with ClickCount=2 will match events with ClickCount >= 2.

Returns: Int32

csharp
public int ClickCount { get; }

Description

Human-readable description of what this binding does.

Returns: String

csharp
public string? Description { get; }

Modifiers

Required modifier keys.

Returns: Hex1bModifiers

csharp
public Hex1bModifiers Modifiers { get; }

OverridesCapture

Whether this binding overrides input capture. When true and the owning node has captured input, the binding is checked even if the click would not normally route to the node (the click only needs to fall within the captured node's bounds). Mirrors for keyboard bindings — useful for "while in this mode, my widget owns this mouse button" patterns (e.g., right-click commit during copy mode).

Returns: Boolean

csharp
public bool OverridesCapture { get; }

Methods

ExecuteAsync(InputBindingActionContext)

Executes the handler for this binding.

Parameters:

Returns: Task

csharp
public Task ExecuteAsync(InputBindingActionContext context)

Matches(Hex1bMouseEvent)

Checks if this binding matches the given mouse event. For click count: binding matches if event's click count is >= binding's required count.

Parameters:

Returns: Boolean

csharp
public bool Matches(Hex1bMouseEvent mouseEvent)

Released under the MIT License.