Hi Ian:
Your code is really outstanding. I’m going to study it over the next
few days. Its really cool that I bumped into you because we’re both
writing classes to simplify treeview and listview. Its really
interesting to see your approach. Your thinking is much more “object
oriented” than mine.
Instead of subclassing TreeView, and ListStore, I put them together into
one class, VR_ListView. The model really isn’t a separate object, it’s
simply:
@view.model
For example:
FILE = 0
NAME = 1
NUMBER = 2 etc.
@view = VR_ListView.new( [Gdk::Pixbuf, String] , Integer, VR_Combo,
[Gtk::Adjustment, TrueClass] )
This would create a model with 6 columns, and 4 headers. The [] brackets
group multiple model cols into one header.
Gtk::Adjustment is a Spinner (Float)
TrueClass converts to a checkbox
Then:
@view.set_headers(“File”, “Number”, “Combo Choice”,“etc”)
Now the headers are “visible” and named. You can now refer to columns
by their header names or numbers.
@view.set_visible(false, “Number”, 3) (numbers or header names)
@view.set_editable(true, “Combo Choice”, “Number”)
combo = VR_Combo.new(“Selected”, “Another Choice”, “Choose Me”)
adj = Gtk::Adjustment.new(…)
@view.add_row(pix, “myfile.txt”, 6, combo, adj, true)
Now you can refer to a column, row, or renderer:
@thirdname = @view[3, NAME] # row 3
@namerenderer = @view.renderer(NAME)
@viewcolumn = @view.col(“File”) (same as @view.col(0))
@row = @view.row(2) => returns iter
You can also do:
@view.each_renderer
It still has the superclass:
@view.columns.each
I’d love to hear your input on this. I wish I’d seen your work earlier.
I’ve already learned a lot from it.
Do you think its a bad idea to lump everything together? What are the
advantages of your method?
I will notify you as soon as I have something good to look at. I’ve
spent the last 2 full days trying to install my program on my dad’s
computer. It uses gtksourceview2, and its a bitch to install. I’m
going to write a post whining about it soon.
Thanks,
Eric