Sha256: 37fd4f50d1a3bc2ff6186823654e2151d2fa56b2b78b972b1d2cbbbd6b92633a

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

class Gtk::ListStore
	def dcol; return @dcol; end
	def dcol_arr; return @dcol_arr; end
	def tv; return @knj_tv; end
	
	def initialize(*args)
		if Gtk.takeob
			@ob = Gtk.takeob
			Gtk.takeob = nil
		else
			splitted = self.class.to_s.split("::")
			classname =  splitted[splitted.length - 1]
			
			class_spawn = Gtk.evalob("org.gnome.gtk." + classname)
			if !class_spawn
				raise "Could not find class: " + classname
			end
			
			@dcol = org.gnome.gtk.DataColumn[args.length].new
			@dcol_arr = []
			count = 0
			args.each do |col_name|
				colstring = org.gnome.gtk.DataColumnString.new
				@dcol[count] = colstring
				@dcol_arr[count] = colstring
				count += 1
			end
			
			@ob = class_spawn.new(@dcol)
		end
		
		$knj_jruby_gtk_last_liststore = self
	end
	
	def append
		Gtk.takeob = @ob.appendRow
		iter = Gtk::TreeIter.new
		iter.model = self
		
		return iter
	end
	
	def tv=(newtv)
		@knj_tv = newtv
	end
	
	def get_iter(selection)
		iter = @ob.get_iter(selection)
		
		Gtk.takeob = iter
		retob = Gtk::TreeIter.new
		retob.model = self
		
		return retob
	end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
knjrbfw-0.0.8 lib/knj/jruby-gtk2/liststore.rb
knjrbfw-0.0.7 lib/knj/jruby-gtk2/liststore.rb
knjrbfw-0.0.4 lib/knj/jruby-gtk2/liststore.rb
knjrbfw-0.0.3 lib/knj/jruby-gtk2/liststore.rb