[gtkmm] Re: Images in CLists



On Friday 20 September 2002 03:39 pm, Henning Meyer wrote:
> Hello *,
>
> I want to put generated small thumbnail-like images in a CList.
> How can a do this?
> The images aren't loaded from files, but generated as grayscale 2d-vectors
> of bytes.

I am doing nearly exactly the same thing for a status bar.  I did something 
like:

pixMap = gdk_pixmap_new (NULL, 102, 12, gdk_visual_get_best_depth());

a pixmap is just like a window, more or less, in terms of it being a 
"drawable".  You can then just draw onto the pixmap with primitives, a list 
can be found here:

http://developer.gnome.org/doc/API/gdk/gdk-drawing-primitives.html

You can add the pixmap to the clist with:

  gtk_clist_set_pixmap
  (
    GTK_CLIST (clist),
    iRow,
    iColumn,
    pixMap,
    NULL               // i.e. no mask
  );

you can also retrieve the pixmap image with:

  gtk_clist_get_pixmap
  (
    GTK_CLIST (clist), // clist
    iRow,              // row
    iColumn,           // column
    &pixMap,           // pointer to address of pixmap
    &mask              // pointer to address of mask (don't care)
  )

NOTE: here that I get the mask when I call gtk_clist_get_pixmap.  I noticed 
when I put NULL in there, the program crashed.  The documentation doesn't say 
you can put NULL in there, but I can swear I've seen the documentation for 
the ctree say that you can.

gtk_clist_get_pixmap will return FALSE if the element isn't a pixmap.

That ought to help...  Feel free to write me if it doesn't.

-Rich

> Thanks for your help.
>
> Please reply to: Henning_Meyer gmx net
>
>
> Henning Meyer
> ----------------------------
> Time is the best teacher; unfortunately, it kills all its students.
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list




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