Renderable.PrivateSourcetype context = {tree : unit Toffee.tree;schedule : unit -> unit;focus : t -> bool;blur : t -> unit;register_lifecycle : t -> unit;unregister_lifecycle : t -> unit;alloc_num : unit -> int;register : t -> unit;unregister : t -> unit;}The type for renderer callbacks inherited by all nodes in a tree.
val create_root :
context ->
?id:string ->
?style:Toffee.Style.t ->
?glyph_pool:Glyph.Pool.t ->
unit ->
tcreate_root ctx () is a new root node backed by ctx's layout tree.
Optional parameters:
id: identifier string. Defaults to "node-N".style: flexbox style. Defaults to Toffee.Style.default.glyph_pool: glyph pool for text rendering. Defaults to none.pre_render_update t ~delta runs t's on-frame and resize hooks.
render t grid ~delta invokes t's render callback.
ensure_frame_buffer t ~parent is Some buf if t uses buffered rendering and has positive dimensions, None otherwise.
blit_frame_buffer t ~dst copies t's frame buffer into dst.
render_full t ~grid ~delta runs the complete render sequence for t: frame buffer selection, pre-render hook, render callback, post-render hook, and frame buffer blit.
children_z t is t's children sorted by z-index. The result is cached.
iter_children_z t f applies f to each child of t in z-index order.
children_in_viewport ~parent ~viewport ~padding is the children of parent whose bounds intersect viewport expanded by padding cells, sorted by z-index.
focus_direct t focuses t without delegating to the renderer. Returns false if t is not focusable.
live_count t is the total number of live-rendering nodes in t's subtree, including t itself.
set_on_live_count_change t cb registers an observer called when live_count t changes. None clears it.
set_lifecycle_pass t callback registers a lifecycle pass hook for t. None clears it.
run_lifecycle_pass t invokes t's lifecycle callback, if any.
emit_mouse t event dispatches event to t's mouse handlers, bubbling to ancestors unless propagation is stopped via Event.Mouse.stop_propagation.
emit_default_key t event dispatches event to t's default key handler, if any.
emit_paste t event dispatches event to t's paste handler, if any.
emit_selection_changed t sel notifies t's selection on_change callback with sel. Returns false if no callback is registered.
should_start_selection t ~x ~y is true iff t's should_start callback returns true for (x, y). Returns false if no callback is registered.
get_selected_text t calls t's get_text callback and returns the result, or "" if no callback is registered.
child_clip t is the clipping rectangle for t's children as returned by t's clip override, or None if no override is set.
set_glyph_pool t pool assigns a glyph pool for text rendering by t and its descendants.
glyph_pool t is t's glyph pool, or None if none is assigned.