rubyx-debugger/lib/views/classes_view.rb

45 lines
822 B
Ruby
Raw Normal View History

require_relative "ref_view"
class ClassesView < ListView
def initialize interpreter
@interpreter = interpreter
@interpreter.register_event(:state_changed, self)
super( class_views )
end
def class_views
classes = []
Risc.machine.space.classes.each do |name , claz|
classes << claz
end
classes.sort! {|a,b| a.name <=> b.name }
classes.collect{|c| ClassView.new(c)}
end
def state_changed old , new_s
return unless new_s == :running
class_views.each_with_index do |v, i|
replace_at i , v
end
end
def draw
super()
wrap_element div("ul.nav!")
wrap_element( div("h4" , "Classes") )
return @element
end
end
2015-08-24 01:49:41 +02:00
class ClassView < RefView
2015-08-24 01:49:41 +02:00
def initialize clazz
2015-11-04 19:29:09 +01:00
super(clazz.name , clazz , 20 )
2015-08-24 01:49:41 +02:00
end
def ref_text
@name
2015-08-24 01:49:41 +02:00
end
end