class

Tui::App

Inherits Tui::Widget / Tui::Reactive / Reference / Object

Constructors

Class methods

add_overlay(renderer : OverlayRenderer) : Nil

Register an overlay to be rendered on top of everything

Source
clear_overlays

Clear all overlays

Source
css_path

CSS file path (set by subclass or via css_file class method)

Source
css_path=(css_path : String | Nil)

CSS file path (set by subclass or via css_file class method)

Source
remove_overlay(renderer : OverlayRenderer) : Nil

Remove an overlay

Source

Instance methods

app

Get app reference (self)

Source
apply_stylesheet(stylesheet : CSS::Stylesheet) : Nil

Apply a stylesheet

Source
compose

Override to create root widget tree

Source
enable_css_hot_reload(path : String | Nil = nil, interval : Time::Span = 500.milliseconds) : Nil

Enable hot reload for CSS file

Source
load_css(path : String) : Nil

Load CSS from file

Source
load_css_string(css : String) : Nil

Load CSS from string

Source
mark_dirty!

Override mark_dirty! to automatically wake up event loop This means any widget calling mark_dirty! from a background fiber will automatically trigger a re-render without manual wakeup

Source
mount_headless(width : Int32, height : Int32) : Nil

Mount and layout without starting terminal (for testing)

Source
on_capture(event : Event) : Bool

Capture app-level keys before they reach children

Source
on_event(event : Event) : Bool

Handle 'q' for quit only if children didn't handle it

Source
on_mount

Build the widget tree before applying a stylesheet loaded in initialize.

Source
on_resize(width : Int32, height : Int32) : Nil

Override to be notified of app-level events

Source
quit

Stop the application

Source
refresh

Refresh layout (public access to layout_children)

Source
render(buffer : Buffer, clip : Rect) : Nil

Override to render widget content

Source
render_fps=(fps : Int32) : Nil

Set render FPS (default 60)

Source
run

Start the application

Source
stylesheet

Get current stylesheet

Source
wakeup

Wake up the event loop to process dirty flag and rerender Call this from background fibers after updating state

Source