how to set bg pixmaps for labels



I'm trying to mirror some functionality in the Motif version of a program
in the Gtk version.  I want to set a background pixmap in a label.  The GtkStyle
appears to permit setting these, but when I create the pixmap and set the
style, nothing shows up in the label.  Here is the code snippet.


   title = gtk_label_new(msg);
   gtk_widget_set_name(title, "ntitle");
   gtk_widget_show(title);
   gtk_container_add(GTK_CONTAINER(vbox), title);

   style = gtk_style_copy( gtk_widget_get_style( title ) );
   if ( details_xbm == (GdkPixmap *)NULL )
   {
      sprintf(buf, "%s/%s", app_res.xpm_dir, XP_ADDR_MGR_XPM);
      details_xbm = gdk_pixmap_create_from_xpm(
               toplevel->window,
               &details_mask,
               &style->bg[GTK_STATE_NORMAL],
               buf);
   }
   for (i=0; i<5; i++)
      style->bg_pixmap[i] = details_xbm;
   gtk_widget_set_style(title, style);


Is it more complex than this, ie did I miss something?  BTW, I have no
problems using foreground pixmaps for labels, but I want a background
pixmap, with text displayed over that.

For grins, I also tried this in my rc file:

   bg_pixmap[NORMAL] = "/home/mjhammel/.xnotes-gtk/xpm-d/addr-mgr.xpm"

But that just produced this message:
Gtk-WARNING **: Unable to locate image file in pixmap_path:
"/home/mjhammel/.xnotes-gtk/xpm-d/addr-mgr.xpm" line 25

And yes, the file does exist.
-- 
Michael J. Hammel           |
The Graphics Muse           | Tell me what you need, and I'll tell you how to
mjhammel@graphics-muse.org  | get along without it. -- Dilbert
http://www.graphics-muse.org



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