Widget¶
Base trait for all widget actors. Users implement their own actors with this trait.
Required: state() returns the WidgetState field, render() produces
the grid. All other behaviors have default implementations.
The fun ref methods are uncallable from outside the actor because
external references are always tag capability.
Public Behaviours¶
resize¶
Update allocated size and re-render.
Parameters¶
trigger_render¶
Force a re-render and send to parent.
receive_key¶
Handle a key event. Default: ignore.
Parameters¶
- key: KeyEvent val
receive_focus¶
Called when this widget receives focus. Default: re-render.
receive_blur¶
Called when this widget loses focus. Default: re-render.
set_debug_bg¶
Set a debug background color to visualize this widget's allocated space. Use Default to disable.
be set_debug_bg(
color: (Default val | Black val | Red val |
Green val | Yellow val | Blue val |
Magenta val | Cyan val | White val |
BrightBlack val | BrightRed val | BrightGreen val |
BrightYellow val | BrightBlue val | BrightMagenta val |
BrightCyan val | BrightWhite val | Rainbow val))
Parameters¶
- color: (Default val | Black val | Red val | Green val | Yellow val | Blue val | Magenta val | Cyan val | White val | BrightBlack val | BrightRed val | BrightGreen val | BrightYellow val | BrightBlue val | BrightMagenta val | BrightCyan val | BrightWhite val | Rainbow val)
Public Functions¶
state¶
Return the widget's state. Backed by a field on the actor.
Returns¶
- WidgetState ref
render¶
Produce a grid representing the current widget state.
Returns¶
- Grid val
render_and_send¶
Render the widget and send the grid to the parent.
Returns¶
- None val