]> Pileus Git - ~andy/gtk/blob - gtk/gtkcellrenderer.c
Support insensitive cells in tree views and combo boxes.
[~andy/gtk] / gtk / gtkcellrenderer.c
1 /* gtkcellrenderer.c
2  * Copyright (C) 2000  Red Hat, Inc. Jonathan Blandford
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 "gtkcellrenderer.h"
22 #include "gtkintl.h"
23 #include "gtkmarshalers.h"
24 #include "gtktreeprivate.h"
25
26 static void gtk_cell_renderer_init       (GtkCellRenderer      *cell);
27 static void gtk_cell_renderer_class_init (GtkCellRendererClass *class);
28 static void gtk_cell_renderer_get_property  (GObject              *object,
29                                              guint                 param_id,
30                                              GValue               *value,
31                                              GParamSpec           *pspec);
32 static void gtk_cell_renderer_set_property  (GObject              *object,
33                                              guint                 param_id,
34                                              const GValue         *value,
35                                              GParamSpec           *pspec);
36 static void set_cell_bg_color               (GtkCellRenderer      *cell,
37                                              GdkColor             *color);
38
39
40 #define GTK_CELL_RENDERER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_CELL_RENDERER, GtkCellRendererPrivate))
41
42 typedef struct _GtkCellRendererPrivate GtkCellRendererPrivate;
43 struct _GtkCellRendererPrivate
44 {
45   GdkColor cell_background;
46 };
47
48
49 enum {
50   PROP_ZERO,
51   PROP_MODE,
52   PROP_VISIBLE,
53   PROP_SENSITIVE,
54   PROP_XALIGN,
55   PROP_YALIGN,
56   PROP_XPAD,
57   PROP_YPAD,
58   PROP_WIDTH,
59   PROP_HEIGHT,
60   PROP_IS_EXPANDER,
61   PROP_IS_EXPANDED,
62   PROP_CELL_BACKGROUND,
63   PROP_CELL_BACKGROUND_GDK,
64   PROP_CELL_BACKGROUND_SET
65 };
66
67 /* Signal IDs */
68 enum {
69   EDITING_CANCELED,
70   LAST_SIGNAL
71 };
72
73 static guint cell_renderer_signals[LAST_SIGNAL] = { 0 };
74
75
76 GType
77 gtk_cell_renderer_get_type (void)
78 {
79   static GType cell_type = 0;
80
81   if (!cell_type)
82     {
83       static const GTypeInfo cell_info =
84       {
85         sizeof (GtkCellRendererClass),
86         NULL,           /* base_init */
87         NULL,           /* base_finalize */
88         (GClassInitFunc) gtk_cell_renderer_class_init,
89         NULL,           /* class_finalize */
90         NULL,           /* class_data */
91         sizeof (GtkCellRenderer),
92         0,              /* n_preallocs */
93         (GInstanceInitFunc) gtk_cell_renderer_init,
94         NULL,           /* value_table */
95       };
96
97       cell_type = g_type_register_static (GTK_TYPE_OBJECT, "GtkCellRenderer", 
98                                           &cell_info, G_TYPE_FLAG_ABSTRACT);
99     }
100
101   return cell_type;
102 }
103
104 static void
105 gtk_cell_renderer_init (GtkCellRenderer *cell)
106 {
107   cell->mode = GTK_CELL_RENDERER_MODE_INERT;
108   cell->visible = TRUE;
109   cell->width = -1;
110   cell->height = -1;
111   cell->xalign = 0.5;
112   cell->yalign = 0.5;
113   cell->xpad = 0;
114   cell->ypad = 0;
115   cell->sensitive = TRUE;
116 }
117
118 static void
119 gtk_cell_renderer_class_init (GtkCellRendererClass *class)
120 {
121   GObjectClass *object_class = G_OBJECT_CLASS (class);
122
123   object_class->get_property = gtk_cell_renderer_get_property;
124   object_class->set_property = gtk_cell_renderer_set_property;
125
126   class->render = NULL;
127   class->get_size = NULL;
128
129   /**
130    * GtkCellRenderer::editing-canceled:
131    * @renderer: the object which received the signal
132    *
133    * This signal gets emitted when the user cancels the process of editing a
134    * cell.  For example, an editable cell renderer could be written to cancel
135    * editing when the user presses Escape.
136    *
137    * See also: gtk_cell_renderer_editing_canceled()
138    *
139    * Since: 2.4
140    */
141
142   cell_renderer_signals[EDITING_CANCELED] =
143     g_signal_new ("editing-canceled",
144                   G_OBJECT_CLASS_TYPE (object_class),
145                   G_SIGNAL_RUN_FIRST,
146                   G_STRUCT_OFFSET (GtkCellRendererClass, editing_canceled),
147                   NULL, NULL,
148                   _gtk_marshal_VOID__VOID,
149                   G_TYPE_NONE, 0);
150
151   g_object_class_install_property (object_class,
152                                    PROP_MODE,
153                                    g_param_spec_enum ("mode",
154                                                       P_("mode"),
155                                                       P_("Editable mode of the CellRenderer"),
156                                                       GTK_TYPE_CELL_RENDERER_MODE,
157                                                       GTK_CELL_RENDERER_MODE_INERT,
158                                                       G_PARAM_READABLE |
159                                                       G_PARAM_WRITABLE));
160
161   g_object_class_install_property (object_class,
162                                    PROP_VISIBLE,
163                                    g_param_spec_boolean ("visible",
164                                                          P_("visible"),
165                                                          P_("Display the cell"),
166                                                          TRUE,
167                                                          G_PARAM_READWRITE));
168   g_object_class_install_property (object_class,
169                                    PROP_SENSITIVE,
170                                    g_param_spec_boolean ("sensitive",
171                                                          P_("Sensitive"),
172                                                          P_("Display the cell sensitive"),
173                                                          TRUE,
174                                                          G_PARAM_READWRITE));
175
176   g_object_class_install_property (object_class,
177                                    PROP_XALIGN,
178                                    g_param_spec_float ("xalign",
179                                                        P_("xalign"),
180                                                        P_("The x-align"),
181                                                        0.0,
182                                                        1.0,
183                                                        0.0,
184                                                        G_PARAM_READABLE |
185                                                        G_PARAM_WRITABLE));
186
187   g_object_class_install_property (object_class,
188                                    PROP_YALIGN,
189                                    g_param_spec_float ("yalign",
190                                                        P_("yalign"),
191                                                        P_("The y-align"),
192                                                        0.0,
193                                                        1.0,
194                                                        0.5,
195                                                        G_PARAM_READABLE |
196                                                        G_PARAM_WRITABLE));
197
198   g_object_class_install_property (object_class,
199                                    PROP_XPAD,
200                                    g_param_spec_uint ("xpad",
201                                                       P_("xpad"),
202                                                       P_("The xpad"),
203                                                       0,
204                                                       G_MAXUINT,
205                                                       2,
206                                                       G_PARAM_READABLE |
207                                                       G_PARAM_WRITABLE));
208
209   g_object_class_install_property (object_class,
210                                    PROP_YPAD,
211                                    g_param_spec_uint ("ypad",
212                                                       P_("ypad"),
213                                                       P_("The ypad"),
214                                                       0,
215                                                       G_MAXUINT,
216                                                       2,
217                                                       G_PARAM_READABLE |
218                                                       G_PARAM_WRITABLE));
219
220   g_object_class_install_property (object_class,
221                                    PROP_WIDTH,
222                                    g_param_spec_int ("width",
223                                                      P_("width"),
224                                                      P_("The fixed width"),
225                                                      -1,
226                                                      G_MAXINT,
227                                                      -1,
228                                                      G_PARAM_READABLE |
229                                                      G_PARAM_WRITABLE));
230
231   g_object_class_install_property (object_class,
232                                    PROP_HEIGHT,
233                                    g_param_spec_int ("height",
234                                                      P_("height"),
235                                                      P_("The fixed height"),
236                                                      -1,
237                                                      G_MAXINT,
238                                                      -1,
239                                                      G_PARAM_READABLE |
240                                                      G_PARAM_WRITABLE));
241
242   g_object_class_install_property (object_class,
243                                    PROP_IS_EXPANDER,
244                                    g_param_spec_boolean ("is_expander",
245                                                          P_("Is Expander"),
246                                                          P_("Row has children"),
247                                                          FALSE,
248                                                          G_PARAM_READABLE |
249                                                          G_PARAM_WRITABLE));
250
251
252   g_object_class_install_property (object_class,
253                                    PROP_IS_EXPANDED,
254                                    g_param_spec_boolean ("is_expanded",
255                                                          P_("Is Expanded"),
256                                                          P_("Row is an expander row, and is expanded"),
257                                                          FALSE,
258                                                          G_PARAM_READABLE |
259                                                          G_PARAM_WRITABLE));
260
261   g_object_class_install_property (object_class,
262                                    PROP_CELL_BACKGROUND,
263                                    g_param_spec_string ("cell_background",
264                                                         P_("Cell background color name"),
265                                                         P_("Cell background color as a string"),
266                                                         NULL,
267                                                         G_PARAM_WRITABLE));
268
269   g_object_class_install_property (object_class,
270                                    PROP_CELL_BACKGROUND_GDK,
271                                    g_param_spec_boxed ("cell_background_gdk",
272                                                        P_("Cell background color"),
273                                                        P_("Cell background color as a GdkColor"),
274                                                        GDK_TYPE_COLOR,
275                                                        G_PARAM_READABLE | G_PARAM_WRITABLE));
276
277
278 #define ADD_SET_PROP(propname, propval, nick, blurb) g_object_class_install_property (object_class, propval, g_param_spec_boolean (propname, nick, blurb, FALSE, G_PARAM_READABLE | G_PARAM_WRITABLE))
279
280   ADD_SET_PROP ("cell_background_set", PROP_CELL_BACKGROUND_SET,
281                 P_("Cell background set"),
282                 P_("Whether this tag affects the cell background color"));
283
284   g_type_class_add_private (object_class, sizeof (GtkCellRendererPrivate));
285 }
286
287 static void
288 gtk_cell_renderer_get_property (GObject     *object,
289                                 guint        param_id,
290                                 GValue      *value,
291                                 GParamSpec  *pspec)
292 {
293   GtkCellRenderer *cell = GTK_CELL_RENDERER (object);
294   GtkCellRendererPrivate *priv = GTK_CELL_RENDERER_GET_PRIVATE (object);
295
296   switch (param_id)
297     {
298     case PROP_MODE:
299       g_value_set_enum (value, cell->mode);
300       break;
301     case PROP_VISIBLE:
302       g_value_set_boolean (value, cell->visible);
303       break;
304     case PROP_SENSITIVE:
305       g_value_set_boolean (value, cell->sensitive);
306       break;
307     case PROP_XALIGN:
308       g_value_set_float (value, cell->xalign);
309       break;
310     case PROP_YALIGN:
311       g_value_set_float (value, cell->yalign);
312       break;
313     case PROP_XPAD:
314       g_value_set_uint (value, cell->xpad);
315       break;
316     case PROP_YPAD:
317       g_value_set_uint (value, cell->ypad);
318       break;
319     case PROP_WIDTH:
320       g_value_set_int (value, cell->width);
321       break;
322     case PROP_HEIGHT:
323       g_value_set_int (value, cell->height);
324       break;
325     case PROP_IS_EXPANDER:
326       g_value_set_boolean (value, cell->is_expander);
327       break;
328     case PROP_IS_EXPANDED:
329       g_value_set_boolean (value, cell->is_expanded);
330       break;
331     case PROP_CELL_BACKGROUND_GDK:
332       {
333         GdkColor color;
334
335         color.red = priv->cell_background.red;
336         color.green = priv->cell_background.green;
337         color.blue = priv->cell_background.blue;
338
339         g_value_set_boxed (value, &color);
340       }
341       break;
342     case PROP_CELL_BACKGROUND_SET:
343       g_value_set_boolean (value, cell->cell_background_set);
344       break;
345     case PROP_CELL_BACKGROUND:
346     default:
347       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
348       break;
349     }
350
351 }
352
353 static void
354 gtk_cell_renderer_set_property (GObject      *object,
355                                 guint         param_id,
356                                 const GValue *value,
357                                 GParamSpec   *pspec)
358 {
359   GtkCellRenderer *cell = GTK_CELL_RENDERER (object);
360
361   switch (param_id)
362     {
363     case PROP_MODE:
364       cell->mode = g_value_get_enum (value);
365       break;
366     case PROP_VISIBLE:
367       cell->visible = g_value_get_boolean (value);
368       break;
369     case PROP_SENSITIVE:
370       cell->sensitive = g_value_get_boolean (value);
371       break;
372     case PROP_XALIGN:
373       cell->xalign = g_value_get_float (value);
374       break;
375     case PROP_YALIGN:
376       cell->yalign = g_value_get_float (value);
377       break;
378     case PROP_XPAD:
379       cell->xpad = g_value_get_uint (value);
380       break;
381     case PROP_YPAD:
382       cell->ypad = g_value_get_uint (value);
383       break;
384     case PROP_WIDTH:
385       cell->width = g_value_get_int (value);
386       break;
387     case PROP_HEIGHT:
388       cell->height = g_value_get_int (value);
389       break;
390     case PROP_IS_EXPANDER:
391       cell->is_expander = g_value_get_boolean (value);
392       break;
393     case PROP_IS_EXPANDED:
394       cell->is_expanded = g_value_get_boolean (value);
395       break;
396     case PROP_CELL_BACKGROUND:
397       {
398         GdkColor color;
399
400         if (!g_value_get_string (value))
401           set_cell_bg_color (cell, NULL);
402         else if (gdk_color_parse (g_value_get_string (value), &color))
403           set_cell_bg_color (cell, &color);
404         else
405           g_warning ("Don't know color `%s'", g_value_get_string (value));
406
407         g_object_notify (object, "cell_background_gdk");
408       }
409       break;
410     case PROP_CELL_BACKGROUND_GDK:
411       set_cell_bg_color (cell, g_value_get_boxed (value));
412       break;
413     case PROP_CELL_BACKGROUND_SET:
414       cell->cell_background_set = g_value_get_boolean (value);
415       break;
416     default:
417       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
418       break;
419     }
420 }
421
422 static void
423 set_cell_bg_color (GtkCellRenderer *cell,
424                    GdkColor        *color)
425 {
426   GtkCellRendererPrivate *priv = GTK_CELL_RENDERER_GET_PRIVATE (cell);
427
428   if (color)
429     {
430       if (!cell->cell_background_set)
431         {
432           cell->cell_background_set = TRUE;
433           g_object_notify (G_OBJECT (cell), "cell_background_set");
434         }
435
436       priv->cell_background.red = color->red;
437       priv->cell_background.green = color->green;
438       priv->cell_background.blue = color->blue;
439     }
440   else
441     {
442       if (cell->cell_background_set)
443         {
444           cell->cell_background_set = FALSE;
445           g_object_notify (G_OBJECT (cell), "cell_background_set");
446         }
447     }
448 }
449
450 /**
451  * gtk_cell_renderer_get_size:
452  * @cell: a #GtkCellRenderer
453  * @widget: the widget the renderer is rendering to
454  * @cell_area: The area a cell will be allocated, or %NULL
455  * @x_offset: location to return x offset of cell relative to @cell_area, or %NULL
456  * @y_offset: location to return y offset of cell relative to @cell_area, or %NULL
457  * @width: location to return width needed to render a cell, or %NULL
458  * @height: location to return height needed to render a cell, or %NULL
459  *
460  * Obtains the width and height needed to render the cell. Used by view widgets
461  * to determine the appropriate size for the cell_area passed to
462  * gtk_cell_renderer_render().  If @cell_area is not %NULL, fills in the x and y
463  * offsets (if set) of the cell relative to this location.  Please note that the
464  * values set in @width and @height, as well as those in @x_offset and @y_offset
465  * are inclusive of the xpad and ypad properties.
466  **/
467 void
468 gtk_cell_renderer_get_size (GtkCellRenderer *cell,
469                             GtkWidget       *widget,
470                             GdkRectangle    *cell_area,
471                             gint            *x_offset,
472                             gint            *y_offset,
473                             gint            *width,
474                             gint            *height)
475 {
476   gint *real_width = width;
477   gint *real_height = height;
478
479   g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
480   g_return_if_fail (GTK_CELL_RENDERER_GET_CLASS (cell)->get_size != NULL);
481
482   if (width && cell->width != -1)
483     {
484       real_width = NULL;
485       *width = cell->width;
486     }
487   if (height && cell->height != -1)
488     {
489       real_height = NULL;
490       *height = cell->height;
491     }
492
493   GTK_CELL_RENDERER_GET_CLASS (cell)->get_size (cell,
494                                                 widget,
495                                                 cell_area,
496                                                 x_offset,
497                                                 y_offset,
498                                                 real_width,
499                                                 real_height);
500 }
501
502 /**
503  * gtk_cell_renderer_render:
504  * @cell: a #GtkCellRenderer
505  * @window: a #GdkDrawable to draw to
506  * @widget: the widget owning @window
507  * @background_area: entire cell area (including tree expanders and maybe padding on the sides)
508  * @cell_area: area normally rendered by a cell renderer
509  * @expose_area: area that actually needs updating
510  * @flags: flags that affect rendering
511  *
512  * Invokes the virtual render function of the #GtkCellRenderer. The three
513  * passed-in rectangles are areas of @window. Most renderers will draw within
514  * @cell_area; the xalign, yalign, xpad, and ypad fields of the #GtkCellRenderer
515  * should be honored with respect to @cell_area. @background_area includes the
516  * blank space around the cell, and also the area containing the tree expander;
517  * so the @background_area rectangles for all cells tile to cover the entire
518  * @window.  @expose_area is a clip rectangle.
519  *
520  **/
521 void
522 gtk_cell_renderer_render (GtkCellRenderer     *cell,
523                           GdkWindow           *window,
524                           GtkWidget           *widget,
525                           GdkRectangle        *background_area,
526                           GdkRectangle        *cell_area,
527                           GdkRectangle        *expose_area,
528                           GtkCellRendererState flags)
529 {
530   gboolean selected = FALSE;
531   GtkCellRendererPrivate *priv = GTK_CELL_RENDERER_GET_PRIVATE (cell);
532
533   g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
534   g_return_if_fail (GTK_CELL_RENDERER_GET_CLASS (cell)->render != NULL);
535
536   selected = (flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED;
537
538   if (cell->cell_background_set && !selected)
539     {
540       GdkColor color;
541       GdkGC *gc;
542
543       color.red = priv->cell_background.red;
544       color.green = priv->cell_background.green;
545       color.blue = priv->cell_background.blue;
546
547       gc = gdk_gc_new (window);
548       gdk_gc_set_rgb_fg_color (gc, &color);
549       gdk_draw_rectangle (window, gc, TRUE,
550                           background_area->x, background_area->y,
551                           background_area->width, background_area->height);
552       g_object_unref (gc);
553     }
554
555   GTK_CELL_RENDERER_GET_CLASS (cell)->render (cell,
556                                               window,
557                                               widget,
558                                               background_area,
559                                               cell_area,
560                                               expose_area,
561                                               flags);
562 }
563
564 /**
565  * gtk_cell_renderer_activate:
566  * @cell: a #GtkCellRenderer
567  * @event: a #GdkEvent
568  * @widget: widget that received the event
569  * @path: widget-dependent string representation of the event location; e.g. for #GtkTreeView, a string representation of #GtkTreePath
570  * @background_area: background area as passed to @gtk_cell_renderer_render
571  * @cell_area: cell area as passed to @gtk_cell_renderer_render
572  * @flags: render flags
573  *
574  * Passes an activate event to the cell renderer for possible processing.  Some
575  * cell renderers may use events; for example, #GtkCellRendererToggle toggles
576  * when it gets a mouse click.
577  *
578  * Return value: %TRUE if the event was consumed/handled
579  **/
580 gboolean
581 gtk_cell_renderer_activate (GtkCellRenderer      *cell,
582                             GdkEvent             *event,
583                             GtkWidget            *widget,
584                             const gchar          *path,
585                             GdkRectangle         *background_area,
586                             GdkRectangle         *cell_area,
587                             GtkCellRendererState  flags)
588 {
589   g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE);
590
591   if (cell->mode != GTK_CELL_RENDERER_MODE_ACTIVATABLE)
592     return FALSE;
593
594   if (GTK_CELL_RENDERER_GET_CLASS (cell)->activate == NULL)
595     return FALSE;
596
597   return GTK_CELL_RENDERER_GET_CLASS (cell)->activate (cell,
598                                                        event,
599                                                        widget,
600                                                        path,
601                                                        background_area,
602                                                        cell_area,
603                                                        flags);
604 }
605
606 /**
607  * gtk_cell_renderer_start_editing:
608  * @cell: a #GtkCellRenderer
609  * @event: a #GdkEvent
610  * @widget: widget that received the event
611  * @path: widget-dependent string representation of the event location; e.g. for #GtkTreeView, a string representation of #GtkTreePath
612  * @background_area: background area as passed to @gtk_cell_renderer_render
613  * @cell_area: cell area as passed to @gtk_cell_renderer_render
614  * @flags: render flags
615  * 
616  * Passes an activate event to the cell renderer for possible processing.
617  * 
618  * Return value: A new #GtkCellEditable, or %NULL
619  **/
620 GtkCellEditable *
621 gtk_cell_renderer_start_editing (GtkCellRenderer      *cell,
622                                  GdkEvent             *event,
623                                  GtkWidget            *widget,
624                                  const gchar          *path,
625                                  GdkRectangle         *background_area,
626                                  GdkRectangle         *cell_area,
627                                  GtkCellRendererState  flags)
628
629 {
630   g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), NULL);
631
632   if (cell->mode != GTK_CELL_RENDERER_MODE_EDITABLE)
633     return NULL;
634
635   if (GTK_CELL_RENDERER_GET_CLASS (cell)->start_editing == NULL)
636     return NULL;
637
638   
639   return GTK_CELL_RENDERER_GET_CLASS (cell)->start_editing (cell,
640                                                             event,
641                                                             widget,
642                                                             path,
643                                                             background_area,
644                                                             cell_area,
645                                                             flags);
646 }
647
648 /**
649  * gtk_cell_renderer_set_fixed_size:
650  * @cell: A #GtkCellRenderer
651  * @width: the width of the cell renderer, or -1
652  * @height: the height of the cell renderer, or -1
653  * 
654  * Sets the renderer size to be explicit, independent of the properties set.
655  **/
656 void
657 gtk_cell_renderer_set_fixed_size (GtkCellRenderer *cell,
658                                   gint             width,
659                                   gint             height)
660 {
661   g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
662   g_return_if_fail (width >= -1 && height >= -1);
663
664   if ((width != cell->width) || (height != cell->height))
665     {
666       g_object_freeze_notify (G_OBJECT (cell));
667
668       if (width != cell->width)
669         {
670           cell->width = width;
671           g_object_notify (G_OBJECT (cell), "width");
672         }
673
674       if (height != cell->height)
675         {
676           cell->height = height;
677           g_object_notify (G_OBJECT (cell), "height");
678         }
679
680       g_object_thaw_notify (G_OBJECT (cell));
681     }
682 }
683
684 /**
685  * gtk_cell_renderer_get_fixed_size:
686  * @cell: A #GtkCellRenderer
687  * @width: location to fill in with the fixed width of the widget, or %NULL
688  * @height: location to fill in with the fixed height of the widget, or %NULL
689  * 
690  * Fills in @width and @height with the appropriate size of @cell.
691  **/
692 void
693 gtk_cell_renderer_get_fixed_size (GtkCellRenderer *cell,
694                                   gint            *width,
695                                   gint            *height)
696 {
697   g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
698
699   if (width)
700     (* width) = cell->width;
701   if (height)
702     (* height) = cell->height;
703 }
704
705 /**
706  * gtk_cell_renderer_editing_canceled:
707  * @cell: A #GtkCellRenderer
708  * 
709  * Causes the cell renderer to emit the "editing-canceled" signal.  This
710  * function is for use only by implementations of cell renderers that need to
711  * notify the client program that an editing process was canceled and the
712  * changes were not committed.
713  *
714  * Since: 2.4
715  **/
716 void
717 gtk_cell_renderer_editing_canceled (GtkCellRenderer *cell)
718 {
719   g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
720
721   g_signal_emit (cell, cell_renderer_signals[EDITING_CANCELED], 0);
722 }