Re: [gtk-list] Re: GtkItemFactory -- need example




 TJ> > OK...I have different windows, which need different menubars.  Right
 TJ> > now I create a factory for each window.  Is this necessary, or can
 TJ> > they share, only share from a certain point that is.

 TJ> the do share the same hash table, but that is an implementaion issue.
 TJ> you need to create multiple factories, all with the same name and
 TJ> the same set of entries.
 TJ> if you than change the accelerator for e.g.
 TJ> <ExampleApp>/File/Open to "<alt>O",
 TJ> the rest of the menu's that have a menu item
 TJ> <ExampleApp>/File/Open will be automatically adapted.

That's what I wanted.  That changes in one menu would be reflected in another.


 TJ> > I would like something like the entire menu in the main window:
 TJ> > 
 TJ> >   +-----------+------------+-------------+
 TJ> >   | Foo       | Bar        | Baz         |
 TJ> >   +-----------+------------+-------------+
 TJ> 
 TJ> use
 TJ> static GtkItemFactoryEntry menubar_entries[] =
 TJ> {
 TJ>   { "/File/Test",       "",             my_cb, 1,  "<Item>" },
 TJ>   { "/File/-----",      "",             NULL,  0,  "<Separator>" },
 TJ>   { "/File/Close",      "<Ctrl>C",      my_cb, 2,  "<Item>" },
 TJ>   { "/Bar/Test",        "",             NULL,  0,  "<Item>" },
 TJ>   { "/Baz/Test",        "",             NULL,  0,  "<Item>" },
 TJ> };
 TJ> for this.
 TJ> 
 TJ> > 
 TJ> > and menus starting at a certain "path offset" in the other windows,
 TJ> > e.g. only:
 TJ> > 
 TJ> >   +------------+
 TJ> >   | Foo        |
 TJ> >   +------------+
 TJ> > 
 TJ> > or perhabs even
 TJ> > 
 TJ> >   +------------+-------------+
 TJ> >   | Bar        | Baz         |
 TJ> >   +------------+-------------+
 TJ> 
 TJ> i'm not sure what you mean here, maybe you want to split up the menu entries
 TJ> into the ones with "/File/*" and "/Bar/*" and "/Baz/*" and then selectively
 TJ> add a set of items to the different factories... ? (of course you can add
 TJ> multiple sets of entries to a factory).

What I wanted was to share entries.  If I can do that by inserting
them seperatly, that's cool.

Thanks.

          /mailund



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