TUI::Widget
Constructors
Instance methods
Translate a LOCAL (row, col) offset — as used by render's own
coordinate space, e.g. Form#cursor_offset — into absolute
1-based terminal coordinates suitable for Term.move. Mirrors the
arithmetic composite already performs internally via Screen#blit.
Called by the compositor (App) once per frame instead of render.
Owns the buffer lifecycle: resizes/clears it, invokes the subclass's
render, then blits the result onto the screen at (x, y).
The recommended way to manage focus when multiple widgets are visible
at once: recompute it every frame from whatever state determines which
widget is active (e.g. table_list.focus_if(nav.current.is_a?(NavTableList)))
rather than mutating focused= incrementally at scattered call sites.
Inverse of #absolute: translate an ABSOLUTE 1-based terminal coordinate (e.g. a KeyEvent's mouse row/col) into this widget's LOCAL coordinate space. Result may fall outside [0, width)/[0, height) if the point is outside this widget's bounds — callers should bounds-check.
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.
Draws this widget into an arbitrary caller-supplied buffer instead
of the screen — for a host that owns its own composed buffer rather
than the real screen (e.g. ScrollableWidget, adapting a plain
Widget into a SplitWindow pane, which only blits Scrollable content
into a sub-buffer it controls). buffer must already be sized to
width/height; unlike #composite this never blits anywhere itself,
leaving that to the caller.
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.
1-based absolute terminal coordinates and size of this widget within
the compositor (see #composite/Screen#blit) — never touched by the
widget's own #render, which always draws in its own local (0, 0)
space. focused? gates whether this widget's #handle_key should be
given a chance to consume the current event; toggle it via #focus_if.
1-based absolute terminal coordinates and size of this widget within
the compositor (see #composite/Screen#blit) — never touched by the
widget's own #render, which always draws in its own local (0, 0)
space. focused? gates whether this widget's #handle_key should be
given a chance to consume the current event; toggle it via #focus_if.