Re: reccomended way to use images in toolbars/menu's



On Fri, May 10, 2002 at 05:00:01PM +0200, Olivier Sessink wrote:
previously I always used inline xpm images, but in the gtk2 source (in the
test directory) I found the comment "inline RGB is always better than
xpm". So I guess I better use RGB then. But I can't find any examples of
inline RGB, and how do I create those images (xpm's you just save with the
Gimp) ??

Look at the gdk-pixbuf-csource program which should be included with
your install of GTK.  The Gimp can save .PNG, which can be inlined via
gdk-pixbuf-csource.

There's a discussion of how to use it in the documentation of
gdk_pixbuf_new_from_inline() in the gdk-pixbuf documentation.

Look at gtk/stock-icons/Makefile.am for an example of using it,
or
http://www.danga.com/lj/cvsweb.cgi/logjam/images/Attic/Makefile.am?rev=1.1.2.3&content-type=text/x-cvsweb-markup&only_with_tag=logjam_3_1
for a simpler example.

These images can then be used like:

GdkPixbuf *pixbuf;
pixbuf = gdk_pixbuf_new_from_inline(-1, inline_data, FALSE, NULL);

questions two: I saw the Pixmap widget is deprecated, so I guess there is
an enhancement now, but what is the new widget and are there any examples?

GtkImage.  gtk_image_new_from_pixbuf() will do what you need, though I
suppose it's more proper to use stock icons... but that's a bit more
complicated. :)

-- 
      Evan Martin
martine cs washington edu
  http://neugierig.org



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