Sha256: 020a51b79494b32147f20397e33fbf951c134f8ffff801ba6d13389d2ca41e59

Contents?: true

Size: 738 Bytes

Versions: 4

Compression:

Stored size: 738 Bytes

Contents

class Gtk::Builder
	def initialize
		
	end
	
	def add_from_file(filename)
		cont = File.read(filename).gsub("<interface>", "<glade-interface>").gsub("</interface>", "</glade-interface>")
		cont = cont.gsub("<object", "<widget").gsub("</object>", "</widget>")
		cont = cont.gsub("<requires lib=\"gtk+\" version=\"2.16\"\/>", "")
		cont = cont.gsub("<requires lib=\"gtk+\" version=\"2.14\"\/>", "")
		cont = cont.gsub("<child type=\"label\">", "<child>")
		cont = cont.gsub("<child type=\"tab\">", "<child>")
		
		@glade = GladeXML.new(cont)
	end
	
	def connect_signals(&block)
		@glade.block = block
		@glade.auto_connect(@glade.data)
	end
	
	def [](key)
		return @glade[key]
	end
	
	alias get_object []
	
	def objects
		return []
	end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
knjrbfw-0.0.8 lib/knj/ironruby-gtk2/gtk_builder.rb
knjrbfw-0.0.7 lib/knj/ironruby-gtk2/gtk_builder.rb
knjrbfw-0.0.4 lib/knj/ironruby-gtk2/gtk_builder.rb
knjrbfw-0.0.3 lib/knj/ironruby-gtk2/gtk_builder.rb