class TUI::DetailView

Included Modules

Defined in:

tui/widgets/detail_view.cr

Constant Summary

DEFAULT_LABEL_WIDTH = 16

Default column width reserved for a row's label, before the value column starts — shared by #render_content and #render_line so labels and wrapped continuation lines always align. Override via #initialize's label_width for consumers with longer labels.

Constructors

Instance Method Summary

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

def self.new(source : DetailDataSource, label_width : Int32 = DEFAULT_LABEL_WIDTH) #

[View source]

Instance Method Detail

def content_size : Int32 #
Description copied from module TUI::Scrollable

Total scrollable content rows. Does NOT include a header row — header is content-internal (TableView-specific), not Window's.


[View source]
def handle_click(local_row : Int32, local_col : Int32, scroll : ScrollControl) : Bool #
Description copied from module TUI::Scrollable

A positional (mouse) event, pre-translated by Window into content-local row/col (0,0 = content's own first cell).


[View source]
def handle_key(ev : KeyEvent, scroll : ScrollControl) : Bool #
Description copied from module TUI::Scrollable

Everything but positional mouse hit-testing.


[View source]
def label_style : Style #

Applied to every row's label column (see #render_line).


[View source]
def label_style=(label_style : Style) #

Applied to every row's label column (see #render_line).


[View source]
def load(id : String) : Nil #

Loads new content. Callers using a Window-hosted DetailView should also call the Window's #reset_scroll afterward — this class has no Scroller of its own to reset (Window owns it).


[View source]
def on_close : Proc(Nil) | Nil #

Fires when the host app should dismiss this DetailView (e.g. its own Esc/"back" binding) — DetailView never pops itself off a nav stack; the host decides what "closing" means.


[View source]
def on_close=(on_close : Proc(Nil) | Nil) #

Fires when the host app should dismiss this DetailView (e.g. its own Esc/"back" binding) — DetailView never pops itself off a nav stack; the host decides what "closing" means.


[View source]
def render_content(buffer : Buffer, scroll : ScrollControl) : Nil #
Description copied from module TUI::Scrollable

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.


[View source]
def status_hint : String #

[View source]
def title : String #

[View source]
def wrap_marker_style : Style #

Applied to the trailing \ continuation marker on soft-wrapped value lines (see #render_line).


[View source]
def wrap_marker_style=(wrap_marker_style : Style) #

Applied to the trailing \ continuation marker on soft-wrapped value lines (see #render_line).


[View source]