Re: change the colour of widget after it has been shown



I create 2 pixmaps equals and put a gtk_timeout_add to swap these
pixmaps (I change the function create_pixmap from support.c from
gladefiles to make this swap), I believe that works, in this way the
pixmap seems to blink. I don't know if it is the better way,
but...works.

The function that make pixmap swap:


int
troca_pixmap(gpointer user_data, char *nome_pixmap, char *filename,
gboolean use_pixmap_interno, GdkPixmap *pixmap_interno)
{

  GtkWidget *pixmap;
  GdkColormap *colormap;
  GdkPixmap *gdkpixmap;
  GdkBitmap *mask;
  gchar *pathname = NULL;

  pixmap = lookup_widget(user_data, nome_pixmap); /* lookup_widget from
support.c from glade */

  if(use_pixmap_interno == FALSE)
    {
      if (!filename || !filename[0])
	return -1;

      pathname = gnome_pixmap_file (filename);
      if (!pathname)
	{
	  g_warning (_("Couldn't find pixmap file: %s"), filename);
	  return -1;
	}

      colormap = gtk_widget_get_colormap (user_data);

      gdkpixmap = gdk_pixmap_colormap_create_from_xpm (NULL, colormap,
&mask, NULL, pathname);

      if (gdkpixmap == NULL)
	{
	  g_warning (_("Couldn't create pixmap from file: %s"), pathname);
	  g_free (pathname);
	  return -1;
	}
    }

   else
     {
      if (pixmap_interno == NULL)
	{
	  g_warning (_("Couldn't create pixmap from pixmap_interno"));
	  return -1;
	}

       gdkpixmap = pixmap_interno;
     }

  if(use_pixmap_interno == FALSE)
    {
      g_free (pathname);
      gtk_pixmap_set(GTK_PIXMAP(pixmap), gdkpixmap, mask);
    }
  else
      gtk_pixmap_set(GTK_PIXMAP(pixmap), gdkpixmap, NULL);

   if(use_pixmap_interno == FALSE)
     {
       gdk_pixmap_unref (gdkpixmap);
       gdk_bitmap_unref (mask);
     }

  return 1;
}



Success
Flavio Alberto

Em 18 Jan 2002 01:13:54 +0530, Rahul Pande escreveu:
> Hi,
> 
> please give me some hint on how to solve this...
> 
> the problem is that i have already drawn an (arrow)
> widget, and after gtk_main has been called, i will
> monitor a file for input. 
> 
> when there is input, a function will be called, and 
> I have the address of the arrow widget, and now at
> this stage, is there any way to change its color to
> some other, and back, i.e. as if the arrow has flashed
> ....
> 
> (i dont want to destroy it and redraw it with another
> color) 
> 
> regards,
> rahul
> 
> 
> 
> 
> ------=_NextPartTM-000-2eea1f60-0b5c-11d6-a941-00b0d0d06be8
> -----------------------------------------------------------------------------------------------------------------------
> Information transmitted by this E-MAIL is proprietary to Wipro and/or its Customers and
> is intended for use only by the individual or entity to which it is
> addressed, and may contain information that is privileged, confidential or
> exempt from disclosure under applicable law. If you are not the intended
> recipient or it appears that this mail has been forwarded to you without
> proper authority, you are notified that any use or dissemination of this
> information in any manner is strictly prohibited. In such cases, please
> notify us immediately at mailto:mailadmin wipro com and delete this mail
> from your records.
> ------------------------------------------------------------------------------------------------------------------------




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