class RETerm::Layouts::Vertical
Layout
which arainges items vertically down screen rows
Public Instance Methods
add_child(h={})
click to toggle source
Calls superclass method
RETerm::Layout#add_child
# File lib/reterm/layouts/vertical.rb, line 28 def add_child(h={}) # set x/y to next appropriate location super(h.merge(:y => current_rows, :x => 1)) end
current_cols()
click to toggle source
# File lib/reterm/layouts/vertical.rb, line 10 def current_cols return 1 if empty? child_windows.max { |w1, w2| w1.cols <=> w2.cols }.cols end
current_rows()
click to toggle source
# File lib/reterm/layouts/vertical.rb, line 5 def current_rows return 1 if empty? child_windows.sum { |c| c.rows } + 1 end
exceeds_bounds_with?(child)
click to toggle source
# File lib/reterm/layouts/vertical.rb, line 15 def exceeds_bounds_with?(child) cols = child.is_a?(Hash) ? [current_cols, child[:cols]].compact.max : [current_cols, child.cols].max rows = child.is_a?(Hash) ? current_rows + child[:rows] : current_rows + child.rows cols > window.cols || rows > window.rows end
valid_input?(ch, from_parent)
click to toggle source
# File lib/reterm/layouts/vertical.rb, line 33 def valid_input?(ch, from_parent) return true unless from_parent !((LEFT_CONTROLS.include?(ch) && window.first_child?) || (RIGHT_CONTROLS.include?(ch) && window.last_child?)) end