Re: custom treemodel?



Murray Cumming wrote:

After poking around a bit in my freshly built gtkmm, I noticed this:

gtkmm/examples/Makefile.am
# Doesn't build with GLIBMM_ENABLE_PROPERTIES unset:
#cellrenderercustom

Dunno if thats important or not though.

That's a different example.

There's a note in the ChangeLog about that.

There is .../examples/treemodelcustom/ directory with files that you need to review.
I've used it to create custom LIST and TREE models.
Just read carefully Gtk::TreeModel and Gtk::TreeModelSortable (classes you should derive from to implement your model functionality) documentation about which methods you should reimplement. It took a while for me to understand right ones (mostly looking at gtkmm/gtk+ source codes). The main problem was to desing iterators properly (especially for TREE).

Actually, I wonder if it is possible that gtkmm provide custom model implementation. Developer should just provide data container class derived from some Gtk::virtual-base class and reimplement methods to get/set data from/to your container by given Gtk::TreeModelPath or Gtk::TreeIter, and column index/reference, and methods to sort data if needed. Just there is too much code you should rewrite for your custom model now.

Regards,
-andrew




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]