class
Opal::UI::Engine
- Opal::UI::Engine
- Reference
- Object
Overview
Focus coordinator and input router for interactive Control instances.
Coordinates Tab / Shift+Tab focus navigation, dispatches keyboard and mouse events
to the active control, and provides synthetic event injection for automated testing and puppeting.
Defined in:
opal/ui/engine.crConstructors
Instance Method Summary
-
#add(control : Control) : self
Adds a control to the engine.
-
#blur : self
Blurs all controls (unsets focused? on all).
- #controls : Array(Control)
- #controls=(controls : Array(Control))
-
#focus(control : Control) : self
Moves focus to the given control.
-
#focus_at(index : Int32) : self
Moves focus to the control at the specified index.
-
#focus_next : self
Cycles focus forward to the next control.
-
#focus_prev : self
Cycles focus backward to the previous control.
-
#focused_control : Control | Nil
Returns the currently focused control, if any.
- #focused_index : Int32
- #focused_index=(focused_index : Int32)
-
#handle_input(event : InputEvent) : Bool
General input event router (dispatches KeyEvent or MouseEvent).
-
#handle_key(key : Terminal::KeyEvent) : Bool
Dispatches a key event.
-
#handle_mouse(mouse : Terminal::MouseEvent) : Bool
Dispatches a mouse event to the focused control.
- #on_focus_change : Proc(Control | Nil, Control | Nil, Nil) | Nil
- #on_focus_change=(on_focus_change : Proc(Control | Nil, Control | Nil, Nil) | Nil)
-
#puppet(control : Control, &block : Control, InputEvent -> Bool) : self
Attaches a puppeting hook to a managed control.
-
#puppet_step(&block : Control -> Nil) : self
Executes an arbitrary mutation step on the currently focused control.
-
#remove(control : Control) : self
Removes a control from the engine and adjusts the active focus.
-
#send_key(name : String, char : Char | Nil = nil, ctrl : Bool = false, alt : Bool = false, shift : Bool = false) : Bool
Injects a synthetic key event for automated scripting or testing.
-
#send_mouse(x : Int32, y : Int32, button : Terminal::MouseButton = Terminal::MouseButton::Left, action : Terminal::MouseAction = Terminal::MouseAction::Press, ctrl : Bool = false, alt : Bool = false, shift : Bool = false) : Bool
Injects a synthetic mouse event for automated scripting or testing.
- #tab_navigation=(tab_navigation : Bool)
- #tab_navigation? : Bool
Constructor Detail
Instance Method Detail
Adds a control to the engine. If it's the first control, it receives focus.
General input event router (dispatches KeyEvent or MouseEvent).
Dispatches a key event. Intercepts Tab / Shift+Tab for navigation if enabled, otherwise routes to the focused control.
Dispatches a mouse event to the focused control.
Attaches a puppeting hook to a managed control.
Executes an arbitrary mutation step on the currently focused control.
Removes a control from the engine and adjusts the active focus.
Injects a synthetic key event for automated scripting or testing.
Injects a synthetic mouse event for automated scripting or testing.