[Fwd: problems to read a "from widget independent" pixmap]



Sorry if this message arrives twice.. 
I'm having problems with my mail server

Ignacio Nodal
--- Begin Message ---
Ok, thanks... Next problem :-))))

I want to write a function to read a pixmap string, 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 I don't know what to put in the "GdkWindow *window" 
parameter from gdk_pixmap_create_from_xpm_d() function. 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 do it the other way... Is it possible or am I just
talking nonsense? ;-))

Here is my function:

gboolean ReadPixmap(gchar **pixstring, GdkPixmap& pix)
//Reads a pixmap from a xpm-format string & stores it in GdkPixmap& pix
{
  
  GtkWidget *pixmapwidget;
  //GdkPixmap *pixmap;
  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);}
}


Havoc Pennington wrote:
> Nope, you're doing it the way I'd do it.
> 
> new_with_label() creates a button with a label, you want a button with
> something which is not a label, ergo using new_with_label() isn't
> what you want. ;-)
> 
> Havoc

--- End Message ---


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