34 lines
410 B
Ruby
34 lines
410 B
Ruby
module Widget
|
|
def initialize
|
|
@x = 0
|
|
@y = 0
|
|
@width = 0
|
|
@height = 0
|
|
end
|
|
|
|
def children
|
|
[]
|
|
end
|
|
|
|
def resize(x, y, width, height)
|
|
@x = x
|
|
@y = y
|
|
@width = width
|
|
@height = height
|
|
end
|
|
|
|
def draw
|
|
if @x > 0 and @y > 0
|
|
render_begin
|
|
render
|
|
children.each do |child|
|
|
child.draw
|
|
end
|
|
render_end
|
|
end
|
|
end
|
|
|
|
def render_end
|
|
end
|
|
end
|