[gtkmm] Custom tree model



Hi,

I'm writing a custom tree model to be displayed in a tree view.  As
there is basically no documentation about how to do this using gtkmm, I
have started writing a howto about it (will post it when it's in a
presentable state).  I still have a few problems, though.

- My tree model is what's called a 'proxy' in the book 'Design Patterns'
by Gamma et al.  This means that it does not contain any data by itself,
but 'wraps' another data structure (let's call it the 'backend') to be
displayed by the tree view.  It is possible to change the backend used
by the model with a single function call (the model simply contains a
pointer to the backend).  This works perfectly, but I have not yet found
a nice way to communicate the change to the tree views.  What I'm using
right now is an ugly hack, and I have not yet found a clean way to do
what I want with the row_inserted and row_deleted functions.  My tree
model should be quite efficient up to about 20,000 rows, and I just
don't like to make 40,000 function calls for what should be done in
simply one.

- The GtkTreeIter structure is okay for C programs, but in my case I
have a custom iterator class which can not be converted to three void*
pointers in a nice way.  What I'd like to do is to allocate a iterator
for every GtkTreeIter and put a pointer to it into user_data.  The
problem is that I don't know when to free the allocated object, to avoid
memory leaks.  Any ideas?

 - Aaron Isotton
-- 
http://www.isotton.com/

Attachment: pgpmJL97DDQPb.pgp
Description: PGP signature



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