[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Dynamically changing menus
- From: Havoc Pennington <rhp zirx pair com>
- To: gtk-app-devel-list redhat com
- Subject: Re: Dynamically changing menus
- Date: Thu, 3 Jun 1999 00:31:04 -0400 (EDT)
On Thu, 3 Jun 1999, Richard Tew wrote:
>
> + File + Edit + <changing menu> + Help +
>
> menu layout. I want to alter the 'changing menu' to be relevant to the
> current page of the notebook.
>
> So basically, what I am asking is, can I swap one of the menus in the menu
> bar (and have the accelerator keypresses updated) at will? I have looked
> at the documentation and read the source but afaict cannot see a way to do
> this.
>
To remove a menu, call gtk_container_remove(menubar, menuitem). To add
one, use gtk_menubar_insert() or gtk_menubar_append().
You need to gtk_widget_ref() the menu item before you remove it, or it
will be destroyed when its parent container unreferences it. After you
re-add the item, unref() it again.
An alternative approach would be to add all the menus to the menubar and
leave them there, then gtk_widget_hide() the menus you aren't using, and
gtk_widget_show() the current one. Hopefully the menubar is written so
that this would work right, but I don't know.
Havoc
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]