RE: How to create submenus using UIManager
- From: "Stewart Weiss" <stewart weiss acm org>
- To: <ebassi gmail com>
- Cc: gtk-list gnome org
- Subject: RE: How to create submenus using UIManager
- Date: Mon, 5 Nov 2007 09:48:23 -0500
Emanuele,
I have both static and dynamic menus, and I also wanted to solve
the problem of adding a submenu dynamically, so this is helpful.
The first step was solving the static case.
Have you rewritten the recent-uimanager demo program to use the
GtkRecentAction objects?
Grazie, i ciao.
Stewart
> Date: Sun, 04 Nov 2007 23:16:54 +0000
> From: Emmanuele Bassi <ebassi gmail com>
> Subject: RE: How to create submenus using UIManager
> To: gtk-list gnome org
> Message-ID: <1194218214 27081 10 camel sprite oh>
> Content-Type: text/plain
>
>
> On Sun, 2007-11-04 at 15:27 -0500, Stewart Weiss wrote:
>
> > I have Emmanuele Bassi's recent-uimanager code and I am trying
> > to use that as a guide, but it seems absurd to have to go down so
> > far as to create GObjects just to do this.
>
> that code showed how to integrate a pre-existing menu item + sub-menu
> widget (GtkRecentChooserMenu) with a GtkUIManager; as of GTK+ 2.12 it's
> not needed anymore, as GtkRecentAction is available exactly for that
> purpose.
>
> if your menu hierarchy is static and you just want to add a menu item
> with a sub-menu, then just do:
>
> <menu>
> <menuitem .../>
> <menu>
> <menuitem .../>
> <menuitem .../>
> ...
> </menu>
> <menuitem .../>
> ...
> </menu>
>
> if, on the other hand, your menu hierarchy is dynamically generated, you
> can either use a placeholder and the switch in/out menu items or you can
> use a GtkAction subclass that provides a menu item with its own
> sub-menu, exactly like I did in my recent-uimanager example.
>
> my preferences go to the object-oriented approach, because it's cleaner
> and easier to swap in or out of a project. and creating a new GObject
> isn't that much work, compared to hooking into a placeholder.
>
> ciao,
> Emmanuele.
>
> --
> Emmanuele Bassi,
> W: http://www.emmanuelebassi.net
> B: http://log.emmanuelebassi.net
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]