2015-10-29 22:36:04 +01:00
|
|
|
require_relative "ref_view"
|
2015-08-22 01:36:11 +02:00
|
|
|
|
|
|
|
class ClassesView < ListView
|
|
|
|
|
|
|
|
def initialize interpreter
|
|
|
|
@interpreter = interpreter
|
2015-10-29 22:36:04 +01:00
|
|
|
@interpreter.register_event(:state_changed, self)
|
|
|
|
super( class_views )
|
|
|
|
end
|
|
|
|
|
|
|
|
def class_views
|
2015-08-22 01:36:11 +02:00
|
|
|
classes = []
|
2018-04-03 17:24:57 +02:00
|
|
|
Parfait.object_space.classes.each do |name , claz|
|
2015-08-22 01:36:11 +02:00
|
|
|
classes << claz
|
|
|
|
end
|
|
|
|
classes.sort! {|a,b| a.name <=> b.name }
|
2015-10-29 22:36:04 +01:00
|
|
|
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
|
2015-08-22 01:36:11 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def draw
|
|
|
|
super()
|
|
|
|
wrap_element div("ul.nav!")
|
2015-10-21 13:05:18 +02:00
|
|
|
wrap_element( div("h4" , "Classes") )
|
2015-08-22 01:36:11 +02:00
|
|
|
return @element
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2015-08-24 01:49:41 +02:00
|
|
|
|
2015-10-29 22:36:04 +01: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
|
|
|
|
|
2015-10-29 22:36:04 +01:00
|
|
|
def ref_text
|
|
|
|
@name
|
2015-08-24 01:49:41 +02:00
|
|
|
end
|
|
|
|
end
|