module
Opal::UI::InputHookable
Overview
Module that equips UI components with per-control input lifecycle hooks, custom input overrides, and code puppeting capabilities.
Direct including types
Defined in:
opal/ui/input_hookable.crInstance Method Summary
- #custom_inputs=(custom_inputs : Bool)
- #custom_inputs? : Bool
- #default_input_proc : Proc(InputEvent, Bool) | Nil
- #default_input_proc=(default_input_proc : Proc(InputEvent, Bool) | Nil)
-
#fallback_to_defaults!(enabled : Bool = true) : self
Sets whether unhandled events in custom input hooks fall back to standard default inputs.
- #fallback_to_defaults=(fallback_to_defaults : Bool)
- #fallback_to_defaults? : Bool
- #focus : self
- #focused=(focused : Bool)
- #focused? : Bool
-
#handle_default_input(event : InputEvent) : Bool
Executes the default input logic for this control.
-
#handle_input(event : InputEvent) : Bool
Routes an incoming input event through custom hooks or default handlers.
-
#handle_key(key : Terminal::KeyEvent) : Bool
Default key event handler.
-
#handle_mouse(event : Terminal::MouseEvent) : Bool
Default mouse event handler.
- #input_hook : Proc(InputEvent, Bool) | Nil
- #input_hook=(input_hook : Proc(InputEvent, Bool) | Nil)
-
#on_input(&block : self, InputEvent -> Bool) : self
Attaches a custom input hook to this control.
-
#puppet(&block : self, InputEvent -> Bool) : self
Programmatically puppet this control from code.
-
#reset_inputs : self
Clears custom hooks and reinitializes default input bindings.
-
#setup_default_inputs : Nil
Lifecycle hook: Configures default keyboard and mouse behaviors.
- #unfocus : self
-
#use_custom_inputs!(enabled : Bool = true) : self
Enables or disables custom input processing.
Instance Method Detail
Sets whether unhandled events in custom input hooks fall back to standard default inputs.
Executes the default input logic for this control.
Routes an incoming input event through custom hooks or default handlers.
Default key event handler. Override in subclasses if not using @default_input_proc.
Default mouse event handler. Override in subclasses if not using @default_input_proc.
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).
Programmatically puppet this control from code. Alias for #on_input.
Lifecycle hook: Configures default keyboard and mouse behaviors. May be overridden by subclasses to establish or reset component-specific default input bindings.
Enables or disables custom input processing.