class Uh::Layout::Column

Constants

MODES

Attributes

clients[R]
geo[R]
mode[R]

Public Class Methods

new(geo, mode: :stack) click to toggle source
# File lib/uh/layout/column.rb, line 19
def initialize geo, mode: :stack
  @geo      = geo.dup
  @clients  = Container.new
  @mode     = mode
end

Public Instance Methods

<<(client) click to toggle source
# File lib/uh/layout/column.rb, line 29
def << client
  client.geo = @geo.dup
  if @clients.current
    @clients.insert_after_current client
  else
    @clients << client
  end
  self
end
arrange_clients() click to toggle source
# File lib/uh/layout/column.rb, line 55
def arrange_clients
  arranger.arrange
  clients.each &:moveresize
end
arranger() click to toggle source
# File lib/uh/layout/column.rb, line 43
def arranger
  MODES[@mode].new @clients, @geo
end
client_swap(direction) click to toggle source
# File lib/uh/layout/column.rb, line 47
def client_swap direction
  @clients.set direction
  if @mode == :tile
    arrange_clients
    show_hide_clients
  end
end
mode_toggle() click to toggle source
# File lib/uh/layout/column.rb, line 39
def mode_toggle
  @mode = MODES.keys[(MODES.keys.index(@mode) + 1) % MODES.keys.size]
end
show_hide_clients(arranger: self.arranger) click to toggle source
# File lib/uh/layout/column.rb, line 60
def show_hide_clients arranger: self.arranger
  arranger.each_visible { |client| client.show if client.hidden? }
  arranger.each_hidden  { |client| client.hide unless client.hidden? }
end
to_s() click to toggle source
# File lib/uh/layout/column.rb, line 25
def to_s
  "COL geo: #{@geo}"
end