On 26 Sep 2000, Jean-Marc Lasgouttes wrote:

> In order to reduce code replication in menu frontends, I just thought
> we could move to MenuBackend the code which deals with special entries
> (at least lastfiles, documents, export, view, update). The idea is to
> have a new function MenuBackend::getExpandedMenu(), which is used by
> the frontend instead of MenuBackend::getMenu(). This function would
> create a copy of the menu, where all the special entries would be
> replaced with the corresponding plain menu items. This means that all
> special handling of the said special entries could be removed from
> frontends.

Cool! This will make the life easier for sure. Then we can reduce types of
menuitems to MenuItem::Command, Submenu, Separator, TOC, REF.

> I am not sure at this point how to do that with refs and toc, which
> use also submenus... 

It wouldn't be nice to partition these items to submenus in MenuBackend
since this partitioning may be different in different
frontends/implementations. I've started to work on Toolbar which uses the
same interface as Menubar (set, update, ...) and it is obvious that the
partitioning will be different for Toolbar comparing with Menubar
(actually there is no partitioning needed in Toolbar if TOC is displayed
in drop-down list).

> A cleaner version would be to define a smart iterator on Menu, but as
> I already said, I don't know how to do that.
> 
> So, do the people who had to work on frontends menus think it is a
> good idea? Would it cause problems wrt tearable menus?

It is definitely great idea. And it will cause problems with tearable
menus, for sure :). Actually, it will cause problems with any menu
implementation that doesn't create submenus only on user request as it is
done in XForms implementation. It is (maybe) possible to create submenus
only on user request by tracking mouse movements in home-made Menu class
derived from "classical" Gnome menu, but it is not really easy. The same
(most probably) goes for KDE menus. In Gnome it is easier to "patch" menus
(update TOC) when I know in advance where to patch. Thus, I would prefer
to still have TOC and REF as a separate entries in menus. The rest, which
could be changed only by set(menu_name) method, would be better to have
expanded in MenuBackend code already.

Marko

Reply via email to