Hi, I'm trying to create a custom tree model. My data structure contains a tree of reference counted objects. The problem I have is that I'm unable to put a Glib::RefPtr<MyObject> instance (which represents a node in my tree) to Gtk::TreeIter.
I was following the code in examples/treemodelcustom/, it simply uses Gtk::TreeIter->gobj() (e.g. GtkTreeIter structure) to represent an iterator (e.g. a reference to a tree-node). I guessed the reason to use gobj() instead of C++ members, is that GtkTreeIter is not a real class in GTK+, and instances of that structure are defined/passed around in plain C code. So if my guess above is true, I also have to put a node reference (e.g. a value of type Glib::RefPtr<MyObject>) to GtkTreeIter somehow. GtkTreeIter defines 3 pointers (12 bytes) for this purpose. My problem: 1) I cannot extend Gtk::TreeIter to define a Glib::RefPtr<MyObject> member 2) I cannot get a "raw" pointer from Glib::RefPtr<MyObject> which I could put into GtkTreeIter The only solution right now that I can see, is to create a "Glue" class, that holds a reference to my node and store a pointer to this glue class in GtkTreeIter. Then have some mechanism in place that ensures that Glue instances get freed. However I don't really like this solution (why allocate a new object just to store a simple pointer?), and I'd like to avoid this if possible. Any other ideas? -- Bazsi _______________________________________________ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list