Canvas¶
An absolute-positioning container. Children are placed at explicit (x, y) coordinates with fixed sizes. The user implements render_background() for custom drawing; children are composited on top in registration order (later on top).
Children keep their positions when the canvas resizes — they are clipped at the canvas bounds.
Implements¶
- CompositeWidget tag
Constructors¶
create¶
Parameters¶
- p: WidgetParent tag
Returns¶
- Canvas tag^
Public Behaviours¶
add¶
Place a child widget at (x, y) with the given size. The child is resized to (w, h) when the canvas receives its own resize. Later-added children draw on top of earlier ones.
Parameters¶
move¶
Reposition a child widget. Size is unchanged.
Parameters¶
resize¶
Update canvas size and re-render. Children keep their fixed sizes and positions — they are clipped at the new bounds.
Parameters¶
receive_grid¶
Parameters¶
trigger_render¶
receive_key¶
Parameters¶
- key: KeyEvent val
receive_focus¶
receive_blur¶
set_debug_bg¶
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¶
Returns¶
- WidgetState ref
render¶
Render background, then blit each child at its (x, y) position. Children are composited in registration order (later on top). Clipped at canvas bounds.
Returns¶
- Grid val
render_background¶
Returns¶
- Grid val
register_child¶
Parameters¶
- widget: Widget tag
Returns¶
- None val
render_and_send¶
Returns¶
- None val