rubyx-debugger/lib/list_view.rb

21 lines
407 B
Ruby
Raw Normal View History

2015-08-20 14:48:45 +02:00
require "element_view"
class ListView < ElementView
2015-08-20 19:40:47 +02:00
def initialize children
@children = children
2015-08-20 16:07:44 +02:00
@elements = []
2015-08-20 19:40:47 +02:00
@container_element = nil
2015-08-20 14:48:45 +02:00
end
2015-08-20 19:40:47 +02:00
def draw on
@container_element = $document.create_element('div')
@elements = @children.collect do | c |
elem = c.draw(@container_element)
elem.append_to(@container_element)
elem
end
@container_element
end
2015-08-20 14:48:45 +02:00
end