Re: How to have multi-level menus?



"David J. Topper" <topper virginia edu> writes: 
> 1.  Separators?  Everything is a menu item?

Empty menu items (with no child packed in them) appear as
separators. Strange but true.

GTK 2 has "GtkSeparatorMenuItem" which is just a subclass of
GtkMenuItem that changes nothing whatsoever about the base class, so
people can find this feature. ;-)

> 2.  How to make sub menus?  Is there an easy / elegant way to nest?

gtk_menu_item_set_submenu()

> I've also looked at the ItemFactory method, but don't see any way to
> just use it to pop up a menu on screen.  The ItemFactory model seems for
> use only with main window pulldown menus, which is not what I'm looking
> for.  I just want the entire menu, with all toplevel options, to appear
> when I click.

It can work for right-click popups. Just pass GTK_TYPE_MENU instead of
GTK_TYPE_MENU_BAR to gtk_item_factory_new().

Use gtk_menu_popup() to pop up the resulting menu.

Havoc





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