Declarative input binding map. More...
Public Member Functions | |
| IMsg? | Handle (IMsg msg) |
| Try to resolve an input message to an application message. | |
| IMsg? | HandleKey (KeyMsg key) |
| Try to resolve a keyboard message. Returns null if no binding matches. | |
| IMsg? | HandleMouse (MouseMsg mouse) |
| Try to resolve a mouse message. Returns null if no binding matches. | |
| KeyMap | Merge (KeyMap other) |
| Create a new KeyMap containing all bindings from this map followed by all bindings from other . | |
| KeyMap | On (ConsoleKey key, Func< IMsg > handler) |
| Bind a key (any modifiers) to a message factory. | |
| KeyMap | On (ConsoleKey key, Func< KeyMsg, IMsg > handler) |
| Bind a key (any modifiers) to a message factory that receives the original KeyMsg. | |
| KeyMap | On (KeyPattern pattern, Func< IMsg > handler) |
| Bind a KeyPattern to a message factory. | |
| KeyMap | On (KeyPattern pattern, Func< KeyMsg, IMsg > handler) |
| Bind a KeyPattern to a message factory that receives the original KeyMsg. | |
| KeyMap | OnClick (Func< MouseMsg, IMsg > handler) |
| Bind left-click press events. | |
| KeyMap | OnMouse (Func< MouseMsg, bool > predicate, Func< MouseMsg, IMsg > handler) |
| Bind any mouse event matching predicate . | |
| KeyMap | OnMouse (MouseButton button, MouseAction action, Func< MouseMsg, IMsg > handler) |
| Bind a specific mouse button + action combination. | |
| KeyMap | OnScroll (Func< MouseMsg, IMsg > handler) |
| Bind scroll-wheel events (both up and down). | |
Properties | |
| int | KeyBindingCount [get] |
| Number of key bindings registered. | |
| int | MouseBindingCount [get] |
| Number of mouse bindings registered. | |
Declarative input binding map.
Resolves KeyMsg and MouseMsg to application IMsg values without switch statements.
Usage:
Bindings are evaluated in registration order; the first match wins.
The map is mutable during construction (fluent builder) but should be stored as a static readonly field once built. It is thread-safe for reads.
Try to resolve an input message to an application message.
Returns null if no binding matches. Handles both KeyMsg and MouseMsg.
Create a new KeyMap containing all bindings from this map followed by all bindings from other .
This map's bindings take priority (evaluated first).