abstract class
TUI::ListView
- TUI::ListView
- Reference
- Object
Included Modules
Direct Known Subclasses
Defined in:
tui/widgets/list_view.crtui/widgets/list_view_define.cr
Constructors
Macro Summary
-
scroll(header)
Declares how many rows this ListView subclass reserves above its data rows (e.g.
Instance Method Summary
-
#content_size : Int32
Total scrollable content rows.
-
#cursor_focused_style : Style
Layered (via Term.overlay) onto the cursor row when this list is focused — see #render_content.
-
#cursor_focused_style=(cursor_focused_style : Style)
Layered (via Term.overlay) onto the cursor row when this list is focused — see #render_content.
-
#cursor_unfocused_style : Style
Layered onto the cursor row when this list is NOT focused — a weaker cue than #cursor_focused_style, so cursor position still shows without implying the list is active.
-
#cursor_unfocused_style=(cursor_unfocused_style : Style)
Layered onto the cursor row when this list is NOT focused — a weaker cue than #cursor_focused_style, so cursor position still shows without implying the list is active.
-
#filter_active? : Bool
Whether the filter/search input is currently capturing keystrokes.
-
#filter_prompt_style : Style
Applied to the
/filterprompt line while filtering is active. -
#filter_prompt_style=(filter_prompt_style : Style)
Applied to the
/filterprompt line while filtering is active. -
#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
Satisfies Scrollable#header_rows by delegating to #content_row_offset — kept as one method, not two independently-set numbers, so Window's scroll-viewport math can never disagree with where #render_content actually starts drawing data rows.
-
#on_activate : Proc(Int32, Nil) | Nil
Fires with the selected row's index on Enter or a confirmed click (see ClickTracker) — the "open/commit this row" signal, distinct from #on_select's continuous highlight tracking.
-
#on_activate=(on_activate : Proc(Int32, Nil) | Nil)
Fires with the selected row's index on Enter or a confirmed click (see ClickTracker) — the "open/commit this row" signal, distinct from #on_select's continuous highlight tracking.
-
#on_select : Proc(Int32, Nil) | Nil
Fires with the newly-current row's index whenever the cursor moves (arrows, page keys, mouse wheel, click, filtering, sort change, #reload) — a live "what's highlighted right now" signal, e.g.
-
#on_select=(on_select : Proc(Int32, Nil) | Nil)
Fires with the newly-current row's index whenever the cursor moves (arrows, page keys, mouse wheel, click, filtering, sort change, #reload) — a live "what's highlighted right now" signal, e.g.
- #reload : Nil
-
#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). -
#row_content(index : Int32) : String
The content string for content-row
index, before the leading " {pointer}" prefix and before width-fitting/highlight styling (those stay in#render_content, shared by every subclass). - #selected_index : Int32 | Nil
- #status_hint : String
- #title : String
-
#title_style : Style
Applied to #title's text when this list is focused (see #title).
-
#title_style=(title_style : Style)
Applied to #title's text when this list is focused (see #title).
Instance methods inherited from module TUI::Scrollable
content_size : Int32
content_size,
focus_if(condition : Bool) : Nil
focus_if,
focused=(focused : Bool)
focused=,
focused? : Bool
focused?,
handle_click(local_row : Int32, local_col : Int32, scroll : ScrollControl) : Bool
handle_click,
handle_key(ev : KeyEvent, scroll : ScrollControl) : Bool
handle_key,
header_rows : Int32
header_rows,
render_content(buffer : Buffer, scroll : ScrollControl) : Nil
render_content,
status_hint : String
status_hint,
title : String
title
Constructor Detail
Macro Detail
Declares how many rows this ListView subclass reserves above its
data rows (e.g. a table's column header), as a bare class-body
statement: scroll header: 1. Expands to the #content_row_offset
override — the single source of truth #render_content and
Scrollable#header_rows (queried by Window to keep scroll/cursor
math from running past what's actually drawable) both read from.
Instance Method Detail
Total scrollable content rows. Does NOT include a header row — header is content-internal (TableView-specific), not Window's.
Layered (via Term.overlay) onto the cursor row when this list is focused — see #render_content.
Layered (via Term.overlay) onto the cursor row when this list is focused — see #render_content.
Layered onto the cursor row when this list is NOT focused — a weaker cue than #cursor_focused_style, so cursor position still shows without implying the list is active.
Layered onto the cursor row when this list is NOT focused — a weaker cue than #cursor_focused_style, so cursor position still shows without implying the list is active.
Whether the filter/search input is currently capturing keystrokes. A host app dispatching its own global key menu on top of this widget should skip that dispatch entirely while this is true — otherwise a global single-char binding (e.g. a "m" or "q" shortcut) hijacks a keystroke the user is typing into the filter text instead of it being appended to the filter.
Applied to the /filter prompt line while filtering is active.
Applied to the /filter prompt line while filtering is active.
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.
Satisfies Scrollable#header_rows by delegating to #content_row_offset — kept as one method, not two independently-set numbers, so Window's scroll-viewport math can never disagree with where #render_content actually starts drawing data rows.
Fires with the selected row's index on Enter or a confirmed click (see ClickTracker) — the "open/commit this row" signal, distinct from #on_select's continuous highlight tracking.
Fires with the selected row's index on Enter or a confirmed click (see ClickTracker) — the "open/commit this row" signal, distinct from #on_select's continuous highlight tracking.
Fires with the newly-current row's index whenever the cursor moves (arrows, page keys, mouse wheel, click, filtering, sort change, #reload) — a live "what's highlighted right now" signal, e.g. for driving a detail pane alongside the list.
Fires with the newly-current row's index whenever the cursor moves (arrows, page keys, mouse wheel, click, filtering, sort change, #reload) — a live "what's highlighted right now" signal, e.g. for driving a detail pane alongside the list.
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.
The content string for content-row index, before the leading
" {pointer}" prefix and before width-fitting/highlight styling
(those stay in #render_content, shared by every subclass).
Applied to #title's text when this list is focused (see #title).
Applied to #title's text when this list is focused (see #title).