A start at writing a SimpleTree class that holds both a TreeStore and
a TreeView and simplifies a lot of common cases. Also provides direct
access to the store and the view if you want to do something more
complicated. Still needs a lot of work, but I thought I’d get some
reactions and suggestions before anything got too set in stone. Right
now there’s barely enough of it to run the example from
http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-treeview-renderer-example.
Code attached, but here’s the interesting part:
define the tree
s = Gtk::SimpleTree.new([String, String, Integer],
[“First Name”, 0],
[“Last Name”, 1,
{:weight => Pango::FontDescription::WEIGHT_BOLD}],
[“Age”, format_age, {:foreground => “red”}],
[“Age”, simple_age])
define the initial data
treedata = [
[‘Maria’, ‘Incognito’],
[‘Jane’, ‘Average’, 1962,
[‘Janinita’, ‘Average’, 1985]]]
s.import_tree(treedata)
s.sel_mode = :none
window.add(s.view)
window.show_all
Gtk.main
(the additional column with the ‘simple_age’ proc is to demonstrate a
simplified one-argument callback)
martin