Re: [gtk-list] ctree internal question.



Hi Todd,

On Tue, Sep 07, 1999 at 04:23:59PM -0500, Todd Dukes wrote:
> I am trying to traverse the ctree in order to 
> print out all of the pointers in it.

Maybe you could use gtk_ctree_pre/post_recursive to avoid
peeking around in ctree internals ?

> What I have figured out is that the ctree
> uses the clist row_list to keep a list of
> GtkCTreeNodes. The GtkCTreeNode is just a
> glist. This GtkCTreeNode list  is a list
> of GtkCTreeRows.  

CTree stores only to current view of the tree
in the row_list, i.e. all viewable nodes are
linked together in the row_list. If you collapse
a node, it simply unlinks the first child of this
node, sets the "next" pointer of the last descendant
to NULL and links the collapsed node to its sibling.
So even the current view of the collapsed tree
is still stored in the now unlinked part of the
row_list.

> What is confusing me is that the children
> list in the GtkCTreeRow doesn't always end
> at the end of a branch. Sometimes the branches
> can be linked together in one long stream. Is
> this normal? 

Yes, it is. Depends on the current view.
 
> I can tell when I reach the end of a branch
> by checking the sibling pointer in the 
> row. But it is hard to tell if this will
> always work. Does anyone know?

If you want to traverse the tree structure
you should rely only on the parent, sibling
and children pointer of GtkCTreeRow.

bye,
  Lars



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