class
TUI::SplitWindow
- TUI::SplitWindow
- TUI::Widget
- Reference
- Object
Overview
One bordered box hosting two Scrollable content areas side by side, each with its own independent scroll position. The left pane's right edge is the internal divider column, which doubles as its scrollbar track (Buffer#scrollbar accepts an arbitrary column, so this needs no new drawing primitive); the right pane's scrollbar renders on the outer right border column exactly as Window's single pane does.
Defined in:
tui/layout/split_window.crConstructors
-
.full_screen(screen : Screen, left : Scrollable, right : Scrollable, left_width : Int32 | Nil = nil, bordered : Bool = true) : SplitWindow
Sizes and positions a SplitWindow to fill the screen below the status bar row — see Window.full_screen for the same reasoning.
- .new(x : Int32, y : Int32, width : Int32, height : Int32, left : Scrollable, right : Scrollable, left_width : Int32, bordered : Bool = true)
Instance Method Summary
-
#border_style : Style
Applied to the box border and internal pane divider drawn by #render.
-
#border_style=(border_style : Style)
Applied to the box border and internal pane divider drawn by #render.
-
#bordered=(bordered : Bool)
Whether to draw the box border/scrollbar chrome — same convention as Window#bordered?.
-
#bordered? : Bool
Whether to draw the box border/scrollbar chrome — same convention as Window#bordered?.
-
#extra_hint : String
Appended (with a leading double-space separator, matching how #status_hint already joins its own @menu.hint with active_pane's) to #status_hint when non-empty — for a host embedding this SplitWindow that wants its own app-level bindings (e.g.
-
#extra_hint=(extra_hint : String)
Appended (with a leading double-space separator, matching how #status_hint already joins its own @menu.hint with active_pane's) to #status_hint when non-empty — for a host embedding this SplitWindow that wants its own app-level bindings (e.g.
-
#focus_left : Nil
Resets which pane is active back to the left one — for a host app that reuses the same SplitWindow instance across appearances (e.g.
-
#focus_right : Nil
Symmetric counterpart to #focus_left — for a host that collapses the left pane (e.g.
-
#handle_key(ev : KeyEvent) : Bool
Returns true if the key was consumed.
- #left_width : Int32
-
#left_width=(w : Int32) : Nil
Width in columns of the left pane's content area, excluding the divider column.
-
#render : Nil
Draw into @buffer using LOCAL coordinates (0, 0 = this widget's own top-left).
-
#scrollbar_style : Style
Applied to both panes' scrollbar track and thumb drawn by #render — defaults to whatever #border_style currently is, so scrollbar and border stay visually matched unless a caller explicitly sets this to something else.
- #scrollbar_style=(style : Style) : Nil
-
#status_hint : String
Plain text describing the actions available in the widget's current state.
Instance methods inherited from class TUI::Widget
absolute(row : Int32, col : Int32) : NamedTuple(row: Int32, col: Int32)
absolute,
composite(screen : Screen) : Nil
composite,
focus_if(condition : Bool) : Nil
focus_if,
focused=(focused : Bool)
focused=,
focused? : Bool
focused?,
handle_key(ev : KeyEvent) : Bool
handle_key,
height : Int32
height,
height=(height : Int32)
height=,
local(row : Int32, col : Int32) : NamedTuple(row: Int32, col: Int32)
local,
render : Nil
render,
render_to(buffer : Buffer) : Nil
render_to,
status_hint : String
status_hint,
width : Int32
width,
width=(width : Int32)
width=,
x : Int32
x,
x=(x : Int32)
x=,
y : Int32
y,
y=(y : Int32)
y=
Constructor methods inherited from class TUI::Widget
new(x : Int32, y : Int32, width : Int32, height : Int32)
new
Constructor Detail
Sizes and positions a SplitWindow to fill the screen below the
status bar row — see Window.full_screen for the same reasoning.
#left_width defaults to an even split.
Instance Method Detail
Applied to the box border and internal pane divider drawn by #render.
Applied to the box border and internal pane divider drawn by #render.
Whether to draw the box border/scrollbar chrome — same convention as Window#bordered?.
Whether to draw the box border/scrollbar chrome — same convention as Window#bordered?.
Appended (with a leading double-space separator, matching how #status_hint already joins its own @menu.hint with active_pane's) to #status_hint when non-empty — for a host embedding this SplitWindow that wants its own app-level bindings (e.g. a sidebar-hide toggle) reflected in the one status line #status_hint produces, without this widget needing to know anything about what those bindings do. A host intercepting a key ahead of this widget's own #handle_key (e.g. to special-case Tab while the left pane is hidden) is responsible for keeping this in sync with what it actually does.
Appended (with a leading double-space separator, matching how #status_hint already joins its own @menu.hint with active_pane's) to #status_hint when non-empty — for a host embedding this SplitWindow that wants its own app-level bindings (e.g. a sidebar-hide toggle) reflected in the one status line #status_hint produces, without this widget needing to know anything about what those bindings do. A host intercepting a key ahead of this widget's own #handle_key (e.g. to special-case Tab while the left pane is hidden) is responsible for keeping this in sync with what it actually does.
Resets which pane is active back to the left one — for a host app that reuses the same SplitWindow instance across appearances (e.g. showing/hiding it based on runtime state) and wants a consistent starting focus each time it reappears, rather than carrying over whatever pane was last active before it was hidden.
Symmetric counterpart to #focus_left — for a host that collapses the left pane (e.g. width 0) and needs focus off it since it can no longer usefully hold keyboard input.
Returns true if the key was consumed.
Width in columns of the left pane's content area, excluding the divider column. Adjustable at runtime (e.g. a draggable-divider feature) independent of #initialize's initial split.
Draw into @buffer using LOCAL coordinates (0, 0 = this widget's own
top-left). Widgets never need to know their own x/y offset to draw
themselves — that arithmetic is handled entirely by composite.
Applied to both panes' scrollbar track and thumb drawn by #render — defaults to whatever #border_style currently is, so scrollbar and border stay visually matched unless a caller explicitly sets this to something else. Resolved fresh on every read (not captured once), so an unset scrollbar_style keeps tracking border_style even if border_style is changed later.
Plain text describing the actions available in the widget's current state. Rendered by the App in the global status bar at the bottom of the screen — widgets must NOT draw their own hint lines.