Re: [gtk-list] Re: GtkItemFactory -- need example
- From: Tim Janik <timj gtk org>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: GtkItemFactory -- need example
- Date: Thu, 23 Jul 1998 22:10:27 +0200 (CEST)
On 23 Jul 1998, Thomas Mailund Jensen wrote:
>
> TJ> On 23 Jul 1998, Thomas Mailund Jensen wrote:
> TJ> > I am trying to deduce how to use gtk item factory, which isn't too
> TJ> > easy with only the source. I could really use an example. Is there
> TJ> > anywhere I can get such?
>
> TJ> the CVS gimp uses GtkItemFactory already, as well, as GLE.
>
> Er...where do I get gle?
from the GNOME CVS repo.
just do
$ cvs get gle
like you did with gtk+.
>
> TJ> menubar_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR,
> TJ> "ExampleApp",
> ^^^^^^^^^^^
oops, that was indeed meant to say "<ExampleApp>", sorry...
> I'm not sure what this 'path' parameter does. I can only get away
> with "<RandomString>" arguments. I can see the effect in the file it
> dumps, but is this the only place?
yep, it's used to identify the menu factories actually.
for each menu factory that uses a *different* set of entries,
you should choose a new factory name.
if you generate the same menu bar for multiple windows,
use the same name for each of the menu factories.
>
> TJ> NULL);
>
> TJ> i hope that helps, feel free to ask more questions though ;)
>
> OK...I have different windows, which need different menubars. Right
> now I create a factory for each window. Is this necessary, or can
> they share, only share from a certain point that is.
the do share the same hash table, but that is an implementaion issue.
you need to create multiple factories, all with the same name and
the same set of entries.
if you than change the accelerator for e.g.
<ExampleApp>/File/Open to "<alt>O",
the rest of the menu's that have a menu item
<ExampleApp>/File/Open will be automatically adapted.
> I would like something like the entire menu in the main window:
>
> +-----------+------------+-------------+
> | Foo | Bar | Baz |
> +-----------+------------+-------------+
use
static GtkItemFactoryEntry menubar_entries[] =
{
{ "/File/Test", "", my_cb, 1, "<Item>" },
{ "/File/-----", "", NULL, 0, "<Separator>" },
{ "/File/Close", "<Ctrl>C", my_cb, 2, "<Item>" },
{ "/Bar/Test", "", NULL, 0, "<Item>" },
{ "/Baz/Test", "", NULL, 0, "<Item>" },
};
for this.
>
> and menus starting at a certain "path offset" in the other windows,
> e.g. only:
>
> +------------+
> | Foo |
> +------------+
>
> or perhabs even
>
> +------------+-------------+
> | Bar | Baz |
> +------------+-------------+
i'm not sure what you mean here, maybe you want to split up the menu entries
into the ones with "/File/*" and "/Bar/*" and "/Baz/*" and then selectively
add a set of items to the different factories... ? (of course you can add
multiple sets of entries to a factory).
or do you mean the layout itself?
one thing that is possible is:
+-----------+------------+-------------+---------------------------+
| Foo | Bar | Baz | Help |
+-----------+------------+-------------+---------------------------+
by using
static GtkItemFactoryEntry menubar_entries[] =
{
{ "/Foo/Test", "", NULL, 0, "<Item>" },
{ "/Bar/Test", "", NULL, 0, "<Item>" },
{ "/Baz/Test", "", NULL, 0, "<Item>" },
{ "/Help", "", NULL, 0, "<LastBranch>" },
{ "/Help/Test", "", NULL, 0, "<Item>" },
};
>
> I think thats all for now...
>
> /mailund
>
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]