2 * Copyright (C) 2000 Red Hat, Inc. Jonathan Blandford
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.
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.
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.
21 #include "gtkcellrenderer.h"
23 #include "gtkmarshalers.h"
24 #include "gtktypebuiltins.h"
25 #include "gtkprivate.h"
26 #include "gtktreeprivate.h"
27 #include "a11y/gtkrenderercellaccessible.h"
31 * SECTION:gtkcellrenderer
32 * @Short_description: An object for rendering a single cell
33 * @Title: GtkCellRenderer
34 * @See_also: #GtkCellRendererText, #GtkCellRendererPixbuf, #GtkCellRendererToggle
36 * The #GtkCellRenderer is a base class of a set of objects used for
37 * rendering a cell to a #cairo_t. These objects are used primarily by
38 * the #GtkTreeView widget, though they aren't tied to them in any
39 * specific way. It is worth noting that #GtkCellRenderer is not a
40 * #GtkWidget and cannot be treated as such.
42 * The primary use of a #GtkCellRenderer is for drawing a certain graphical
43 * elements on a #cairo_t. Typically, one cell renderer is used to
44 * draw many cells on the screen. To this extent, it isn't expected that a
45 * CellRenderer keep any permanent state around. Instead, any state is set
46 * just prior to use using #GObject<!-- -->s property system. Then, the
47 * cell is measured using gtk_cell_renderer_get_size(). Finally, the cell
48 * is rendered in the correct location using gtk_cell_renderer_render().
50 * There are a number of rules that must be followed when writing a new
51 * #GtkCellRenderer. First and formost, its important that a certain set
52 * of properties will always yield a cell renderer of the same size,
53 * barring a #GtkStyle change. The #GtkCellRenderer also has a number of
54 * generic properties that are expected to be honored by all children.
56 * Beyond merely rendering a cell, cell renderers can optionally
57 * provide active user interface elements. A cell renderer can be
58 * <firstterm>activatable</firstterm> like #GtkCellRendererToggle,
59 * which toggles when it gets activated by a mouse click, or it can be
60 * <firstterm>editable</firstterm> like #GtkCellRendererText, which
61 * allows the user to edit the text using a #GtkEntry.
62 * To make a cell renderer activatable or editable, you have to
63 * implement the #GtkCellRendererClass.activate or
64 * #GtkCellRendererClass.start_editing virtual functions, respectively.
68 #define DEBUG_CELL_SIZE_REQUEST 0
70 static void gtk_cell_renderer_init (GtkCellRenderer *cell);
71 static void gtk_cell_renderer_class_init (GtkCellRendererClass *class);
72 static void gtk_cell_renderer_get_property (GObject *object,
76 static void gtk_cell_renderer_set_property (GObject *object,
80 static void set_cell_bg_color (GtkCellRenderer *cell,
83 /* Fallback GtkCellRenderer implementation to use remaining ->get_size() implementations */
84 static GtkSizeRequestMode gtk_cell_renderer_real_get_request_mode(GtkCellRenderer *cell);
85 static void gtk_cell_renderer_real_get_preferred_width (GtkCellRenderer *cell,
89 static void gtk_cell_renderer_real_get_preferred_height (GtkCellRenderer *cell,
93 static void gtk_cell_renderer_real_get_preferred_height_for_width(GtkCellRenderer *cell,
97 gint *natural_height);
98 static void gtk_cell_renderer_real_get_preferred_width_for_height(GtkCellRenderer *cell,
102 gint *natural_width);
103 static void gtk_cell_renderer_real_get_aligned_area (GtkCellRenderer *cell,
105 GtkCellRendererState flags,
106 const GdkRectangle *cell_area,
107 GdkRectangle *aligned_area);
110 struct _GtkCellRendererPrivate
123 guint is_expander : 1;
124 guint is_expanded : 1;
125 guint cell_background_set : 1;
129 GdkRGBA cell_background;
132 struct _GtkCellRendererClassPrivate
134 GType accessible_type;
150 PROP_CELL_BACKGROUND,
151 PROP_CELL_BACKGROUND_GDK,
152 PROP_CELL_BACKGROUND_RGBA,
153 PROP_CELL_BACKGROUND_SET,
164 static guint cell_renderer_signals[LAST_SIGNAL] = { 0 };
167 gtk_cell_renderer_init (GtkCellRenderer *cell)
169 GtkCellRendererPrivate *priv;
171 cell->priv = G_TYPE_INSTANCE_GET_PRIVATE (cell,
172 GTK_TYPE_CELL_RENDERER,
173 GtkCellRendererPrivate);
176 priv->mode = GTK_CELL_RENDERER_MODE_INERT;
177 priv->visible = TRUE;
184 priv->sensitive = TRUE;
185 priv->is_expander = FALSE;
186 priv->is_expanded = FALSE;
187 priv->editing = FALSE;
191 gtk_cell_renderer_class_init (GtkCellRendererClass *class)
193 GObjectClass *object_class = G_OBJECT_CLASS (class);
195 object_class->get_property = gtk_cell_renderer_get_property;
196 object_class->set_property = gtk_cell_renderer_set_property;
198 class->render = NULL;
199 class->get_size = NULL;
200 class->get_request_mode = gtk_cell_renderer_real_get_request_mode;
201 class->get_preferred_width = gtk_cell_renderer_real_get_preferred_width;
202 class->get_preferred_height = gtk_cell_renderer_real_get_preferred_height;
203 class->get_preferred_width_for_height = gtk_cell_renderer_real_get_preferred_width_for_height;
204 class->get_preferred_height_for_width = gtk_cell_renderer_real_get_preferred_height_for_width;
205 class->get_aligned_area = gtk_cell_renderer_real_get_aligned_area;
208 * GtkCellRenderer::editing-canceled:
209 * @renderer: the object which received the signal
211 * This signal gets emitted when the user cancels the process of editing a
212 * cell. For example, an editable cell renderer could be written to cancel
213 * editing when the user presses Escape.
215 * See also: gtk_cell_renderer_stop_editing().
219 cell_renderer_signals[EDITING_CANCELED] =
220 g_signal_new (I_("editing-canceled"),
221 G_OBJECT_CLASS_TYPE (object_class),
223 G_STRUCT_OFFSET (GtkCellRendererClass, editing_canceled),
225 _gtk_marshal_VOID__VOID,
229 * GtkCellRenderer::editing-started:
230 * @renderer: the object which received the signal
231 * @editable: the #GtkCellEditable
232 * @path: the path identifying the edited cell
234 * This signal gets emitted when a cell starts to be edited.
235 * The intended use of this signal is to do special setup
236 * on @editable, e.g. adding a #GtkEntryCompletion or setting
237 * up additional columns in a #GtkComboBox.
239 * Note that GTK+ doesn't guarantee that cell renderers will
240 * continue to use the same kind of widget for editing in future
241 * releases, therefore you should check the type of @editable
242 * before doing any specific setup, as in the following example:
245 * text_editing_started (GtkCellRenderer *cell,
246 * GtkCellEditable *editable,
250 * if (GTK_IS_ENTRY (editable))
252 * GtkEntry *entry = GTK_ENTRY (editable);
254 * /* ... create a GtkEntryCompletion */
256 * gtk_entry_set_completion (entry, completion);
263 cell_renderer_signals[EDITING_STARTED] =
264 g_signal_new (I_("editing-started"),
265 G_OBJECT_CLASS_TYPE (object_class),
267 G_STRUCT_OFFSET (GtkCellRendererClass, editing_started),
269 _gtk_marshal_VOID__OBJECT_STRING,
271 GTK_TYPE_CELL_EDITABLE,
274 g_object_class_install_property (object_class,
276 g_param_spec_enum ("mode",
278 P_("Editable mode of the CellRenderer"),
279 GTK_TYPE_CELL_RENDERER_MODE,
280 GTK_CELL_RENDERER_MODE_INERT,
281 GTK_PARAM_READWRITE));
283 g_object_class_install_property (object_class,
285 g_param_spec_boolean ("visible",
287 P_("Display the cell"),
289 GTK_PARAM_READWRITE));
290 g_object_class_install_property (object_class,
292 g_param_spec_boolean ("sensitive",
294 P_("Display the cell sensitive"),
296 GTK_PARAM_READWRITE));
298 g_object_class_install_property (object_class,
300 g_param_spec_float ("xalign",
306 GTK_PARAM_READWRITE));
308 g_object_class_install_property (object_class,
310 g_param_spec_float ("yalign",
316 GTK_PARAM_READWRITE));
318 g_object_class_install_property (object_class,
320 g_param_spec_uint ("xpad",
326 GTK_PARAM_READWRITE));
328 g_object_class_install_property (object_class,
330 g_param_spec_uint ("ypad",
336 GTK_PARAM_READWRITE));
338 g_object_class_install_property (object_class,
340 g_param_spec_int ("width",
342 P_("The fixed width"),
346 GTK_PARAM_READWRITE));
348 g_object_class_install_property (object_class,
350 g_param_spec_int ("height",
352 P_("The fixed height"),
356 GTK_PARAM_READWRITE));
358 g_object_class_install_property (object_class,
360 g_param_spec_boolean ("is-expander",
362 P_("Row has children"),
364 GTK_PARAM_READWRITE));
367 g_object_class_install_property (object_class,
369 g_param_spec_boolean ("is-expanded",
371 P_("Row is an expander row, and is expanded"),
373 GTK_PARAM_READWRITE));
375 g_object_class_install_property (object_class,
376 PROP_CELL_BACKGROUND,
377 g_param_spec_string ("cell-background",
378 P_("Cell background color name"),
379 P_("Cell background color as a string"),
381 GTK_PARAM_WRITABLE));
384 * GtkCellRenderer:cell-background-gdk:
386 * Cell background as a #GdkColor
388 * Deprecated: 3.4: Use #GtkCellRenderer:cell-background-rgba instead.
390 g_object_class_install_property (object_class,
391 PROP_CELL_BACKGROUND_GDK,
392 g_param_spec_boxed ("cell-background-gdk",
393 P_("Cell background color"),
394 P_("Cell background color as a GdkColor"),
396 GTK_PARAM_READWRITE | G_PARAM_DEPRECATED));
398 * GtkCellRenderer:cell-background-rgba:
400 * Cell background as a #GdkRGBA
404 g_object_class_install_property (object_class,
405 PROP_CELL_BACKGROUND_RGBA,
406 g_param_spec_boxed ("cell-background-rgba",
407 P_("Cell background RGBA color"),
408 P_("Cell background color as a GdkRGBA"),
410 GTK_PARAM_READWRITE));
412 g_object_class_install_property (object_class,
414 g_param_spec_boolean ("editing",
416 P_("Whether the cell renderer is currently in editing mode"),
418 GTK_PARAM_READABLE));
421 #define ADD_SET_PROP(propname, propval, nick, blurb) g_object_class_install_property (object_class, propval, g_param_spec_boolean (propname, nick, blurb, FALSE, GTK_PARAM_READWRITE))
423 ADD_SET_PROP ("cell-background-set", PROP_CELL_BACKGROUND_SET,
424 P_("Cell background set"),
425 P_("Whether this tag affects the cell background color"));
427 g_type_class_add_private (class, sizeof (GtkCellRendererPrivate));
429 _gtk_cell_renderer_class_set_accessible_type (class, GTK_TYPE_RENDERER_CELL_ACCESSIBLE);
433 gtk_cell_renderer_base_class_init (gpointer g_class)
435 GtkCellRendererClass *klass = g_class;
437 klass->priv = G_TYPE_CLASS_GET_PRIVATE (g_class, GTK_TYPE_CELL_RENDERER, GtkCellRendererClassPrivate);
441 gtk_cell_renderer_get_type (void)
443 static GType cell_renderer_type = 0;
445 if (G_UNLIKELY (cell_renderer_type == 0))
447 const GTypeInfo cell_renderer_info =
449 sizeof (GtkCellRendererClass),
450 gtk_cell_renderer_base_class_init,
452 (GClassInitFunc) gtk_cell_renderer_class_init,
453 NULL, /* class_finalize */
454 NULL, /* class_init */
457 (GInstanceInitFunc) gtk_cell_renderer_init,
458 NULL, /* value_table */
460 cell_renderer_type = g_type_register_static (G_TYPE_INITIALLY_UNOWNED, "GtkCellRenderer",
461 &cell_renderer_info, G_TYPE_FLAG_ABSTRACT);
463 g_type_add_class_private (cell_renderer_type, sizeof (GtkCellRendererClassPrivate));
466 return cell_renderer_type;
470 gtk_cell_renderer_get_property (GObject *object,
475 GtkCellRenderer *cell = GTK_CELL_RENDERER (object);
476 GtkCellRendererPrivate *priv = cell->priv;
481 g_value_set_enum (value, priv->mode);
484 g_value_set_boolean (value, priv->visible);
487 g_value_set_boolean (value, priv->sensitive);
490 g_value_set_boolean (value, priv->editing);
493 g_value_set_float (value, priv->xalign);
496 g_value_set_float (value, priv->yalign);
499 g_value_set_uint (value, priv->xpad);
502 g_value_set_uint (value, priv->ypad);
505 g_value_set_int (value, priv->width);
508 g_value_set_int (value, priv->height);
510 case PROP_IS_EXPANDER:
511 g_value_set_boolean (value, priv->is_expander);
513 case PROP_IS_EXPANDED:
514 g_value_set_boolean (value, priv->is_expanded);
516 case PROP_CELL_BACKGROUND_GDK:
520 color.red = (guint16) (priv->cell_background.red * 65535);
521 color.green = (guint16) (priv->cell_background.green * 65535);
522 color.blue = (guint16) (priv->cell_background.blue * 65535);
524 g_value_set_boxed (value, &color);
527 case PROP_CELL_BACKGROUND_RGBA:
528 g_value_set_boxed (value, &priv->cell_background);
530 case PROP_CELL_BACKGROUND_SET:
531 g_value_set_boolean (value, priv->cell_background_set);
533 case PROP_CELL_BACKGROUND:
535 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
542 gtk_cell_renderer_set_property (GObject *object,
547 GtkCellRenderer *cell = GTK_CELL_RENDERER (object);
548 GtkCellRendererPrivate *priv = cell->priv;
553 priv->mode = g_value_get_enum (value);
556 priv->visible = g_value_get_boolean (value);
559 priv->sensitive = g_value_get_boolean (value);
562 priv->editing = g_value_get_boolean (value);
565 priv->xalign = g_value_get_float (value);
568 priv->yalign = g_value_get_float (value);
571 priv->xpad = g_value_get_uint (value);
574 priv->ypad = g_value_get_uint (value);
577 priv->width = g_value_get_int (value);
580 priv->height = g_value_get_int (value);
582 case PROP_IS_EXPANDER:
583 priv->is_expander = g_value_get_boolean (value);
585 case PROP_IS_EXPANDED:
586 priv->is_expanded = g_value_get_boolean (value);
588 case PROP_CELL_BACKGROUND:
592 if (!g_value_get_string (value))
593 set_cell_bg_color (cell, NULL);
594 else if (gdk_rgba_parse (&rgba, g_value_get_string (value)))
595 set_cell_bg_color (cell, &rgba);
597 g_warning ("Don't know color `%s'", g_value_get_string (value));
599 g_object_notify (object, "cell-background-gdk");
602 case PROP_CELL_BACKGROUND_GDK:
606 color = g_value_get_boxed (value);
611 rgba.red = color->red / 65535.;
612 rgba.green = color->green / 65535.;
613 rgba.blue = color->blue / 65535.;
616 set_cell_bg_color (cell, &rgba);
620 set_cell_bg_color (cell, NULL);
624 case PROP_CELL_BACKGROUND_RGBA:
625 set_cell_bg_color (cell, g_value_get_boxed (value));
627 case PROP_CELL_BACKGROUND_SET:
628 priv->cell_background_set = g_value_get_boolean (value);
631 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
637 set_cell_bg_color (GtkCellRenderer *cell,
640 GtkCellRendererPrivate *priv = cell->priv;
644 if (!priv->cell_background_set)
646 priv->cell_background_set = TRUE;
647 g_object_notify (G_OBJECT (cell), "cell-background-set");
650 priv->cell_background = *rgba;
654 if (priv->cell_background_set)
656 priv->cell_background_set = FALSE;
657 g_object_notify (G_OBJECT (cell), "cell-background-set");
663 * gtk_cell_renderer_get_size:
664 * @cell: a #GtkCellRenderer
665 * @widget: the widget the renderer is rendering to
666 * @cell_area: (allow-none): The area a cell will be allocated, or %NULL
667 * @x_offset: (out) (allow-none): location to return x offset of cell relative to @cell_area, or %NULL
668 * @y_offset: (out) (allow-none): location to return y offset of cell relative to @cell_area, or %NULL
669 * @width: (out) (allow-none): location to return width needed to render a cell, or %NULL
670 * @height: (out) (allow-none): location to return height needed to render a cell, or %NULL
672 * Obtains the width and height needed to render the cell. Used by view
673 * widgets to determine the appropriate size for the cell_area passed to
674 * gtk_cell_renderer_render(). If @cell_area is not %NULL, fills in the
675 * x and y offsets (if set) of the cell relative to this location.
677 * Please note that the values set in @width and @height, as well as those
678 * in @x_offset and @y_offset are inclusive of the xpad and ypad properties.
681 * Deprecated: 3.0: Use gtk_cell_renderer_get_preferred_size() instead.
684 gtk_cell_renderer_get_size (GtkCellRenderer *cell,
686 const GdkRectangle *cell_area,
692 GtkRequisition request;
694 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
696 gtk_cell_renderer_get_preferred_size (cell, widget, &request, NULL);
699 *width = request.width;
702 *height = request.height;
705 _gtk_cell_renderer_calc_offset (cell, cell_area, gtk_widget_get_direction (widget),
706 request.width, request.height, x_offset, y_offset);
710 * gtk_cell_renderer_render:
711 * @cell: a #GtkCellRenderer
712 * @cr: a cairo context to draw to
713 * @widget: the widget owning @window
714 * @background_area: entire cell area (including tree expanders and maybe
715 * padding on the sides)
716 * @cell_area: area normally rendered by a cell renderer
717 * @flags: flags that affect rendering
719 * Invokes the virtual render function of the #GtkCellRenderer. The three
720 * passed-in rectangles are areas in @cr. Most renderers will draw within
721 * @cell_area; the xalign, yalign, xpad, and ypad fields of the #GtkCellRenderer
722 * should be honored with respect to @cell_area. @background_area includes the
723 * blank space around the cell, and also the area containing the tree expander;
724 * so the @background_area rectangles for all cells tile to cover the entire
728 gtk_cell_renderer_render (GtkCellRenderer *cell,
731 const GdkRectangle *background_area,
732 const GdkRectangle *cell_area,
733 GtkCellRendererState flags)
735 gboolean selected = FALSE;
736 GtkCellRendererPrivate *priv = cell->priv;
737 GtkStyleContext *context;
740 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
741 g_return_if_fail (GTK_CELL_RENDERER_GET_CLASS (cell)->render != NULL);
742 g_return_if_fail (cr != NULL);
744 selected = (flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED;
748 if (priv->cell_background_set && !selected)
750 gdk_cairo_rectangle (cr, background_area);
751 gdk_cairo_set_source_rgba (cr, &priv->cell_background);
755 gdk_cairo_rectangle (cr, background_area);
758 context = gtk_widget_get_style_context (widget);
760 gtk_style_context_save (context);
761 gtk_style_context_add_class (context, GTK_STYLE_CLASS_CELL);
763 state = gtk_cell_renderer_get_state (cell, widget, flags);
764 gtk_style_context_set_state (context, state);
766 GTK_CELL_RENDERER_GET_CLASS (cell)->render (cell,
772 gtk_style_context_restore (context);
777 * gtk_cell_renderer_activate:
778 * @cell: a #GtkCellRenderer
779 * @event: a #GdkEvent
780 * @widget: widget that received the event
781 * @path: widget-dependent string representation of the event location;
782 * e.g. for #GtkTreeView, a string representation of #GtkTreePath
783 * @background_area: background area as passed to gtk_cell_renderer_render()
784 * @cell_area: cell area as passed to gtk_cell_renderer_render()
785 * @flags: render flags
787 * Passes an activate event to the cell renderer for possible processing.
788 * Some cell renderers may use events; for example, #GtkCellRendererToggle
789 * toggles when it gets a mouse click.
791 * Return value: %TRUE if the event was consumed/handled
794 gtk_cell_renderer_activate (GtkCellRenderer *cell,
798 const GdkRectangle *background_area,
799 const GdkRectangle *cell_area,
800 GtkCellRendererState flags)
802 GtkCellRendererPrivate *priv;
804 g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE);
808 if (priv->mode != GTK_CELL_RENDERER_MODE_ACTIVATABLE)
811 if (GTK_CELL_RENDERER_GET_CLASS (cell)->activate == NULL)
814 return GTK_CELL_RENDERER_GET_CLASS (cell)->activate (cell,
818 (GdkRectangle *) background_area,
819 (GdkRectangle *) cell_area,
824 * gtk_cell_renderer_start_editing:
825 * @cell: a #GtkCellRenderer
826 * @event: a #GdkEvent
827 * @widget: widget that received the event
828 * @path: widget-dependent string representation of the event location;
829 * e.g. for #GtkTreeView, a string representation of #GtkTreePath
830 * @background_area: background area as passed to gtk_cell_renderer_render()
831 * @cell_area: cell area as passed to gtk_cell_renderer_render()
832 * @flags: render flags
834 * Passes an activate event to the cell renderer for possible processing.
836 * Return value: (transfer none): A new #GtkCellEditable, or %NULL
839 gtk_cell_renderer_start_editing (GtkCellRenderer *cell,
843 const GdkRectangle *background_area,
844 const GdkRectangle *cell_area,
845 GtkCellRendererState flags)
848 GtkCellRendererPrivate *priv;
849 GtkCellEditable *editable;
851 g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), NULL);
855 if (priv->mode != GTK_CELL_RENDERER_MODE_EDITABLE)
858 if (GTK_CELL_RENDERER_GET_CLASS (cell)->start_editing == NULL)
861 editable = GTK_CELL_RENDERER_GET_CLASS (cell)->start_editing (cell,
865 (GdkRectangle *) background_area,
866 (GdkRectangle *) cell_area,
870 cell_renderer_signals[EDITING_STARTED], 0,
873 priv->editing = TRUE;
879 * gtk_cell_renderer_set_fixed_size:
880 * @cell: A #GtkCellRenderer
881 * @width: the width of the cell renderer, or -1
882 * @height: the height of the cell renderer, or -1
884 * Sets the renderer size to be explicit, independent of the properties set.
887 gtk_cell_renderer_set_fixed_size (GtkCellRenderer *cell,
891 GtkCellRendererPrivate *priv;
893 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
894 g_return_if_fail (width >= -1 && height >= -1);
898 if ((width != priv->width) || (height != priv->height))
900 g_object_freeze_notify (G_OBJECT (cell));
902 if (width != priv->width)
905 g_object_notify (G_OBJECT (cell), "width");
908 if (height != priv->height)
910 priv->height = height;
911 g_object_notify (G_OBJECT (cell), "height");
914 g_object_thaw_notify (G_OBJECT (cell));
919 * gtk_cell_renderer_get_fixed_size:
920 * @cell: A #GtkCellRenderer
921 * @width: (out) (allow-none): location to fill in with the fixed width of the cell, or %NULL
922 * @height: (out) (allow-none): location to fill in with the fixed height of the cell, or %NULL
924 * Fills in @width and @height with the appropriate size of @cell.
927 gtk_cell_renderer_get_fixed_size (GtkCellRenderer *cell,
931 GtkCellRendererPrivate *priv;
933 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
938 *width = priv->width;
940 *height = priv->height;
944 * gtk_cell_renderer_set_alignment:
945 * @cell: A #GtkCellRenderer
946 * @xalign: the x alignment of the cell renderer
947 * @yalign: the y alignment of the cell renderer
949 * Sets the renderer's alignment within its available space.
954 gtk_cell_renderer_set_alignment (GtkCellRenderer *cell,
958 GtkCellRendererPrivate *priv;
960 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
961 g_return_if_fail (xalign >= 0.0 && xalign <= 1.0);
962 g_return_if_fail (yalign >= 0.0 && yalign <= 1.0);
966 if ((xalign != priv->xalign) || (yalign != priv->yalign))
968 g_object_freeze_notify (G_OBJECT (cell));
970 if (xalign != priv->xalign)
972 priv->xalign = xalign;
973 g_object_notify (G_OBJECT (cell), "xalign");
976 if (yalign != priv->yalign)
978 priv->yalign = yalign;
979 g_object_notify (G_OBJECT (cell), "yalign");
982 g_object_thaw_notify (G_OBJECT (cell));
987 * gtk_cell_renderer_get_alignment:
988 * @cell: A #GtkCellRenderer
989 * @xalign: (out) (allow-none): location to fill in with the x alignment of the cell, or %NULL
990 * @yalign: (out) (allow-none): location to fill in with the y alignment of the cell, or %NULL
992 * Fills in @xalign and @yalign with the appropriate values of @cell.
997 gtk_cell_renderer_get_alignment (GtkCellRenderer *cell,
1001 GtkCellRendererPrivate *priv;
1003 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1008 *xalign = priv->xalign;
1010 *yalign = priv->yalign;
1014 * gtk_cell_renderer_set_padding:
1015 * @cell: A #GtkCellRenderer
1016 * @xpad: the x padding of the cell renderer
1017 * @ypad: the y padding of the cell renderer
1019 * Sets the renderer's padding.
1024 gtk_cell_renderer_set_padding (GtkCellRenderer *cell,
1028 GtkCellRendererPrivate *priv;
1030 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1031 g_return_if_fail (xpad >= 0 && xpad >= 0);
1035 if ((xpad != priv->xpad) || (ypad != priv->ypad))
1037 g_object_freeze_notify (G_OBJECT (cell));
1039 if (xpad != priv->xpad)
1042 g_object_notify (G_OBJECT (cell), "xpad");
1045 if (ypad != priv->ypad)
1048 g_object_notify (G_OBJECT (cell), "ypad");
1051 g_object_thaw_notify (G_OBJECT (cell));
1056 * gtk_cell_renderer_get_padding:
1057 * @cell: A #GtkCellRenderer
1058 * @xpad: (out) (allow-none): location to fill in with the x padding of the cell, or %NULL
1059 * @ypad: (out) (allow-none): location to fill in with the y padding of the cell, or %NULL
1061 * Fills in @xpad and @ypad with the appropriate values of @cell.
1066 gtk_cell_renderer_get_padding (GtkCellRenderer *cell,
1070 GtkCellRendererPrivate *priv;
1072 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1083 * gtk_cell_renderer_set_visible:
1084 * @cell: A #GtkCellRenderer
1085 * @visible: the visibility of the cell
1087 * Sets the cell renderer's visibility.
1092 gtk_cell_renderer_set_visible (GtkCellRenderer *cell,
1095 GtkCellRendererPrivate *priv;
1097 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1101 if (priv->visible != visible)
1103 priv->visible = visible ? TRUE : FALSE;
1104 g_object_notify (G_OBJECT (cell), "visible");
1109 * gtk_cell_renderer_get_visible:
1110 * @cell: A #GtkCellRenderer
1112 * Returns the cell renderer's visibility.
1114 * Returns: %TRUE if the cell renderer is visible
1119 gtk_cell_renderer_get_visible (GtkCellRenderer *cell)
1121 g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE);
1123 return cell->priv->visible;
1127 * gtk_cell_renderer_set_sensitive:
1128 * @cell: A #GtkCellRenderer
1129 * @sensitive: the sensitivity of the cell
1131 * Sets the cell renderer's sensitivity.
1136 gtk_cell_renderer_set_sensitive (GtkCellRenderer *cell,
1139 GtkCellRendererPrivate *priv;
1141 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1145 if (priv->sensitive != sensitive)
1147 priv->sensitive = sensitive ? TRUE : FALSE;
1148 g_object_notify (G_OBJECT (cell), "sensitive");
1153 * gtk_cell_renderer_get_sensitive:
1154 * @cell: A #GtkCellRenderer
1156 * Returns the cell renderer's sensitivity.
1158 * Returns: %TRUE if the cell renderer is sensitive
1163 gtk_cell_renderer_get_sensitive (GtkCellRenderer *cell)
1165 g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE);
1167 return cell->priv->sensitive;
1172 * gtk_cell_renderer_is_activatable:
1173 * @cell: A #GtkCellRenderer
1175 * Checks whether the cell renderer can do something when activated.
1177 * Returns: %TRUE if the cell renderer can do anything when activated
1182 gtk_cell_renderer_is_activatable (GtkCellRenderer *cell)
1184 GtkCellRendererPrivate *priv;
1186 g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE);
1190 return (priv->visible &&
1191 (priv->mode == GTK_CELL_RENDERER_MODE_EDITABLE ||
1192 priv->mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE));
1197 * gtk_cell_renderer_stop_editing:
1198 * @cell: A #GtkCellRenderer
1199 * @canceled: %TRUE if the editing has been canceled
1201 * Informs the cell renderer that the editing is stopped.
1202 * If @canceled is %TRUE, the cell renderer will emit the
1203 * #GtkCellRenderer::editing-canceled signal.
1205 * This function should be called by cell renderer implementations
1206 * in response to the #GtkCellEditable::editing-done signal of
1212 gtk_cell_renderer_stop_editing (GtkCellRenderer *cell,
1215 GtkCellRendererPrivate *priv;
1217 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1223 priv->editing = FALSE;
1225 g_signal_emit (cell, cell_renderer_signals[EDITING_CANCELED], 0);
1230 gtk_cell_renderer_real_get_preferred_size (GtkCellRenderer *cell,
1232 GtkOrientation orientation,
1236 GtkRequisition min_req;
1238 /* Fallback on the old API to get the size. */
1239 if (GTK_CELL_RENDERER_GET_CLASS (cell)->get_size)
1240 GTK_CELL_RENDERER_GET_CLASS (cell)->get_size (GTK_CELL_RENDERER (cell), widget, NULL, NULL, NULL,
1241 &min_req.width, &min_req.height);
1248 if (orientation == GTK_ORIENTATION_HORIZONTAL)
1251 *minimum_size = min_req.width;
1254 *natural_size = min_req.width;
1259 *minimum_size = min_req.height;
1262 *natural_size = min_req.height;
1266 static GtkSizeRequestMode
1267 gtk_cell_renderer_real_get_request_mode (GtkCellRenderer *cell)
1269 /* By default cell renderers are height-for-width. */
1270 return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
1274 gtk_cell_renderer_real_get_preferred_width (GtkCellRenderer *cell,
1279 gtk_cell_renderer_real_get_preferred_size (cell, widget, GTK_ORIENTATION_HORIZONTAL,
1280 minimum_size, natural_size);
1284 gtk_cell_renderer_real_get_preferred_height (GtkCellRenderer *cell,
1289 gtk_cell_renderer_real_get_preferred_size (cell, widget, GTK_ORIENTATION_VERTICAL,
1290 minimum_size, natural_size);
1295 gtk_cell_renderer_real_get_preferred_height_for_width (GtkCellRenderer *cell,
1298 gint *minimum_height,
1299 gint *natural_height)
1301 /* Fall back on the height reported from ->get_size() */
1302 gtk_cell_renderer_get_preferred_height (cell, widget, minimum_height, natural_height);
1306 gtk_cell_renderer_real_get_preferred_width_for_height (GtkCellRenderer *cell,
1309 gint *minimum_width,
1310 gint *natural_width)
1312 /* Fall back on the width reported from ->get_size() */
1313 gtk_cell_renderer_get_preferred_width (cell, widget, minimum_width, natural_width);
1317 /* Default implementation assumes that a cell renderer will never use more
1318 * space than its natural size (this is fine for toggles and pixbufs etc
1319 * but needs to be overridden from wrapping/ellipsizing text renderers) */
1321 gtk_cell_renderer_real_get_aligned_area (GtkCellRenderer *cell,
1323 GtkCellRendererState flags,
1324 const GdkRectangle *cell_area,
1325 GdkRectangle *aligned_area)
1327 gint opposite_size, x_offset, y_offset;
1330 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1331 g_return_if_fail (GTK_IS_WIDGET (widget));
1332 g_return_if_fail (cell_area != NULL);
1333 g_return_if_fail (aligned_area != NULL);
1335 *aligned_area = *cell_area;
1337 /* Trim up the aligned size */
1338 if (gtk_cell_renderer_get_request_mode (cell) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
1340 gtk_cell_renderer_get_preferred_width (cell, widget,
1341 NULL, &natural_size);
1343 aligned_area->width = MIN (aligned_area->width, natural_size);
1345 gtk_cell_renderer_get_preferred_height_for_width (cell, widget,
1346 aligned_area->width,
1347 NULL, &opposite_size);
1349 aligned_area->height = MIN (opposite_size, aligned_area->height);
1353 gtk_cell_renderer_get_preferred_height (cell, widget,
1354 NULL, &natural_size);
1356 aligned_area->height = MIN (aligned_area->width, natural_size);
1358 gtk_cell_renderer_get_preferred_width_for_height (cell, widget,
1359 aligned_area->height,
1360 NULL, &opposite_size);
1362 aligned_area->width = MIN (opposite_size, aligned_area->width);
1365 /* offset the cell position */
1366 _gtk_cell_renderer_calc_offset (cell, cell_area,
1367 gtk_widget_get_direction (widget),
1368 aligned_area->width,
1369 aligned_area->height,
1370 &x_offset, &y_offset);
1372 aligned_area->x += x_offset;
1373 aligned_area->y += y_offset;
1377 /* An internal convenience function for some containers to peek at the
1378 * cell alignment in a target allocation (used to draw focus and align
1379 * cells in the icon view).
1381 * Note this is only a trivial 'align * (allocation - request)' operation.
1384 _gtk_cell_renderer_calc_offset (GtkCellRenderer *cell,
1385 const GdkRectangle *cell_area,
1386 GtkTextDirection direction,
1392 GtkCellRendererPrivate *priv;
1394 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1395 g_return_if_fail (cell_area != NULL);
1396 g_return_if_fail (x_offset || y_offset);
1402 *x_offset = (((direction == GTK_TEXT_DIR_RTL) ?
1403 (1.0 - priv->xalign) : priv->xalign) *
1404 (cell_area->width - width));
1405 *x_offset = MAX (*x_offset, 0);
1409 *y_offset = (priv->yalign *
1410 (cell_area->height - height));
1411 *y_offset = MAX (*y_offset, 0);
1416 * gtk_cell_renderer_get_request_mode:
1417 * @cell: a #GtkCellRenderer instance
1419 * Gets whether the cell renderer prefers a height-for-width layout
1420 * or a width-for-height layout.
1422 * Returns: The #GtkSizeRequestMode preferred by this renderer.
1427 gtk_cell_renderer_get_request_mode (GtkCellRenderer *cell)
1429 g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE);
1431 return GTK_CELL_RENDERER_GET_CLASS (cell)->get_request_mode (cell);
1435 * gtk_cell_renderer_get_preferred_width:
1436 * @cell: a #GtkCellRenderer instance
1437 * @widget: the #GtkWidget this cell will be rendering to
1438 * @minimum_size: (out) (allow-none): location to store the minimum size, or %NULL
1439 * @natural_size: (out) (allow-none): location to store the natural size, or %NULL
1441 * Retreives a renderer's natural size when rendered to @widget.
1446 gtk_cell_renderer_get_preferred_width (GtkCellRenderer *cell,
1451 GtkCellRendererClass *klass;
1454 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1455 g_return_if_fail (GTK_IS_WIDGET (widget));
1456 g_return_if_fail (NULL != minimum_size || NULL != natural_size);
1458 gtk_cell_renderer_get_fixed_size (GTK_CELL_RENDERER (cell), &width, NULL);
1462 klass = GTK_CELL_RENDERER_GET_CLASS (cell);
1463 klass->get_preferred_width (cell, widget, minimum_size, natural_size);
1468 *minimum_size = width;
1470 *natural_size = width;
1473 #if DEBUG_CELL_SIZE_REQUEST
1474 g_message ("%s returning minimum width: %d and natural width: %d",
1475 G_OBJECT_TYPE_NAME (cell),
1476 minimum_size ? *minimum_size : 20000,
1477 natural_size ? *natural_size : 20000);
1483 * gtk_cell_renderer_get_preferred_height:
1484 * @cell: a #GtkCellRenderer instance
1485 * @widget: the #GtkWidget this cell will be rendering to
1486 * @minimum_size: (out) (allow-none): location to store the minimum size, or %NULL
1487 * @natural_size: (out) (allow-none): location to store the natural size, or %NULL
1489 * Retreives a renderer's natural size when rendered to @widget.
1494 gtk_cell_renderer_get_preferred_height (GtkCellRenderer *cell,
1499 GtkCellRendererClass *klass;
1502 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1503 g_return_if_fail (GTK_IS_WIDGET (widget));
1504 g_return_if_fail (NULL != minimum_size || NULL != natural_size);
1506 gtk_cell_renderer_get_fixed_size (GTK_CELL_RENDERER (cell), NULL, &height);
1510 klass = GTK_CELL_RENDERER_GET_CLASS (cell);
1511 klass->get_preferred_height (cell, widget, minimum_size, natural_size);
1516 *minimum_size = height;
1518 *natural_size = height;
1521 #if DEBUG_CELL_SIZE_REQUEST
1522 g_message ("%s returning minimum height: %d and natural height: %d",
1523 G_OBJECT_TYPE_NAME (cell),
1524 minimum_size ? *minimum_size : 20000,
1525 natural_size ? *natural_size : 20000);
1531 * gtk_cell_renderer_get_preferred_width_for_height:
1532 * @cell: a #GtkCellRenderer instance
1533 * @widget: the #GtkWidget this cell will be rendering to
1534 * @height: the size which is available for allocation
1535 * @minimum_width: (out) (allow-none): location for storing the minimum size, or %NULL
1536 * @natural_width: (out) (allow-none): location for storing the preferred size, or %NULL
1538 * Retreives a cell renderers's minimum and natural width if it were rendered to
1539 * @widget with the specified @height.
1544 gtk_cell_renderer_get_preferred_width_for_height (GtkCellRenderer *cell,
1547 gint *minimum_width,
1548 gint *natural_width)
1550 GtkCellRendererClass *klass;
1553 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1554 g_return_if_fail (GTK_IS_WIDGET (widget));
1555 g_return_if_fail (NULL != minimum_width || NULL != natural_width);
1557 gtk_cell_renderer_get_fixed_size (GTK_CELL_RENDERER (cell), &width, NULL);
1561 klass = GTK_CELL_RENDERER_GET_CLASS (cell);
1562 klass->get_preferred_width_for_height (cell, widget, height, minimum_width, natural_width);
1567 *minimum_width = width;
1569 *natural_width = width;
1572 #if DEBUG_CELL_SIZE_REQUEST
1573 g_message ("%s width for height: %d is minimum %d and natural: %d",
1574 G_OBJECT_TYPE_NAME (cell), height,
1575 minimum_width ? *minimum_width : 20000,
1576 natural_width ? *natural_width : 20000);
1581 * gtk_cell_renderer_get_preferred_height_for_width:
1582 * @cell: a #GtkCellRenderer instance
1583 * @widget: the #GtkWidget this cell will be rendering to
1584 * @width: the size which is available for allocation
1585 * @minimum_height: (out) (allow-none): location for storing the minimum size, or %NULL
1586 * @natural_height: (out) (allow-none): location for storing the preferred size, or %NULL
1588 * Retreives a cell renderers's minimum and natural height if it were rendered to
1589 * @widget with the specified @width.
1594 gtk_cell_renderer_get_preferred_height_for_width (GtkCellRenderer *cell,
1597 gint *minimum_height,
1598 gint *natural_height)
1600 GtkCellRendererClass *klass;
1603 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1604 g_return_if_fail (GTK_IS_WIDGET (widget));
1605 g_return_if_fail (NULL != minimum_height || NULL != natural_height);
1607 gtk_cell_renderer_get_fixed_size (GTK_CELL_RENDERER (cell), NULL, &height);
1611 klass = GTK_CELL_RENDERER_GET_CLASS (cell);
1612 klass->get_preferred_height_for_width (cell, widget, width, minimum_height, natural_height);
1617 *minimum_height = height;
1619 *natural_height = height;
1622 #if DEBUG_CELL_SIZE_REQUEST
1623 g_message ("%s height for width: %d is minimum %d and natural: %d",
1624 G_OBJECT_TYPE_NAME (cell), width,
1625 minimum_height ? *minimum_height : 20000,
1626 natural_height ? *natural_height : 20000);
1631 * gtk_cell_renderer_get_preferred_size:
1632 * @cell: a #GtkCellRenderer instance
1633 * @widget: the #GtkWidget this cell will be rendering to
1634 * @minimum_size: (out) (allow-none): location for storing the minimum size, or %NULL
1635 * @natural_size: (out) (allow-none): location for storing the natural size, or %NULL
1637 * Retrieves the minimum and natural size of a cell taking
1638 * into account the widget's preference for height-for-width management.
1643 gtk_cell_renderer_get_preferred_size (GtkCellRenderer *cell,
1645 GtkRequisition *minimum_size,
1646 GtkRequisition *natural_size)
1648 gint min_width, nat_width;
1649 gint min_height, nat_height;
1651 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1653 if (gtk_cell_renderer_get_request_mode (cell) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
1655 gtk_cell_renderer_get_preferred_width (cell, widget, &min_width, &nat_width);
1659 minimum_size->width = min_width;
1660 gtk_cell_renderer_get_preferred_height_for_width (cell, widget, min_width,
1661 &minimum_size->height, NULL);
1666 natural_size->width = nat_width;
1667 gtk_cell_renderer_get_preferred_height_for_width (cell, widget, nat_width,
1668 NULL, &natural_size->height);
1671 else /* GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT */
1673 gtk_cell_renderer_get_preferred_height (cell, widget, &min_height, &nat_height);
1677 minimum_size->height = min_height;
1678 gtk_cell_renderer_get_preferred_width_for_height (cell, widget, min_height,
1679 &minimum_size->width, NULL);
1684 natural_size->height = nat_height;
1685 gtk_cell_renderer_get_preferred_width_for_height (cell, widget, nat_height,
1686 NULL, &natural_size->width);
1692 * gtk_cell_renderer_get_aligned_area:
1693 * @cell: a #GtkCellRenderer instance
1694 * @widget: the #GtkWidget this cell will be rendering to
1695 * @flags: render flags
1696 * @cell_area: cell area which would be passed to gtk_cell_renderer_render()
1697 * @aligned_area: (out): the return location for the space inside @cell_area
1698 * that would acually be used to render.
1700 * Gets the aligned area used by @cell inside @cell_area. Used for finding
1701 * the appropriate edit and focus rectangle.
1706 gtk_cell_renderer_get_aligned_area (GtkCellRenderer *cell,
1708 GtkCellRendererState flags,
1709 const GdkRectangle *cell_area,
1710 GdkRectangle *aligned_area)
1712 GtkCellRendererClass *klass;
1714 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1715 g_return_if_fail (GTK_IS_WIDGET (widget));
1716 g_return_if_fail (cell_area != NULL);
1717 g_return_if_fail (aligned_area != NULL);
1719 klass = GTK_CELL_RENDERER_GET_CLASS (cell);
1720 klass->get_aligned_area (cell, widget, flags, cell_area, aligned_area);
1722 g_assert (aligned_area->x >= cell_area->x && aligned_area->x <= cell_area->x + cell_area->width);
1723 g_assert (aligned_area->y >= cell_area->y && aligned_area->y <= cell_area->y + cell_area->height);
1724 g_assert ((aligned_area->x - cell_area->x) + aligned_area->width <= cell_area->width);
1725 g_assert ((aligned_area->y - cell_area->y) + aligned_area->height <= cell_area->height);
1729 * gtk_cell_renderer_get_state:
1730 * @cell: a #GtkCellRenderer, or %NULL
1731 * @widget: a #GtkWidget, or %NULL
1732 * @cell_state: cell renderer state
1734 * Translates the cell renderer state to #GtkStateFlags,
1735 * based on the cell renderer and widget sensitivity, and
1736 * the given #GtkCellRendererState.
1738 * Returns: the widget state flags applying to @cell
1743 gtk_cell_renderer_get_state (GtkCellRenderer *cell,
1745 GtkCellRendererState cell_state)
1747 GtkStateFlags state = 0;
1749 g_return_val_if_fail (!cell || GTK_IS_CELL_RENDERER (cell), 0);
1750 g_return_val_if_fail (!widget || GTK_IS_WIDGET (widget), 0);
1753 state |= gtk_widget_get_state_flags (widget);
1755 state &= ~(GTK_STATE_FLAG_FOCUSED | GTK_STATE_FLAG_PRELIGHT | GTK_STATE_FLAG_SELECTED);
1757 if ((state & GTK_STATE_FLAG_INSENSITIVE) != 0 ||
1758 (cell && !gtk_cell_renderer_get_sensitive (cell)) ||
1759 (cell_state & GTK_CELL_RENDERER_INSENSITIVE) != 0)
1761 state |= GTK_STATE_FLAG_INSENSITIVE;
1765 if ((widget && gtk_widget_has_focus (widget)) &&
1766 (cell_state & GTK_CELL_RENDERER_FOCUSED) != 0)
1767 state |= GTK_STATE_FLAG_FOCUSED;
1769 if ((cell_state & GTK_CELL_RENDERER_PRELIT) != 0)
1770 state |= GTK_STATE_FLAG_PRELIGHT;
1773 if ((cell_state & GTK_CELL_RENDERER_SELECTED) != 0)
1774 state |= GTK_STATE_FLAG_SELECTED;
1780 * _gtk_cell_renderer_class_set_accessible_type:
1781 * @renderer_class: class to set the accessible type for
1782 * @type: The object type that implements the accessible for @widget_class.
1783 * The type must be a subtype of #GtkRendererCellAccessible
1785 * Sets the type to be used for creating accessibles for cells rendered by
1786 * cell renderers of @renderer_class. Note that multiple accessibles will
1789 * This function should only be called from class init functions of cell
1793 _gtk_cell_renderer_class_set_accessible_type (GtkCellRendererClass *renderer_class,
1796 GtkCellRendererClassPrivate *priv;
1798 g_return_if_fail (GTK_IS_CELL_RENDERER_CLASS (renderer_class));
1799 g_return_if_fail (g_type_is_a (type, GTK_TYPE_RENDERER_CELL_ACCESSIBLE));
1801 priv = renderer_class->priv;
1803 priv->accessible_type = type;
1807 _gtk_cell_renderer_get_accessible_type (GtkCellRenderer *renderer)
1809 g_return_val_if_fail (GTK_IS_CELL_RENDERER (renderer), GTK_TYPE_RENDERER_CELL_ACCESSIBLE);
1811 return GTK_CELL_RENDERER_GET_CLASS (renderer)->priv->accessible_type;