class RETerm::Layouts::Horizontal

Layout which arainges items horizontally across screen cols

Public Instance Methods

add_child(h={}) click to toggle source
Calls superclass method RETerm::Layout#add_child
# File lib/reterm/layouts/horizontal.rb, line 28
def add_child(h={})
  # set x/y to next appropriate location
  super(h.merge(:y => 1, :x => current_cols))
end
current_cols() click to toggle source
# File lib/reterm/layouts/horizontal.rb, line 10
def current_cols
  return 1 if empty?
  child_windows.sum { |c| c.cols } + 1
end
current_rows() click to toggle source
# File lib/reterm/layouts/horizontal.rb, line 5
def current_rows
  return 1 if empty?
  child_windows.max { |w1, w2| w1.rows <=> w2.rows }.rows
end
exceeds_bounds_with?(child) click to toggle source
# File lib/reterm/layouts/horizontal.rb, line 15
def exceeds_bounds_with?(child)
  rows = child.is_a?(Hash) ?
         [current_rows, child[:rows]].compact.max :
         [current_rows, child.rows].max

  cols = child.is_a?(Hash) ?
    current_cols + child[:cols] :
    current_cols + child.cols

  rows > window.rows ||
  cols > window.cols
end
valid_input?(ch, from_parent) click to toggle source
# File lib/reterm/layouts/horizontal.rb, line 33
def valid_input?(ch, from_parent)
  return true unless from_parent
  !((UP_CONTROLS.include?(ch)   && window.first_child?) ||
    (DOWN_CONTROLS.include?(ch) && window.last_child?))
end