]> Pileus Git - ~andy/gtk/blob - gtk/gtkcellrendererpixbuf.c
Fix typo
[~andy/gtk] / gtk / gtkcellrendererpixbuf.c
1 /* gtkcellrendererpixbuf.c
2  * Copyright (C) 2000  Red Hat, Inc.,  Jonathan Blandford <jrb@redhat.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #include <config.h>
21 #include <stdlib.h>
22 #include "gtkcellrendererpixbuf.h"
23 #include "gtkiconfactory.h"
24 #include "gtkintl.h"
25 #include "gtkalias.h"
26
27 static void gtk_cell_renderer_pixbuf_get_property  (GObject                    *object,
28                                                     guint                       param_id,
29                                                     GValue                     *value,
30                                                     GParamSpec                 *pspec);
31 static void gtk_cell_renderer_pixbuf_set_property  (GObject                    *object,
32                                                     guint                       param_id,
33                                                     const GValue               *value,
34                                                     GParamSpec                 *pspec);
35 static void gtk_cell_renderer_pixbuf_init       (GtkCellRendererPixbuf      *celltext);
36 static void gtk_cell_renderer_pixbuf_class_init (GtkCellRendererPixbufClass *class);
37 static void gtk_cell_renderer_pixbuf_finalize   (GObject                    *object);
38 static void gtk_cell_renderer_pixbuf_create_stock_pixbuf (GtkCellRendererPixbuf *cellpixbuf,
39                                                           GtkWidget             *widget);
40 static void gtk_cell_renderer_pixbuf_get_size   (GtkCellRenderer            *cell,
41                                                  GtkWidget                  *widget,
42                                                  GdkRectangle               *rectangle,
43                                                  gint                       *x_offset,
44                                                  gint                       *y_offset,
45                                                  gint                       *width,
46                                                  gint                       *height);
47 static void gtk_cell_renderer_pixbuf_render     (GtkCellRenderer            *cell,
48                                                  GdkDrawable                *window,
49                                                  GtkWidget                  *widget,
50                                                  GdkRectangle               *background_area,
51                                                  GdkRectangle               *cell_area,
52                                                  GdkRectangle               *expose_area,
53                                                  GtkCellRendererState        flags);
54
55
56 enum {
57         PROP_ZERO,
58         PROP_PIXBUF,
59         PROP_PIXBUF_EXPANDER_OPEN,
60         PROP_PIXBUF_EXPANDER_CLOSED,
61         PROP_STOCK_ID,
62         PROP_STOCK_SIZE,
63         PROP_STOCK_DETAIL,
64         PROP_FOLLOW_STATE
65 };
66
67 static gpointer parent_class;
68
69
70 #define GTK_CELL_RENDERER_PIXBUF_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_CELL_RENDERER_PIXBUF, GtkCellRendererPixbufPrivate))
71
72 typedef struct _GtkCellRendererPixbufPrivate GtkCellRendererPixbufPrivate;
73 struct _GtkCellRendererPixbufPrivate
74 {
75   gchar *stock_id;
76   GtkIconSize stock_size;
77   gchar *stock_detail;
78   gboolean follow_state;
79 };
80
81
82 GType
83 gtk_cell_renderer_pixbuf_get_type (void)
84 {
85   static GType cell_pixbuf_type = 0;
86
87   if (!cell_pixbuf_type)
88     {
89       static const GTypeInfo cell_pixbuf_info =
90       {
91         sizeof (GtkCellRendererPixbufClass),
92         NULL,           /* base_init */
93         NULL,           /* base_finalize */
94         (GClassInitFunc) gtk_cell_renderer_pixbuf_class_init,
95         NULL,           /* class_finalize */
96         NULL,           /* class_data */
97         sizeof (GtkCellRendererPixbuf),
98         0,              /* n_preallocs */
99         (GInstanceInitFunc) gtk_cell_renderer_pixbuf_init,
100       };
101
102       cell_pixbuf_type =
103         g_type_register_static (GTK_TYPE_CELL_RENDERER, "GtkCellRendererPixbuf",
104                                 &cell_pixbuf_info, 0);
105     }
106
107   return cell_pixbuf_type;
108 }
109
110 static void
111 gtk_cell_renderer_pixbuf_init (GtkCellRendererPixbuf *cellpixbuf)
112 {
113   GtkCellRendererPixbufPrivate *priv;
114
115   priv = GTK_CELL_RENDERER_PIXBUF_GET_PRIVATE (cellpixbuf);
116   priv->stock_size = GTK_ICON_SIZE_MENU;
117 }
118
119 static void
120 gtk_cell_renderer_pixbuf_class_init (GtkCellRendererPixbufClass *class)
121 {
122   GObjectClass *object_class = G_OBJECT_CLASS (class);
123   GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (class);
124
125   parent_class = g_type_class_peek_parent (class);
126
127   object_class->finalize = gtk_cell_renderer_pixbuf_finalize;
128
129   object_class->get_property = gtk_cell_renderer_pixbuf_get_property;
130   object_class->set_property = gtk_cell_renderer_pixbuf_set_property;
131
132   cell_class->get_size = gtk_cell_renderer_pixbuf_get_size;
133   cell_class->render = gtk_cell_renderer_pixbuf_render;
134
135 #define STATIC_STRINGS G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
136
137   g_object_class_install_property (object_class,
138                                    PROP_PIXBUF,
139                                    g_param_spec_object ("pixbuf",
140                                                         P_("Pixbuf Object"),
141                                                         P_("The pixbuf to render"),
142                                                         GDK_TYPE_PIXBUF,
143                                                         G_PARAM_READWRITE | STATIC_STRINGS));
144
145   g_object_class_install_property (object_class,
146                                    PROP_PIXBUF_EXPANDER_OPEN,
147                                    g_param_spec_object ("pixbuf-expander-open",
148                                                         P_("Pixbuf Expander Open"),
149                                                         P_("Pixbuf for open expander"),
150                                                         GDK_TYPE_PIXBUF,
151                                                         G_PARAM_READWRITE | STATIC_STRINGS));
152
153   g_object_class_install_property (object_class,
154                                    PROP_PIXBUF_EXPANDER_CLOSED,
155                                    g_param_spec_object ("pixbuf-expander-closed",
156                                                         P_("Pixbuf Expander Closed"),
157                                                         P_("Pixbuf for closed expander"),
158                                                         GDK_TYPE_PIXBUF,
159                                                         G_PARAM_READWRITE | STATIC_STRINGS));
160
161   g_object_class_install_property (object_class,
162                                    PROP_STOCK_ID,
163                                    g_param_spec_string ("stock-id",
164                                                         P_("Stock ID"),
165                                                         P_("The stock ID of the stock icon to render"),
166                                                         NULL,
167                                                         G_PARAM_READWRITE | STATIC_STRINGS));
168
169   g_object_class_install_property (object_class,
170                                    PROP_STOCK_SIZE,
171                                    g_param_spec_uint ("stock-size",
172                                                       P_("Size"),
173                                                       P_("The GtkIconSize value that specifies the size of the rendered icon"),
174                                                       0,
175                                                       G_MAXUINT,
176                                                       GTK_ICON_SIZE_MENU,
177                                                       G_PARAM_READWRITE | STATIC_STRINGS));
178
179   g_object_class_install_property (object_class,
180                                    PROP_STOCK_DETAIL,
181                                    g_param_spec_string ("stock-detail",
182                                                         P_("Detail"),
183                                                         P_("Render detail to pass to the theme engine"),
184                                                         NULL,
185                                                         G_PARAM_READWRITE | STATIC_STRINGS));
186
187   /**
188    * GtkCellRendererPixbuf:follow-state:
189    *
190    * Specifies whether the rendered pixbuf should be colorized
191    * according to the #GtkCellRendererState.
192    *
193    * Since: 2.8
194    */
195   g_object_class_install_property (object_class,
196                                    PROP_FOLLOW_STATE,
197                                    g_param_spec_boolean ("follow-state",
198                                                          P_("Follow State"),
199                                                          P_("Whether the rendered pixbuf should be "
200                                                             "colorized according to the state"),
201                                                          FALSE,
202                                                          G_PARAM_READWRITE | STATIC_STRINGS));
203
204
205   g_type_class_add_private (object_class, sizeof (GtkCellRendererPixbufPrivate));
206 }
207
208 static void
209 gtk_cell_renderer_pixbuf_finalize (GObject *object)
210 {
211   GtkCellRendererPixbuf *cellpixbuf = GTK_CELL_RENDERER_PIXBUF (object);
212   GtkCellRendererPixbufPrivate *priv;
213
214   priv = GTK_CELL_RENDERER_PIXBUF_GET_PRIVATE (object);
215
216   if (cellpixbuf->pixbuf)
217     g_object_unref (cellpixbuf->pixbuf);
218
219   if (priv->stock_id)
220     g_free (priv->stock_id);
221
222   if (priv->stock_detail)
223     g_free (priv->stock_detail);
224
225   (* G_OBJECT_CLASS (parent_class)->finalize) (object);
226 }
227
228 static void
229 gtk_cell_renderer_pixbuf_get_property (GObject        *object,
230                                        guint           param_id,
231                                        GValue         *value,
232                                        GParamSpec     *pspec)
233 {
234   GtkCellRendererPixbuf *cellpixbuf = GTK_CELL_RENDERER_PIXBUF (object);
235   GtkCellRendererPixbufPrivate *priv;
236
237   priv = GTK_CELL_RENDERER_PIXBUF_GET_PRIVATE (object);
238   
239   switch (param_id)
240     {
241     case PROP_PIXBUF:
242       g_value_set_object (value,
243                           cellpixbuf->pixbuf ? G_OBJECT (cellpixbuf->pixbuf) : NULL);
244       break;
245     case PROP_PIXBUF_EXPANDER_OPEN:
246       g_value_set_object (value,
247                           cellpixbuf->pixbuf_expander_open ? G_OBJECT (cellpixbuf->pixbuf_expander_open) : NULL);
248       break;
249     case PROP_PIXBUF_EXPANDER_CLOSED:
250       g_value_set_object (value,
251                           cellpixbuf->pixbuf_expander_closed ? G_OBJECT (cellpixbuf->pixbuf_expander_closed) : NULL);
252       break;
253     case PROP_STOCK_ID:
254       g_value_set_string (value, priv->stock_id);
255       break;
256     case PROP_STOCK_SIZE:
257       g_value_set_uint (value, priv->stock_size);
258       break;
259     case PROP_STOCK_DETAIL:
260       g_value_set_string (value, priv->stock_detail);
261       break;
262     case PROP_FOLLOW_STATE:
263       g_value_set_boolean (value, priv->follow_state);
264       break;
265     default:
266       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
267       break;
268     }
269 }
270
271
272 static void
273 gtk_cell_renderer_pixbuf_set_property (GObject      *object,
274                                        guint         param_id,
275                                        const GValue *value,
276                                        GParamSpec   *pspec)
277 {
278   GdkPixbuf *pixbuf;
279   GtkCellRendererPixbuf *cellpixbuf = GTK_CELL_RENDERER_PIXBUF (object);
280   GtkCellRendererPixbufPrivate *priv;
281
282   priv = GTK_CELL_RENDERER_PIXBUF_GET_PRIVATE (object);
283   
284   switch (param_id)
285     {
286     case PROP_PIXBUF:
287       pixbuf = (GdkPixbuf*) g_value_get_object (value);
288       if (pixbuf)
289         g_object_ref (pixbuf);
290       if (cellpixbuf->pixbuf)
291         g_object_unref (cellpixbuf->pixbuf);
292       cellpixbuf->pixbuf = pixbuf;
293       break;
294     case PROP_PIXBUF_EXPANDER_OPEN:
295       pixbuf = (GdkPixbuf*) g_value_get_object (value);
296       if (pixbuf)
297         g_object_ref (pixbuf);
298       if (cellpixbuf->pixbuf_expander_open)
299         g_object_unref (cellpixbuf->pixbuf_expander_open);
300       cellpixbuf->pixbuf_expander_open = pixbuf;
301       break;
302     case PROP_PIXBUF_EXPANDER_CLOSED:
303       pixbuf = (GdkPixbuf*) g_value_get_object (value);
304       if (pixbuf)
305         g_object_ref (pixbuf);
306       if (cellpixbuf->pixbuf_expander_closed)
307         g_object_unref (cellpixbuf->pixbuf_expander_closed);
308       cellpixbuf->pixbuf_expander_closed = pixbuf;
309       break;
310     case PROP_STOCK_ID:
311       if (priv->stock_id)
312         {
313           if (cellpixbuf->pixbuf)
314             {
315               g_object_unref (cellpixbuf->pixbuf);
316               cellpixbuf->pixbuf = NULL;
317             }
318           g_free (priv->stock_id);
319         }
320       priv->stock_id = g_strdup (g_value_get_string (value));
321       break;
322     case PROP_STOCK_SIZE:
323       priv->stock_size = g_value_get_uint (value);
324       break;
325     case PROP_STOCK_DETAIL:
326       if (priv->stock_detail)
327         g_free (priv->stock_detail);
328       priv->stock_detail = g_strdup (g_value_get_string (value));
329       break;
330     case PROP_FOLLOW_STATE:
331       priv->follow_state = g_value_get_boolean (value);
332       break;
333     default:
334       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
335       break;
336     }
337
338   if (cellpixbuf->pixbuf && priv->stock_id)
339     {
340       g_object_unref (cellpixbuf->pixbuf);
341       cellpixbuf->pixbuf = NULL;
342     }
343 }
344
345 /**
346  * gtk_cell_renderer_pixbuf_new:
347  * 
348  * Creates a new #GtkCellRendererPixbuf. Adjust rendering
349  * parameters using object properties. Object properties can be set
350  * globally (with g_object_set()). Also, with #GtkTreeViewColumn, you
351  * can bind a property to a value in a #GtkTreeModel. For example, you
352  * can bind the "pixbuf" property on the cell renderer to a pixbuf value
353  * in the model, thus rendering a different image in each row of the
354  * #GtkTreeView.
355  * 
356  * Return value: the new cell renderer
357  **/
358 GtkCellRenderer *
359 gtk_cell_renderer_pixbuf_new (void)
360 {
361   return g_object_new (GTK_TYPE_CELL_RENDERER_PIXBUF, NULL);
362 }
363
364 static void
365 gtk_cell_renderer_pixbuf_create_stock_pixbuf (GtkCellRendererPixbuf *cellpixbuf,
366                                               GtkWidget             *widget)
367 {
368   GtkCellRendererPixbufPrivate *priv;
369
370   priv = GTK_CELL_RENDERER_PIXBUF_GET_PRIVATE (cellpixbuf);
371
372   if (cellpixbuf->pixbuf)
373     g_object_unref (cellpixbuf->pixbuf);
374
375   cellpixbuf->pixbuf = gtk_widget_render_icon (widget,
376                                                priv->stock_id,
377                                                priv->stock_size,
378                                                priv->stock_detail);
379 }
380
381 static GdkPixbuf *
382 create_colorized_pixbuf (GdkPixbuf *src, 
383                          GdkColor  *new_color)
384 {
385   gint i, j;
386   gint width, height, has_alpha, src_row_stride, dst_row_stride;
387   gint red_value, green_value, blue_value;
388   guchar *target_pixels;
389   guchar *original_pixels;
390   guchar *pixsrc;
391   guchar *pixdest;
392   GdkPixbuf *dest;
393   
394   red_value = new_color->red / 255.0;
395   green_value = new_color->green / 255.0;
396   blue_value = new_color->blue / 255.0;
397   
398   dest = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (src),
399                          gdk_pixbuf_get_has_alpha (src),
400                          gdk_pixbuf_get_bits_per_sample (src),
401                          gdk_pixbuf_get_width (src),
402                          gdk_pixbuf_get_height (src));
403   
404   has_alpha = gdk_pixbuf_get_has_alpha (src);
405   width = gdk_pixbuf_get_width (src);
406   height = gdk_pixbuf_get_height (src);
407   src_row_stride = gdk_pixbuf_get_rowstride (src);
408   dst_row_stride = gdk_pixbuf_get_rowstride (dest);
409   target_pixels = gdk_pixbuf_get_pixels (dest);
410   original_pixels = gdk_pixbuf_get_pixels (src);
411   
412   for (i = 0; i < height; i++) {
413     pixdest = target_pixels + i*dst_row_stride;
414     pixsrc = original_pixels + i*src_row_stride;
415     for (j = 0; j < width; j++) {               
416       *pixdest++ = (*pixsrc++ * red_value) >> 8;
417       *pixdest++ = (*pixsrc++ * green_value) >> 8;
418       *pixdest++ = (*pixsrc++ * blue_value) >> 8;
419       if (has_alpha) {
420         *pixdest++ = *pixsrc++;
421       }
422     }
423   }
424   return dest;
425 }
426
427
428 static void
429 gtk_cell_renderer_pixbuf_get_size (GtkCellRenderer *cell,
430                                    GtkWidget       *widget,
431                                    GdkRectangle    *cell_area,
432                                    gint            *x_offset,
433                                    gint            *y_offset,
434                                    gint            *width,
435                                    gint            *height)
436 {
437   GtkCellRendererPixbuf *cellpixbuf = (GtkCellRendererPixbuf *) cell;
438   GtkCellRendererPixbufPrivate *priv;
439   gint pixbuf_width  = 0;
440   gint pixbuf_height = 0;
441   gint calc_width;
442   gint calc_height;
443
444   priv = GTK_CELL_RENDERER_PIXBUF_GET_PRIVATE (cell);
445
446   if (!cellpixbuf->pixbuf && priv->stock_id)
447     gtk_cell_renderer_pixbuf_create_stock_pixbuf (cellpixbuf, widget);
448
449   if (cellpixbuf->pixbuf)
450     {
451       pixbuf_width  = gdk_pixbuf_get_width (cellpixbuf->pixbuf);
452       pixbuf_height = gdk_pixbuf_get_height (cellpixbuf->pixbuf);
453     }
454   if (cellpixbuf->pixbuf_expander_open)
455     {
456       pixbuf_width  = MAX (pixbuf_width, gdk_pixbuf_get_width (cellpixbuf->pixbuf_expander_open));
457       pixbuf_height = MAX (pixbuf_height, gdk_pixbuf_get_height (cellpixbuf->pixbuf_expander_open));
458     }
459   if (cellpixbuf->pixbuf_expander_closed)
460     {
461       pixbuf_width  = MAX (pixbuf_width, gdk_pixbuf_get_width (cellpixbuf->pixbuf_expander_closed));
462       pixbuf_height = MAX (pixbuf_height, gdk_pixbuf_get_height (cellpixbuf->pixbuf_expander_closed));
463     }
464   
465   calc_width  = (gint) cell->xpad * 2 + pixbuf_width;
466   calc_height = (gint) cell->ypad * 2 + pixbuf_height;
467   
468   if (x_offset) *x_offset = 0;
469   if (y_offset) *y_offset = 0;
470
471   if (cell_area && pixbuf_width > 0 && pixbuf_height > 0)
472     {
473       if (x_offset)
474         {
475           *x_offset = (((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
476                         1.0 - cell->xalign : cell->xalign) * 
477                        (cell_area->width - calc_width - 2 * cell->xpad));
478           *x_offset = MAX (*x_offset, 0) + cell->xpad;
479         }
480       if (y_offset)
481         {
482           *y_offset = (cell->yalign *
483                        (cell_area->height - calc_height - 2 * cell->ypad));
484           *y_offset = MAX (*y_offset, 0) + cell->ypad;
485         }
486     }
487
488   if (width)
489     *width = calc_width;
490   
491   if (height)
492     *height = calc_height;
493 }
494
495 static void
496 gtk_cell_renderer_pixbuf_render (GtkCellRenderer      *cell,
497                                  GdkWindow            *window,
498                                  GtkWidget            *widget,
499                                  GdkRectangle         *background_area,
500                                  GdkRectangle         *cell_area,
501                                  GdkRectangle         *expose_area,
502                                  GtkCellRendererState  flags)
503
504 {
505   GtkCellRendererPixbuf *cellpixbuf = (GtkCellRendererPixbuf *) cell;
506   GtkCellRendererPixbufPrivate *priv;
507   GdkPixbuf *pixbuf;
508   GdkPixbuf *invisible = NULL;
509   GdkPixbuf *colorized = NULL;
510   GdkRectangle pix_rect;
511   GdkRectangle draw_rect;
512
513   priv = GTK_CELL_RENDERER_PIXBUF_GET_PRIVATE (cell);
514
515   gtk_cell_renderer_pixbuf_get_size (cell, widget, cell_area,
516                                      &pix_rect.x,
517                                      &pix_rect.y,
518                                      &pix_rect.width,
519                                      &pix_rect.height);
520
521   pix_rect.x += cell_area->x;
522   pix_rect.y += cell_area->y;
523   pix_rect.width  -= cell->xpad * 2;
524   pix_rect.height -= cell->ypad * 2;
525
526   if (!gdk_rectangle_intersect (cell_area, &pix_rect, &draw_rect) ||
527       !gdk_rectangle_intersect (expose_area, &draw_rect, &draw_rect))
528     return;
529
530   pixbuf = cellpixbuf->pixbuf;
531
532   if (cell->is_expander)
533     {
534       if (cell->is_expanded &&
535           cellpixbuf->pixbuf_expander_open != NULL)
536         pixbuf = cellpixbuf->pixbuf_expander_open;
537       else if (!cell->is_expanded &&
538                cellpixbuf->pixbuf_expander_closed != NULL)
539         pixbuf = cellpixbuf->pixbuf_expander_closed;
540     }
541
542   if (!pixbuf)
543     return;
544
545   if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE || !cell->sensitive)
546     {
547       GtkIconSource *source;
548       
549       source = gtk_icon_source_new ();
550       gtk_icon_source_set_pixbuf (source, pixbuf);
551       /* The size here is arbitrary; since size isn't
552        * wildcarded in the source, it isn't supposed to be
553        * scaled by the engine function
554        */
555       gtk_icon_source_set_size (source, GTK_ICON_SIZE_SMALL_TOOLBAR);
556       gtk_icon_source_set_size_wildcarded (source, FALSE);
557       
558      invisible = gtk_style_render_icon (widget->style,
559                                         source,
560                                         gtk_widget_get_direction (widget),
561                                         GTK_STATE_INSENSITIVE,
562                                         /* arbitrary */
563                                         (GtkIconSize)-1,
564                                         widget,
565                                         "gtkcellrendererpixbuf");
566      
567      gtk_icon_source_free (source);
568      
569      pixbuf = invisible;
570     }
571   else if (priv->follow_state && 
572            (flags & (GTK_CELL_RENDERER_SELECTED|GTK_CELL_RENDERER_PRELIT)) != 0)
573     {
574       GtkStateType state;
575
576       if ((flags & GTK_CELL_RENDERER_SELECTED) != 0)
577         {
578           if (GTK_WIDGET_HAS_FOCUS (widget))
579             state = GTK_STATE_SELECTED;
580           else
581             state = GTK_STATE_ACTIVE;
582         }
583       else
584         state = GTK_STATE_PRELIGHT;
585
586       colorized = create_colorized_pixbuf (pixbuf,
587                                            &widget->style->base[state]);
588
589       pixbuf = colorized;
590     }
591
592   gdk_draw_pixbuf (window,
593                    widget->style->black_gc,
594                    pixbuf,
595                    /* pixbuf 0, 0 is at pix_rect.x, pix_rect.y */
596                    draw_rect.x - pix_rect.x,
597                    draw_rect.y - pix_rect.y,
598                    draw_rect.x,
599                    draw_rect.y,
600                    draw_rect.width,
601                    draw_rect.height,
602                    GDK_RGB_DITHER_NORMAL,
603                    0, 0);
604   
605   if (invisible)
606     g_object_unref (invisible);
607
608   if (colorized)
609     g_object_unref (colorized);
610 }
611
612 #define __GTK_CELL_RENDERER_PIXBUF_C__
613 #include "gtkaliasdef.c"