Sha256: d85d31cf0bd2001f0d9b9d968bb8d0c3a6f0cfb2678937ab88032a02ef3445c1

Contents?: true

Size: 1.17 KB

Versions: 101

Compression:

Stored size: 1.17 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

101 entries across 101 versions & 1 rubygems

Version Path
knjrbfw-0.0.9 lib/knj/jruby-gtk2/liststore.rb