Sha256: 5938b3fe5889dcb8eb07e424f7fa7a4a3cd395db2f3b92090246e2e1ba333f9d

Contents?: true

Size: 736 Bytes

Versions: 13

Compression:

Stored size: 736 Bytes

Contents

#!/usr/bin/env ruby
#
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
require 'gir_ffi-gtk3'

Gtk.init


#Add window.
win = Gtk::Window.new(:toplevel)
win.resize(640, 480)
win.signal_connect("destroy") { Gtk.main_quit }


#Add treeview.
tv = Gtk::TreeView.new


#Add store.
ls = Gtk::ListStore.new([GObject::TYPE_STRING])
tv.set_model(ls)


#Add column.
lab = Gtk::Label.new("Name")
rend = Gtk::CellRendererText.new

col = Gtk::TreeViewColumn.new
col.set_widget(lab)
col.pack_start(rend, true)
col.add_attribute(rend, "text", 0)

lab.show

tv.append_column(col)


#Add rows.
iter = ls.append
ls.set_value(iter, 0, "Kasper")

iter = ls.append
ls.set_value(iter, 0, "Christina")


win.add tv
tv.show

win.show

Gtk.main

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
gir_ffi-gtk-0.15.0 examples/06_treeview.rb
gir_ffi-gtk-0.14.1 examples/06_treeview.rb
gir_ffi-gtk-0.14.0 examples/06_treeview.rb
gir_ffi-gtk-0.13.1 examples/06_treeview.rb
gir_ffi-gtk-0.13.0 examples/06_treeview.rb
gir_ffi-gtk-0.12.1 examples/06_treeview.rb
gir_ffi-gtk-0.12.0 examples/06_treeview.rb
gir_ffi-gtk-0.11.0 examples/06_treeview.rb
gir_ffi-gtk-0.10.0 examples/06_treeview.rb
gir_ffi-gtk-0.9.0 examples/06_treeview.rb
gir_ffi-gtk-0.8.1 examples/06_treeview.rb
gir_ffi-gtk-0.8.0 examples/06_treeview.rb
gir_ffi-gtk-0.7.2 examples/06_treeview.rb