GtkItemFactory and <ImageItem>



I was using the GtkItemFactory in some code I am writing at the moment, 
http://developer.gnome.org/doc/API/2.0/gtk/GtkItemFactory.html

and wanted to add an item with my own images (i.e. not stock images).  I
used the tutorial here:
http://www.gtk.org/tutorial/sec-usingitemfactory.html

and created my menu as below:

static GtkItemFactoryEntry mymenu[] =
  {
    { "/_Read", "<control>R", mymenu_cb, 1, },
    { "/separator", NULL, 0, 0, "<Separator>" },
    { "/Edit _Groups", NULL, mymenu_cb, 2 },
    { "/Remove", NULL, mymenu_cb, 3, "<StockItem>", GTK_STOCK_REMOVE }, 
  };

the problem is, the only way to have a unique image is to have a line like
this:

    GdkPixdata *pd = (...);
    { "/UNIQUE ITEM", NULL, mymenu_cb, 4, "<ImageItem>", pd }, 

to me this seems a little silly because the GdkPixdata is not as widely used
as something like GdkPixbuf, or GtkImage.  So why not use one of those?
also, the "<ImageItem>" is not in the tutorial and not obvious in the
documentation, shouldn't this be mensioned? (I found out about this looking
in the header files). 

Regards,
Martyn




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