class TUI::SplitWindow

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.cr

Constructors

Instance Method Summary

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

def self.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. #left_width defaults to an even split.


[View source]
def self.new(x : Int32, y : Int32, width : Int32, height : Int32, left : Scrollable, right : Scrollable, left_width : Int32, bordered : Bool = true) #

[View source]

Instance Method Detail

def border_style : Style #

Applied to the box border and internal pane divider drawn by #render.


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

Applied to the box border and internal pane divider drawn by #render.


[View source]
def bordered=(bordered : Bool) #

Whether to draw the box border/scrollbar chrome — same convention as Window#bordered?.


[View source]
def bordered? : Bool #

Whether to draw the box border/scrollbar chrome — same convention as Window#bordered?.


[View source]
def 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. 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.


[View source]
def 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. 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.


[View source]
def 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. 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.


[View source]
def focus_right : Nil #

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.


[View source]
def handle_key(ev : KeyEvent) : Bool #
Description copied from class TUI::Widget

Returns true if the key was consumed.


[View source]
def left_width : Int32 #

[View source]
def left_width=(w : Int32) : Nil #

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.


[View source]
def render : Nil #
Description copied from class TUI::Widget

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.


[View source]
def 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. Resolved fresh on every read (not captured once), so an unset scrollbar_style keeps tracking border_style even if border_style is changed later.


[View source]
def scrollbar_style=(style : Style) : Nil #

[View source]
def status_hint : String #
Description copied from class TUI::Widget

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.


[View source]