On Wed, Oct 04, 2000 at 11:53:53AM +0200, Jean-Marc Lasgouttes wrote:
> 
> I do not know how this code could be adapted to the case of Toc and
> Ref entries, since they contain submenus. Ideas are welcome, of
> course.

The follownig scheme can be used:

After reading the ui file, we have a representation of the menu by a rooted
tree, whose nodes are instances of the Menu class (if I read the code
correctly, the edges of the tree are stored using the submenu_ strings, and
not with pointers).
The expand function (it can be implemented as a method, but lets assume it is a
function) receives some node in this tree (the root in the case of
gnome/kde, or a child of the root in the case of xforms) and does the
following:
It traverses the node and its descendents, and creates a copy of the
scanned subtree, but in the copy tree, the "special" items are expanded.
When expanding the TOC, new nodes may be added to the copy tree. 
The copy tree is then passed to the frontend code, so the frontend code just
need to traverse the tree it receives, and process it.

Reply via email to