problems to read a "from widget independent" pixmap (Resending...)



Hi,

I want to write a function to read a pixmap string and store it into a
GdkPixmap, but without having to know which widget it will be added into.By
the way the widget could be still not created at all.
The problem is if I use gdk_pixmap_create_from_xpm_d() one of its parameters
force me to specify a "GdkWindow *window". I'm not using any transparent
color, so the "style" isn't a real problem for me...
If I use a non-existing widget I obviously get this error:
"Gdk-WARNING **: Creating pixmap from xpm with NULL window and colormap"

I haven't found a way to do this, so i'm using the program main window, but
I'll like to store the GdkPixmap without having to know where I finally will
attache it... Is it possible or am I just talking nonsense? ;-))

Here is my function. (It still needs a widget):

gboolean ReadPixmap(gchar **pixstring, GdkPixmap& pix)
/* Reads a pixmap from a xpm-format string & stores it in GdkPixmap& pix */
{

  GtkWidget *pixmapwidget;
  GdkBitmap *mask;
  GtkStyle *style;

/* Getting style */
  style = gtk_widget_get_style( main_window );
  if (main_window->window)
    {g_print("main_window->window <> NULL\n");}
  else
    {g_print("main_window->window == NULL\n");}

  /* Creating the pixmap */
  pix = *gdk_pixmap_create_from_xpm_d( main_window->window,  &mask,
            &style->bg[GTK_STATE_NORMAL],
            (gchar **) pixstring);

  g_print("pix stored\n");

  if (&pix == NULL) {return (FALSE);} else {return (TRUE);}
}






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