Class: Fatty::Screen
- Inherits:
-
Object
- Object
- Fatty::Screen
- Defined in:
- lib/fatty/screen.rb
Overview
Screen is a backend-neutral layout model.
It describes terminal geometry (rows/cols) and the logical regions that Fatty draws into (output/input/alert). Screen does not perform any IO and does not depend on curses.
Curses uses Screen to allocate resources (windows) and to understand where drawing should occur.
Defined Under Namespace
Classes: Rect
Instance Attribute Summary collapse
-
#alert_rect ⇒ Object
readonly
Returns the value of attribute alert_rect.
-
#cols ⇒ Object
readonly
Returns the value of attribute cols.
-
#input_rect ⇒ Object
readonly
Returns the value of attribute input_rect.
-
#output_rect ⇒ Object
readonly
Returns the value of attribute output_rect.
-
#rows ⇒ Object
readonly
Returns the value of attribute rows.
-
#status_rect ⇒ Object
readonly
Returns the value of attribute status_rect.
Instance Method Summary collapse
-
#initialize(rows:, cols:, status_rows: 0) ⇒ Screen
constructor
A new instance of Screen.
-
#resize(rows:, cols:, status_rows: 0) ⇒ Object
Update the terminal geometry and recompute the layout.
Constructor Details
#initialize(rows:, cols:, status_rows: 0) ⇒ Screen
Returns a new instance of Screen.
29 30 31 |
# File 'lib/fatty/screen.rb', line 29 def initialize(rows:, cols:, status_rows: 0) resize(rows: rows, cols: cols, status_rows: status_rows) end |
Instance Attribute Details
#alert_rect ⇒ Object (readonly)
Returns the value of attribute alert_rect.
26 27 28 |
# File 'lib/fatty/screen.rb', line 26 def alert_rect @alert_rect end |
#cols ⇒ Object (readonly)
Returns the value of attribute cols.
23 24 25 |
# File 'lib/fatty/screen.rb', line 23 def cols @cols end |
#input_rect ⇒ Object (readonly)
Returns the value of attribute input_rect.
25 26 27 |
# File 'lib/fatty/screen.rb', line 25 def input_rect @input_rect end |
#output_rect ⇒ Object (readonly)
Returns the value of attribute output_rect.
24 25 26 |
# File 'lib/fatty/screen.rb', line 24 def output_rect @output_rect end |
#rows ⇒ Object (readonly)
Returns the value of attribute rows.
23 24 25 |
# File 'lib/fatty/screen.rb', line 23 def rows @rows end |
#status_rect ⇒ Object (readonly)
Returns the value of attribute status_rect.
27 28 29 |
# File 'lib/fatty/screen.rb', line 27 def status_rect @status_rect end |
Instance Method Details
#resize(rows:, cols:, status_rows: 0) ⇒ Object
Update the terminal geometry and recompute the layout.
34 35 36 37 38 39 |
# File 'lib/fatty/screen.rb', line 34 def resize(rows:, cols:, status_rows: 0) @rows = rows @cols = cols layout!(status_rows: status_rows) self end |