Re: refptr based tree model



On Fri, 2006-12-29 at 14:14 +0100, Balazs Scheidler wrote:

> 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.

In the meanwhile I became friend with the third possibility, e.g. to use
a wrapper class around Glib::RefPtr<MyObject> and store the address of
this wrapper in GtkTreeIter's user_data member.

So unless you have a smarter solution, please ignore this post. :)

Thanks.

-- 
Bazsi




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