module
TUI::Scrollable
Overview
What a widget hosted inside a Window must provide. Unlike Widget, a Scrollable has no x/y of its own and does not own a Buffer, a border, or a Scroller — Window supplies all of that.
Direct including types
Defined in:
tui/widget/scrollable.crInstance Method Summary
-
#content_size : Int32
Total scrollable content rows.
- #focus_if(condition : Bool) : Nil
-
#focused=(focused : Bool)
Gates whether #handle_key/#handle_click should be given a chance to consume the current event, same convention as Widget#focused? — toggle it via #focus_if.
-
#focused? : Bool
Gates whether #handle_key/#handle_click should be given a chance to consume the current event, same convention as Widget#focused? — toggle it via #focus_if.
-
#handle_click(local_row : Int32, local_col : Int32, scroll : ScrollControl) : Bool
A positional (mouse) event, pre-translated by Window into content-local row/col (0,0 = content's own first cell).
-
#handle_key(ev : KeyEvent, scroll : ScrollControl) : Bool
Everything but positional mouse hit-testing.
-
#header_rows : Int32
Rows reserved above the data rows (e.g.
-
#render_content(buffer : Buffer, scroll : ScrollControl) : Nil
Render into
buffer, a region already sized to the content area (border/scrollbar column already excluded by Window). - #status_hint : String
- #title : String
Instance Method Detail
Total scrollable content rows. Does NOT include a header row — header is content-internal (TableView-specific), not Window's.
Gates whether #handle_key/#handle_click should be given a chance to consume the current event, same convention as Widget#focused? — toggle it via #focus_if.
Gates whether #handle_key/#handle_click should be given a chance to consume the current event, same convention as Widget#focused? — toggle it via #focus_if.
A positional (mouse) event, pre-translated by Window into content-local row/col (0,0 = content's own first cell).
Everything but positional mouse hit-testing.
Rows reserved above the data rows (e.g. a table's column header) that Window must exclude from the visible/scrollable viewport size it hands to its Scroller and ScrollControl (see Window#render/ #handle_key) — content still draws this row itself via #render_content; Window never draws it and has no other way to know it exists. Defaults to 0 (no header), so existing Scrollables need no changes.
Render into buffer, a region already sized to the content area
(border/scrollbar column already excluded by Window). Row 0 is
content's own first row.