2015-08-21 20:05:49 +02:00
|
|
|
require_relative "element_view"
|
2015-08-20 14:48:45 +02:00
|
|
|
|
|
|
|
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 14:48:45 +02:00
|
|
|
end
|
|
|
|
|
2015-08-21 19:07:02 +02:00
|
|
|
def root
|
|
|
|
"div"
|
|
|
|
end
|
|
|
|
|
2015-08-20 19:40:47 +02:00
|
|
|
def draw on
|
2015-08-22 01:37:15 +02:00
|
|
|
@element = div(self.root)
|
2015-08-20 19:40:47 +02:00
|
|
|
@elements = @children.collect do | c |
|
2015-08-22 01:37:15 +02:00
|
|
|
elem = c.draw(@element)
|
|
|
|
elem.append_to(@element)
|
2015-08-20 19:40:47 +02:00
|
|
|
elem
|
|
|
|
end
|
2015-08-22 01:37:15 +02:00
|
|
|
@element
|
2015-08-20 19:40:47 +02:00
|
|
|
end
|
2015-08-21 19:07:02 +02:00
|
|
|
|
2015-08-20 14:48:45 +02:00
|
|
|
end
|