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