module

Opal::UI::InputHookable

Module that equips UI components with per-control input lifecycle hooks, custom input overrides, and code puppeting capabilities.

Instance methods

custom_inputs=(custom_inputs : Bool)
Source
custom_inputs?
Source
default_input_proc
Source
default_input_proc=(default_input_proc : Proc(InputEvent, Bool) | Nil)
Source
fallback_to_defaults!(enabled : Bool = true) : self

Sets whether unhandled events in custom input hooks fall back to standard default inputs.

Source
fallback_to_defaults=(fallback_to_defaults : Bool)
Source
fallback_to_defaults?
Source
focus
Source
focused=(focused : Bool)
Source
focused?
Source
handle_default_input(event : InputEvent) : Bool

Executes the default input logic for this control.

Source
handle_input(event : InputEvent) : Bool

Routes an incoming input event through custom hooks or default handlers.

Source
handle_key(key : Terminal::KeyEvent) : Bool

Default key event handler. Override in subclasses if not using @default_input_proc.

Source
handle_mouse(event : Terminal::MouseEvent) : Bool

Default mouse event handler. Override in subclasses if not using @default_input_proc.

Source
input_hook
Source
input_hook=(input_hook : Proc(InputEvent, Bool) | Nil)
Source
on_input

Attaches a custom input hook to this control. The block receives self (strongly typed to the control class) and the InputEvent. Returning true consumes the event. Returning false allows fallback to default inputs (if fallback_to_defaults? is true).

Source
puppet

Programmatically puppet this control from code. Alias for on_input.

Source
reset_inputs

Clears custom hooks and reinitializes default input bindings.

Source
setup_default_inputs

Lifecycle hook: Configures default keyboard and mouse behaviors. May be overridden by subclasses to establish or reset component-specific default input bindings.

Source
unfocus
Source
use_custom_inputs!(enabled : Bool = true) : self

Enables or disables custom input processing.

Source