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, see <http://www.gnu.org/licenses/>.
19 #include "gtkcellrenderer.h"
21 #include "gtkmarshalers.h"
22 #include "gtktypebuiltins.h"
23 #include "gtkprivate.h"
24 #include "gtktreeprivate.h"
25 #include "a11y/gtkrenderercellaccessible.h"
29 * SECTION:gtkcellrenderer
30 * @Short_description: An object for rendering a single cell
31 * @Title: GtkCellRenderer
32 * @See_also: #GtkCellRendererText, #GtkCellRendererPixbuf, #GtkCellRendererToggle
34 * The #GtkCellRenderer is a base class of a set of objects used for
35 * rendering a cell to a #cairo_t. These objects are used primarily by
36 * the #GtkTreeView widget, though they aren't tied to them in any
37 * specific way. It is worth noting that #GtkCellRenderer is not a
38 * #GtkWidget and cannot be treated as such.
40 * The primary use of a #GtkCellRenderer is for drawing a certain graphical
41 * elements on a #cairo_t. Typically, one cell renderer is used to
42 * draw many cells on the screen. To this extent, it isn't expected that a
43 * CellRenderer keep any permanent state around. Instead, any state is set
44 * just prior to use using #GObjects property system. Then, the
45 * cell is measured using gtk_cell_renderer_get_size(). Finally, the cell
46 * is rendered in the correct location using gtk_cell_renderer_render().
48 * There are a number of rules that must be followed when writing a new
49 * #GtkCellRenderer. First and foremost, its important that a certain set
50 * of properties will always yield a cell renderer of the same size,
51 * barring a #GtkStyle change. The #GtkCellRenderer also has a number of
52 * generic properties that are expected to be honored by all children.
54 * Beyond merely rendering a cell, cell renderers can optionally
55 * provide active user interface elements. A cell renderer can be
56 * <firstterm>activatable</firstterm> like #GtkCellRendererToggle,
57 * which toggles when it gets activated by a mouse click, or it can be
58 * <firstterm>editable</firstterm> like #GtkCellRendererText, which
59 * allows the user to edit the text using a #GtkEntry.
60 * To make a cell renderer activatable or editable, you have to
61 * implement the #GtkCellRendererClass.activate or
62 * #GtkCellRendererClass.start_editing virtual functions, respectively.
64 * Many properties of #GtkCellRenderer and its subclasses have a
65 * corresponding "set" property, e.g. "cell-background-set" corresponds
66 * to "cell-background". These "set" properties reflect whether a property
67 * has been set or not. You should not set them independently.
71 #define DEBUG_CELL_SIZE_REQUEST 0
73 static void gtk_cell_renderer_init (GtkCellRenderer *cell);
74 static void gtk_cell_renderer_class_init (GtkCellRendererClass *class);
75 static void gtk_cell_renderer_get_property (GObject *object,
79 static void gtk_cell_renderer_set_property (GObject *object,
83 static void set_cell_bg_color (GtkCellRenderer *cell,
86 /* Fallback GtkCellRenderer implementation to use remaining ->get_size() implementations */
87 static GtkSizeRequestMode gtk_cell_renderer_real_get_request_mode(GtkCellRenderer *cell);
88 static void gtk_cell_renderer_real_get_preferred_width (GtkCellRenderer *cell,
92 static void gtk_cell_renderer_real_get_preferred_height (GtkCellRenderer *cell,
96 static void gtk_cell_renderer_real_get_preferred_height_for_width(GtkCellRenderer *cell,
100 gint *natural_height);
101 static void gtk_cell_renderer_real_get_preferred_width_for_height(GtkCellRenderer *cell,
105 gint *natural_width);
106 static void gtk_cell_renderer_real_get_aligned_area (GtkCellRenderer *cell,
108 GtkCellRendererState flags,
109 const GdkRectangle *cell_area,
110 GdkRectangle *aligned_area);
113 struct _GtkCellRendererPrivate
126 guint is_expander : 1;
127 guint is_expanded : 1;
128 guint cell_background_set : 1;
132 GdkRGBA cell_background;
135 struct _GtkCellRendererClassPrivate
137 GType accessible_type;
153 PROP_CELL_BACKGROUND,
154 PROP_CELL_BACKGROUND_GDK,
155 PROP_CELL_BACKGROUND_RGBA,
156 PROP_CELL_BACKGROUND_SET,
167 static guint cell_renderer_signals[LAST_SIGNAL] = { 0 };
170 gtk_cell_renderer_init (GtkCellRenderer *cell)
172 GtkCellRendererPrivate *priv;
174 cell->priv = G_TYPE_INSTANCE_GET_PRIVATE (cell,
175 GTK_TYPE_CELL_RENDERER,
176 GtkCellRendererPrivate);
179 priv->mode = GTK_CELL_RENDERER_MODE_INERT;
180 priv->visible = TRUE;
187 priv->sensitive = TRUE;
188 priv->is_expander = FALSE;
189 priv->is_expanded = FALSE;
190 priv->editing = FALSE;
194 gtk_cell_renderer_class_init (GtkCellRendererClass *class)
196 GObjectClass *object_class = G_OBJECT_CLASS (class);
198 object_class->get_property = gtk_cell_renderer_get_property;
199 object_class->set_property = gtk_cell_renderer_set_property;
201 class->render = NULL;
202 class->get_size = NULL;
203 class->get_request_mode = gtk_cell_renderer_real_get_request_mode;
204 class->get_preferred_width = gtk_cell_renderer_real_get_preferred_width;
205 class->get_preferred_height = gtk_cell_renderer_real_get_preferred_height;
206 class->get_preferred_width_for_height = gtk_cell_renderer_real_get_preferred_width_for_height;
207 class->get_preferred_height_for_width = gtk_cell_renderer_real_get_preferred_height_for_width;
208 class->get_aligned_area = gtk_cell_renderer_real_get_aligned_area;
211 * GtkCellRenderer::editing-canceled:
212 * @renderer: the object which received the signal
214 * This signal gets emitted when the user cancels the process of editing a
215 * cell. For example, an editable cell renderer could be written to cancel
216 * editing when the user presses Escape.
218 * See also: gtk_cell_renderer_stop_editing().
222 cell_renderer_signals[EDITING_CANCELED] =
223 g_signal_new (I_("editing-canceled"),
224 G_OBJECT_CLASS_TYPE (object_class),
226 G_STRUCT_OFFSET (GtkCellRendererClass, editing_canceled),
228 _gtk_marshal_VOID__VOID,
232 * GtkCellRenderer::editing-started:
233 * @renderer: the object which received the signal
234 * @editable: the #GtkCellEditable
235 * @path: the path identifying the edited cell
237 * This signal gets emitted when a cell starts to be edited.
238 * The intended use of this signal is to do special setup
239 * on @editable, e.g. adding a #GtkEntryCompletion or setting
240 * up additional columns in a #GtkComboBox.
242 * Note that GTK+ doesn't guarantee that cell renderers will
243 * continue to use the same kind of widget for editing in future
244 * releases, therefore you should check the type of @editable
245 * before doing any specific setup, as in the following example:
248 * text_editing_started (GtkCellRenderer *cell,
249 * GtkCellEditable *editable,
253 * if (GTK_IS_ENTRY (editable))
255 * GtkEntry *entry = GTK_ENTRY (editable);
257 * /* ... create a GtkEntryCompletion */
259 * gtk_entry_set_completion (entry, completion);
266 cell_renderer_signals[EDITING_STARTED] =
267 g_signal_new (I_("editing-started"),
268 G_OBJECT_CLASS_TYPE (object_class),
270 G_STRUCT_OFFSET (GtkCellRendererClass, editing_started),
272 _gtk_marshal_VOID__OBJECT_STRING,
274 GTK_TYPE_CELL_EDITABLE,
277 g_object_class_install_property (object_class,
279 g_param_spec_enum ("mode",
281 P_("Editable mode of the CellRenderer"),
282 GTK_TYPE_CELL_RENDERER_MODE,
283 GTK_CELL_RENDERER_MODE_INERT,
284 GTK_PARAM_READWRITE));
286 g_object_class_install_property (object_class,
288 g_param_spec_boolean ("visible",
290 P_("Display the cell"),
292 GTK_PARAM_READWRITE));
293 g_object_class_install_property (object_class,
295 g_param_spec_boolean ("sensitive",
297 P_("Display the cell sensitive"),
299 GTK_PARAM_READWRITE));
301 g_object_class_install_property (object_class,
303 g_param_spec_float ("xalign",
309 GTK_PARAM_READWRITE));
311 g_object_class_install_property (object_class,
313 g_param_spec_float ("yalign",
319 GTK_PARAM_READWRITE));
321 g_object_class_install_property (object_class,
323 g_param_spec_uint ("xpad",
329 GTK_PARAM_READWRITE));
331 g_object_class_install_property (object_class,
333 g_param_spec_uint ("ypad",
339 GTK_PARAM_READWRITE));
341 g_object_class_install_property (object_class,
343 g_param_spec_int ("width",
345 P_("The fixed width"),
349 GTK_PARAM_READWRITE));
351 g_object_class_install_property (object_class,
353 g_param_spec_int ("height",
355 P_("The fixed height"),
359 GTK_PARAM_READWRITE));
361 g_object_class_install_property (object_class,
363 g_param_spec_boolean ("is-expander",
365 P_("Row has children"),
367 GTK_PARAM_READWRITE));
370 g_object_class_install_property (object_class,
372 g_param_spec_boolean ("is-expanded",
374 P_("Row is an expander row, and is expanded"),
376 GTK_PARAM_READWRITE));
378 g_object_class_install_property (object_class,
379 PROP_CELL_BACKGROUND,
380 g_param_spec_string ("cell-background",
381 P_("Cell background color name"),
382 P_("Cell background color as a string"),
384 GTK_PARAM_WRITABLE));
387 * GtkCellRenderer:cell-background-gdk:
389 * Cell background as a #GdkColor
391 * Deprecated: 3.4: Use #GtkCellRenderer:cell-background-rgba instead.
393 g_object_class_install_property (object_class,
394 PROP_CELL_BACKGROUND_GDK,
395 g_param_spec_boxed ("cell-background-gdk",
396 P_("Cell background color"),
397 P_("Cell background color as a GdkColor"),
399 GTK_PARAM_READWRITE | G_PARAM_DEPRECATED));
401 * GtkCellRenderer:cell-background-rgba:
403 * Cell background as a #GdkRGBA
407 g_object_class_install_property (object_class,
408 PROP_CELL_BACKGROUND_RGBA,
409 g_param_spec_boxed ("cell-background-rgba",
410 P_("Cell background RGBA color"),
411 P_("Cell background color as a GdkRGBA"),
413 GTK_PARAM_READWRITE));
415 g_object_class_install_property (object_class,
417 g_param_spec_boolean ("editing",
419 P_("Whether the cell renderer is currently in editing mode"),
421 GTK_PARAM_READABLE));
424 #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))
426 ADD_SET_PROP ("cell-background-set", PROP_CELL_BACKGROUND_SET,
427 P_("Cell background set"),
428 P_("Whether the cell background color is set"));
430 g_type_class_add_private (class, sizeof (GtkCellRendererPrivate));
432 _gtk_cell_renderer_class_set_accessible_type (class, GTK_TYPE_RENDERER_CELL_ACCESSIBLE);
436 gtk_cell_renderer_base_class_init (gpointer g_class)
438 GtkCellRendererClass *klass = g_class;
440 klass->priv = G_TYPE_CLASS_GET_PRIVATE (g_class, GTK_TYPE_CELL_RENDERER, GtkCellRendererClassPrivate);
444 gtk_cell_renderer_get_type (void)
446 static GType cell_renderer_type = 0;
448 if (G_UNLIKELY (cell_renderer_type == 0))
450 const GTypeInfo cell_renderer_info =
452 sizeof (GtkCellRendererClass),
453 gtk_cell_renderer_base_class_init,
455 (GClassInitFunc) gtk_cell_renderer_class_init,
456 NULL, /* class_finalize */
457 NULL, /* class_init */
460 (GInstanceInitFunc) gtk_cell_renderer_init,
461 NULL, /* value_table */
463 cell_renderer_type = g_type_register_static (G_TYPE_INITIALLY_UNOWNED, "GtkCellRenderer",
464 &cell_renderer_info, G_TYPE_FLAG_ABSTRACT);
466 g_type_add_class_private (cell_renderer_type, sizeof (GtkCellRendererClassPrivate));
469 return cell_renderer_type;
473 gtk_cell_renderer_get_property (GObject *object,
478 GtkCellRenderer *cell = GTK_CELL_RENDERER (object);
479 GtkCellRendererPrivate *priv = cell->priv;
484 g_value_set_enum (value, priv->mode);
487 g_value_set_boolean (value, priv->visible);
490 g_value_set_boolean (value, priv->sensitive);
493 g_value_set_boolean (value, priv->editing);
496 g_value_set_float (value, priv->xalign);
499 g_value_set_float (value, priv->yalign);
502 g_value_set_uint (value, priv->xpad);
505 g_value_set_uint (value, priv->ypad);
508 g_value_set_int (value, priv->width);
511 g_value_set_int (value, priv->height);
513 case PROP_IS_EXPANDER:
514 g_value_set_boolean (value, priv->is_expander);
516 case PROP_IS_EXPANDED:
517 g_value_set_boolean (value, priv->is_expanded);
519 case PROP_CELL_BACKGROUND_GDK:
523 color.red = (guint16) (priv->cell_background.red * 65535);
524 color.green = (guint16) (priv->cell_background.green * 65535);
525 color.blue = (guint16) (priv->cell_background.blue * 65535);
527 g_value_set_boxed (value, &color);
530 case PROP_CELL_BACKGROUND_RGBA:
531 g_value_set_boxed (value, &priv->cell_background);
533 case PROP_CELL_BACKGROUND_SET:
534 g_value_set_boolean (value, priv->cell_background_set);
536 case PROP_CELL_BACKGROUND:
538 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
545 gtk_cell_renderer_set_property (GObject *object,
550 GtkCellRenderer *cell = GTK_CELL_RENDERER (object);
551 GtkCellRendererPrivate *priv = cell->priv;
556 priv->mode = g_value_get_enum (value);
559 priv->visible = g_value_get_boolean (value);
562 priv->sensitive = g_value_get_boolean (value);
565 priv->editing = g_value_get_boolean (value);
568 priv->xalign = g_value_get_float (value);
571 priv->yalign = g_value_get_float (value);
574 priv->xpad = g_value_get_uint (value);
577 priv->ypad = g_value_get_uint (value);
580 priv->width = g_value_get_int (value);
583 priv->height = g_value_get_int (value);
585 case PROP_IS_EXPANDER:
586 priv->is_expander = g_value_get_boolean (value);
588 case PROP_IS_EXPANDED:
589 priv->is_expanded = g_value_get_boolean (value);
591 case PROP_CELL_BACKGROUND:
595 if (!g_value_get_string (value))
596 set_cell_bg_color (cell, NULL);
597 else if (gdk_rgba_parse (&rgba, g_value_get_string (value)))
598 set_cell_bg_color (cell, &rgba);
600 g_warning ("Don't know color `%s'", g_value_get_string (value));
602 g_object_notify (object, "cell-background-gdk");
605 case PROP_CELL_BACKGROUND_GDK:
609 color = g_value_get_boxed (value);
614 rgba.red = color->red / 65535.;
615 rgba.green = color->green / 65535.;
616 rgba.blue = color->blue / 65535.;
619 set_cell_bg_color (cell, &rgba);
623 set_cell_bg_color (cell, NULL);
627 case PROP_CELL_BACKGROUND_RGBA:
628 set_cell_bg_color (cell, g_value_get_boxed (value));
630 case PROP_CELL_BACKGROUND_SET:
631 priv->cell_background_set = g_value_get_boolean (value);
634 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
640 set_cell_bg_color (GtkCellRenderer *cell,
643 GtkCellRendererPrivate *priv = cell->priv;
647 if (!priv->cell_background_set)
649 priv->cell_background_set = TRUE;
650 g_object_notify (G_OBJECT (cell), "cell-background-set");
653 priv->cell_background = *rgba;
657 if (priv->cell_background_set)
659 priv->cell_background_set = FALSE;
660 g_object_notify (G_OBJECT (cell), "cell-background-set");
666 * gtk_cell_renderer_get_size:
667 * @cell: a #GtkCellRenderer
668 * @widget: the widget the renderer is rendering to
669 * @cell_area: (allow-none): The area a cell will be allocated, or %NULL
670 * @x_offset: (out) (allow-none): location to return x offset of cell relative to @cell_area, or %NULL
671 * @y_offset: (out) (allow-none): location to return y offset of cell relative to @cell_area, or %NULL
672 * @width: (out) (allow-none): location to return width needed to render a cell, or %NULL
673 * @height: (out) (allow-none): location to return height needed to render a cell, or %NULL
675 * Obtains the width and height needed to render the cell. Used by view
676 * widgets to determine the appropriate size for the cell_area passed to
677 * gtk_cell_renderer_render(). If @cell_area is not %NULL, fills in the
678 * x and y offsets (if set) of the cell relative to this location.
680 * Please note that the values set in @width and @height, as well as those
681 * in @x_offset and @y_offset are inclusive of the xpad and ypad properties.
684 * Deprecated: 3.0: Use gtk_cell_renderer_get_preferred_size() instead.
687 gtk_cell_renderer_get_size (GtkCellRenderer *cell,
689 const GdkRectangle *cell_area,
695 GtkRequisition request;
697 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
699 gtk_cell_renderer_get_preferred_size (cell, widget, &request, NULL);
702 *width = request.width;
705 *height = request.height;
708 _gtk_cell_renderer_calc_offset (cell, cell_area, gtk_widget_get_direction (widget),
709 request.width, request.height, x_offset, y_offset);
713 * gtk_cell_renderer_render:
714 * @cell: a #GtkCellRenderer
715 * @cr: a cairo context to draw to
716 * @widget: the widget owning @window
717 * @background_area: entire cell area (including tree expanders and maybe
718 * padding on the sides)
719 * @cell_area: area normally rendered by a cell renderer
720 * @flags: flags that affect rendering
722 * Invokes the virtual render function of the #GtkCellRenderer. The three
723 * passed-in rectangles are areas in @cr. Most renderers will draw within
724 * @cell_area; the xalign, yalign, xpad, and ypad fields of the #GtkCellRenderer
725 * should be honored with respect to @cell_area. @background_area includes the
726 * blank space around the cell, and also the area containing the tree expander;
727 * so the @background_area rectangles for all cells tile to cover the entire
731 gtk_cell_renderer_render (GtkCellRenderer *cell,
734 const GdkRectangle *background_area,
735 const GdkRectangle *cell_area,
736 GtkCellRendererState flags)
738 gboolean selected = FALSE;
739 GtkCellRendererPrivate *priv = cell->priv;
740 GtkStyleContext *context;
743 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
744 g_return_if_fail (GTK_CELL_RENDERER_GET_CLASS (cell)->render != NULL);
745 g_return_if_fail (cr != NULL);
747 selected = (flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED;
751 if (priv->cell_background_set && !selected)
753 gdk_cairo_rectangle (cr, background_area);
754 gdk_cairo_set_source_rgba (cr, &priv->cell_background);
758 gdk_cairo_rectangle (cr, background_area);
761 context = gtk_widget_get_style_context (widget);
763 gtk_style_context_save (context);
764 gtk_style_context_add_class (context, GTK_STYLE_CLASS_CELL);
766 state = gtk_cell_renderer_get_state (cell, widget, flags);
767 gtk_style_context_set_state (context, state);
769 GTK_CELL_RENDERER_GET_CLASS (cell)->render (cell,
775 gtk_style_context_restore (context);
780 * gtk_cell_renderer_activate:
781 * @cell: a #GtkCellRenderer
782 * @event: a #GdkEvent
783 * @widget: widget that received the event
784 * @path: widget-dependent string representation of the event location;
785 * e.g. for #GtkTreeView, a string representation of #GtkTreePath
786 * @background_area: background area as passed to gtk_cell_renderer_render()
787 * @cell_area: cell area as passed to gtk_cell_renderer_render()
788 * @flags: render flags
790 * Passes an activate event to the cell renderer for possible processing.
791 * Some cell renderers may use events; for example, #GtkCellRendererToggle
792 * toggles when it gets a mouse click.
794 * Return value: %TRUE if the event was consumed/handled
797 gtk_cell_renderer_activate (GtkCellRenderer *cell,
801 const GdkRectangle *background_area,
802 const GdkRectangle *cell_area,
803 GtkCellRendererState flags)
805 GtkCellRendererPrivate *priv;
807 g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE);
811 if (priv->mode != GTK_CELL_RENDERER_MODE_ACTIVATABLE)
814 if (GTK_CELL_RENDERER_GET_CLASS (cell)->activate == NULL)
817 return GTK_CELL_RENDERER_GET_CLASS (cell)->activate (cell,
821 (GdkRectangle *) background_area,
822 (GdkRectangle *) cell_area,
827 * gtk_cell_renderer_start_editing:
828 * @cell: a #GtkCellRenderer
829 * @event: a #GdkEvent
830 * @widget: widget that received the event
831 * @path: widget-dependent string representation of the event location;
832 * e.g. for #GtkTreeView, a string representation of #GtkTreePath
833 * @background_area: background area as passed to gtk_cell_renderer_render()
834 * @cell_area: cell area as passed to gtk_cell_renderer_render()
835 * @flags: render flags
837 * Passes an activate event to the cell renderer for possible processing.
839 * Return value: (transfer none): A new #GtkCellEditable, or %NULL
842 gtk_cell_renderer_start_editing (GtkCellRenderer *cell,
846 const GdkRectangle *background_area,
847 const GdkRectangle *cell_area,
848 GtkCellRendererState flags)
851 GtkCellRendererPrivate *priv;
852 GtkCellEditable *editable;
854 g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), NULL);
858 if (priv->mode != GTK_CELL_RENDERER_MODE_EDITABLE)
861 if (GTK_CELL_RENDERER_GET_CLASS (cell)->start_editing == NULL)
864 editable = GTK_CELL_RENDERER_GET_CLASS (cell)->start_editing (cell,
868 (GdkRectangle *) background_area,
869 (GdkRectangle *) cell_area,
871 gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (editable)),
872 GTK_STYLE_CLASS_CELL);
875 cell_renderer_signals[EDITING_STARTED], 0,
878 priv->editing = TRUE;
884 * gtk_cell_renderer_set_fixed_size:
885 * @cell: A #GtkCellRenderer
886 * @width: the width of the cell renderer, or -1
887 * @height: the height of the cell renderer, or -1
889 * Sets the renderer size to be explicit, independent of the properties set.
892 gtk_cell_renderer_set_fixed_size (GtkCellRenderer *cell,
896 GtkCellRendererPrivate *priv;
898 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
899 g_return_if_fail (width >= -1 && height >= -1);
903 if ((width != priv->width) || (height != priv->height))
905 g_object_freeze_notify (G_OBJECT (cell));
907 if (width != priv->width)
910 g_object_notify (G_OBJECT (cell), "width");
913 if (height != priv->height)
915 priv->height = height;
916 g_object_notify (G_OBJECT (cell), "height");
919 g_object_thaw_notify (G_OBJECT (cell));
924 * gtk_cell_renderer_get_fixed_size:
925 * @cell: A #GtkCellRenderer
926 * @width: (out) (allow-none): location to fill in with the fixed width of the cell, or %NULL
927 * @height: (out) (allow-none): location to fill in with the fixed height of the cell, or %NULL
929 * Fills in @width and @height with the appropriate size of @cell.
932 gtk_cell_renderer_get_fixed_size (GtkCellRenderer *cell,
936 GtkCellRendererPrivate *priv;
938 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
943 *width = priv->width;
945 *height = priv->height;
949 * gtk_cell_renderer_set_alignment:
950 * @cell: A #GtkCellRenderer
951 * @xalign: the x alignment of the cell renderer
952 * @yalign: the y alignment of the cell renderer
954 * Sets the renderer's alignment within its available space.
959 gtk_cell_renderer_set_alignment (GtkCellRenderer *cell,
963 GtkCellRendererPrivate *priv;
965 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
966 g_return_if_fail (xalign >= 0.0 && xalign <= 1.0);
967 g_return_if_fail (yalign >= 0.0 && yalign <= 1.0);
971 if ((xalign != priv->xalign) || (yalign != priv->yalign))
973 g_object_freeze_notify (G_OBJECT (cell));
975 if (xalign != priv->xalign)
977 priv->xalign = xalign;
978 g_object_notify (G_OBJECT (cell), "xalign");
981 if (yalign != priv->yalign)
983 priv->yalign = yalign;
984 g_object_notify (G_OBJECT (cell), "yalign");
987 g_object_thaw_notify (G_OBJECT (cell));
992 * gtk_cell_renderer_get_alignment:
993 * @cell: A #GtkCellRenderer
994 * @xalign: (out) (allow-none): location to fill in with the x alignment of the cell, or %NULL
995 * @yalign: (out) (allow-none): location to fill in with the y alignment of the cell, or %NULL
997 * Fills in @xalign and @yalign with the appropriate values of @cell.
1002 gtk_cell_renderer_get_alignment (GtkCellRenderer *cell,
1006 GtkCellRendererPrivate *priv;
1008 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1013 *xalign = priv->xalign;
1015 *yalign = priv->yalign;
1019 * gtk_cell_renderer_set_padding:
1020 * @cell: A #GtkCellRenderer
1021 * @xpad: the x padding of the cell renderer
1022 * @ypad: the y padding of the cell renderer
1024 * Sets the renderer's padding.
1029 gtk_cell_renderer_set_padding (GtkCellRenderer *cell,
1033 GtkCellRendererPrivate *priv;
1035 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1036 g_return_if_fail (xpad >= 0 && xpad >= 0);
1040 if ((xpad != priv->xpad) || (ypad != priv->ypad))
1042 g_object_freeze_notify (G_OBJECT (cell));
1044 if (xpad != priv->xpad)
1047 g_object_notify (G_OBJECT (cell), "xpad");
1050 if (ypad != priv->ypad)
1053 g_object_notify (G_OBJECT (cell), "ypad");
1056 g_object_thaw_notify (G_OBJECT (cell));
1061 * gtk_cell_renderer_get_padding:
1062 * @cell: A #GtkCellRenderer
1063 * @xpad: (out) (allow-none): location to fill in with the x padding of the cell, or %NULL
1064 * @ypad: (out) (allow-none): location to fill in with the y padding of the cell, or %NULL
1066 * Fills in @xpad and @ypad with the appropriate values of @cell.
1071 gtk_cell_renderer_get_padding (GtkCellRenderer *cell,
1075 GtkCellRendererPrivate *priv;
1077 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1088 * gtk_cell_renderer_set_visible:
1089 * @cell: A #GtkCellRenderer
1090 * @visible: the visibility of the cell
1092 * Sets the cell renderer's visibility.
1097 gtk_cell_renderer_set_visible (GtkCellRenderer *cell,
1100 GtkCellRendererPrivate *priv;
1102 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1106 if (priv->visible != visible)
1108 priv->visible = visible ? TRUE : FALSE;
1109 g_object_notify (G_OBJECT (cell), "visible");
1114 * gtk_cell_renderer_get_visible:
1115 * @cell: A #GtkCellRenderer
1117 * Returns the cell renderer's visibility.
1119 * Returns: %TRUE if the cell renderer is visible
1124 gtk_cell_renderer_get_visible (GtkCellRenderer *cell)
1126 g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE);
1128 return cell->priv->visible;
1132 * gtk_cell_renderer_set_sensitive:
1133 * @cell: A #GtkCellRenderer
1134 * @sensitive: the sensitivity of the cell
1136 * Sets the cell renderer's sensitivity.
1141 gtk_cell_renderer_set_sensitive (GtkCellRenderer *cell,
1144 GtkCellRendererPrivate *priv;
1146 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1150 if (priv->sensitive != sensitive)
1152 priv->sensitive = sensitive ? TRUE : FALSE;
1153 g_object_notify (G_OBJECT (cell), "sensitive");
1158 * gtk_cell_renderer_get_sensitive:
1159 * @cell: A #GtkCellRenderer
1161 * Returns the cell renderer's sensitivity.
1163 * Returns: %TRUE if the cell renderer is sensitive
1168 gtk_cell_renderer_get_sensitive (GtkCellRenderer *cell)
1170 g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE);
1172 return cell->priv->sensitive;
1177 * gtk_cell_renderer_is_activatable:
1178 * @cell: A #GtkCellRenderer
1180 * Checks whether the cell renderer can do something when activated.
1182 * Returns: %TRUE if the cell renderer can do anything when activated
1187 gtk_cell_renderer_is_activatable (GtkCellRenderer *cell)
1189 GtkCellRendererPrivate *priv;
1191 g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE);
1195 return (priv->visible &&
1196 (priv->mode == GTK_CELL_RENDERER_MODE_EDITABLE ||
1197 priv->mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE));
1202 * gtk_cell_renderer_stop_editing:
1203 * @cell: A #GtkCellRenderer
1204 * @canceled: %TRUE if the editing has been canceled
1206 * Informs the cell renderer that the editing is stopped.
1207 * If @canceled is %TRUE, the cell renderer will emit the
1208 * #GtkCellRenderer::editing-canceled signal.
1210 * This function should be called by cell renderer implementations
1211 * in response to the #GtkCellEditable::editing-done signal of
1217 gtk_cell_renderer_stop_editing (GtkCellRenderer *cell,
1220 GtkCellRendererPrivate *priv;
1222 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1228 priv->editing = FALSE;
1230 g_signal_emit (cell, cell_renderer_signals[EDITING_CANCELED], 0);
1235 gtk_cell_renderer_real_get_preferred_size (GtkCellRenderer *cell,
1237 GtkOrientation orientation,
1241 GtkRequisition min_req;
1243 /* Fallback on the old API to get the size. */
1244 if (GTK_CELL_RENDERER_GET_CLASS (cell)->get_size)
1245 GTK_CELL_RENDERER_GET_CLASS (cell)->get_size (GTK_CELL_RENDERER (cell), widget, NULL, NULL, NULL,
1246 &min_req.width, &min_req.height);
1253 if (orientation == GTK_ORIENTATION_HORIZONTAL)
1256 *minimum_size = min_req.width;
1259 *natural_size = min_req.width;
1264 *minimum_size = min_req.height;
1267 *natural_size = min_req.height;
1271 static GtkSizeRequestMode
1272 gtk_cell_renderer_real_get_request_mode (GtkCellRenderer *cell)
1274 /* By default cell renderers are height-for-width. */
1275 return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
1279 gtk_cell_renderer_real_get_preferred_width (GtkCellRenderer *cell,
1284 gtk_cell_renderer_real_get_preferred_size (cell, widget, GTK_ORIENTATION_HORIZONTAL,
1285 minimum_size, natural_size);
1289 gtk_cell_renderer_real_get_preferred_height (GtkCellRenderer *cell,
1294 gtk_cell_renderer_real_get_preferred_size (cell, widget, GTK_ORIENTATION_VERTICAL,
1295 minimum_size, natural_size);
1300 gtk_cell_renderer_real_get_preferred_height_for_width (GtkCellRenderer *cell,
1303 gint *minimum_height,
1304 gint *natural_height)
1306 /* Fall back on the height reported from ->get_size() */
1307 gtk_cell_renderer_get_preferred_height (cell, widget, minimum_height, natural_height);
1311 gtk_cell_renderer_real_get_preferred_width_for_height (GtkCellRenderer *cell,
1314 gint *minimum_width,
1315 gint *natural_width)
1317 /* Fall back on the width reported from ->get_size() */
1318 gtk_cell_renderer_get_preferred_width (cell, widget, minimum_width, natural_width);
1322 /* Default implementation assumes that a cell renderer will never use more
1323 * space than its natural size (this is fine for toggles and pixbufs etc
1324 * but needs to be overridden from wrapping/ellipsizing text renderers) */
1326 gtk_cell_renderer_real_get_aligned_area (GtkCellRenderer *cell,
1328 GtkCellRendererState flags,
1329 const GdkRectangle *cell_area,
1330 GdkRectangle *aligned_area)
1332 gint opposite_size, x_offset, y_offset;
1335 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1336 g_return_if_fail (GTK_IS_WIDGET (widget));
1337 g_return_if_fail (cell_area != NULL);
1338 g_return_if_fail (aligned_area != NULL);
1340 *aligned_area = *cell_area;
1342 /* Trim up the aligned size */
1343 if (gtk_cell_renderer_get_request_mode (cell) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
1345 gtk_cell_renderer_get_preferred_width (cell, widget,
1346 NULL, &natural_size);
1348 aligned_area->width = MIN (aligned_area->width, natural_size);
1350 gtk_cell_renderer_get_preferred_height_for_width (cell, widget,
1351 aligned_area->width,
1352 NULL, &opposite_size);
1354 aligned_area->height = MIN (opposite_size, aligned_area->height);
1358 gtk_cell_renderer_get_preferred_height (cell, widget,
1359 NULL, &natural_size);
1361 aligned_area->height = MIN (aligned_area->width, natural_size);
1363 gtk_cell_renderer_get_preferred_width_for_height (cell, widget,
1364 aligned_area->height,
1365 NULL, &opposite_size);
1367 aligned_area->width = MIN (opposite_size, aligned_area->width);
1370 /* offset the cell position */
1371 _gtk_cell_renderer_calc_offset (cell, cell_area,
1372 gtk_widget_get_direction (widget),
1373 aligned_area->width,
1374 aligned_area->height,
1375 &x_offset, &y_offset);
1377 aligned_area->x += x_offset;
1378 aligned_area->y += y_offset;
1382 /* An internal convenience function for some containers to peek at the
1383 * cell alignment in a target allocation (used to draw focus and align
1384 * cells in the icon view).
1386 * Note this is only a trivial 'align * (allocation - request)' operation.
1389 _gtk_cell_renderer_calc_offset (GtkCellRenderer *cell,
1390 const GdkRectangle *cell_area,
1391 GtkTextDirection direction,
1397 GtkCellRendererPrivate *priv;
1399 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1400 g_return_if_fail (cell_area != NULL);
1401 g_return_if_fail (x_offset || y_offset);
1407 *x_offset = (((direction == GTK_TEXT_DIR_RTL) ?
1408 (1.0 - priv->xalign) : priv->xalign) *
1409 (cell_area->width - width));
1410 *x_offset = MAX (*x_offset, 0);
1414 *y_offset = (priv->yalign *
1415 (cell_area->height - height));
1416 *y_offset = MAX (*y_offset, 0);
1421 * gtk_cell_renderer_get_request_mode:
1422 * @cell: a #GtkCellRenderer instance
1424 * Gets whether the cell renderer prefers a height-for-width layout
1425 * or a width-for-height layout.
1427 * Returns: The #GtkSizeRequestMode preferred by this renderer.
1432 gtk_cell_renderer_get_request_mode (GtkCellRenderer *cell)
1434 g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE);
1436 return GTK_CELL_RENDERER_GET_CLASS (cell)->get_request_mode (cell);
1440 * gtk_cell_renderer_get_preferred_width:
1441 * @cell: a #GtkCellRenderer instance
1442 * @widget: the #GtkWidget this cell will be rendering to
1443 * @minimum_size: (out) (allow-none): location to store the minimum size, or %NULL
1444 * @natural_size: (out) (allow-none): location to store the natural size, or %NULL
1446 * Retreives a renderer's natural size when rendered to @widget.
1451 gtk_cell_renderer_get_preferred_width (GtkCellRenderer *cell,
1456 GtkCellRendererClass *klass;
1459 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1460 g_return_if_fail (GTK_IS_WIDGET (widget));
1461 g_return_if_fail (NULL != minimum_size || NULL != natural_size);
1463 gtk_cell_renderer_get_fixed_size (GTK_CELL_RENDERER (cell), &width, NULL);
1467 klass = GTK_CELL_RENDERER_GET_CLASS (cell);
1468 klass->get_preferred_width (cell, widget, minimum_size, natural_size);
1473 *minimum_size = width;
1475 *natural_size = width;
1478 #if DEBUG_CELL_SIZE_REQUEST
1479 g_message ("%s returning minimum width: %d and natural width: %d",
1480 G_OBJECT_TYPE_NAME (cell),
1481 minimum_size ? *minimum_size : 20000,
1482 natural_size ? *natural_size : 20000);
1488 * gtk_cell_renderer_get_preferred_height:
1489 * @cell: a #GtkCellRenderer instance
1490 * @widget: the #GtkWidget this cell will be rendering to
1491 * @minimum_size: (out) (allow-none): location to store the minimum size, or %NULL
1492 * @natural_size: (out) (allow-none): location to store the natural size, or %NULL
1494 * Retreives a renderer's natural size when rendered to @widget.
1499 gtk_cell_renderer_get_preferred_height (GtkCellRenderer *cell,
1504 GtkCellRendererClass *klass;
1507 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1508 g_return_if_fail (GTK_IS_WIDGET (widget));
1509 g_return_if_fail (NULL != minimum_size || NULL != natural_size);
1511 gtk_cell_renderer_get_fixed_size (GTK_CELL_RENDERER (cell), NULL, &height);
1515 klass = GTK_CELL_RENDERER_GET_CLASS (cell);
1516 klass->get_preferred_height (cell, widget, minimum_size, natural_size);
1521 *minimum_size = height;
1523 *natural_size = height;
1526 #if DEBUG_CELL_SIZE_REQUEST
1527 g_message ("%s returning minimum height: %d and natural height: %d",
1528 G_OBJECT_TYPE_NAME (cell),
1529 minimum_size ? *minimum_size : 20000,
1530 natural_size ? *natural_size : 20000);
1536 * gtk_cell_renderer_get_preferred_width_for_height:
1537 * @cell: a #GtkCellRenderer instance
1538 * @widget: the #GtkWidget this cell will be rendering to
1539 * @height: the size which is available for allocation
1540 * @minimum_width: (out) (allow-none): location for storing the minimum size, or %NULL
1541 * @natural_width: (out) (allow-none): location for storing the preferred size, or %NULL
1543 * Retreives a cell renderers's minimum and natural width if it were rendered to
1544 * @widget with the specified @height.
1549 gtk_cell_renderer_get_preferred_width_for_height (GtkCellRenderer *cell,
1552 gint *minimum_width,
1553 gint *natural_width)
1555 GtkCellRendererClass *klass;
1558 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1559 g_return_if_fail (GTK_IS_WIDGET (widget));
1560 g_return_if_fail (NULL != minimum_width || NULL != natural_width);
1562 gtk_cell_renderer_get_fixed_size (GTK_CELL_RENDERER (cell), &width, NULL);
1566 klass = GTK_CELL_RENDERER_GET_CLASS (cell);
1567 klass->get_preferred_width_for_height (cell, widget, height, minimum_width, natural_width);
1572 *minimum_width = width;
1574 *natural_width = width;
1577 #if DEBUG_CELL_SIZE_REQUEST
1578 g_message ("%s width for height: %d is minimum %d and natural: %d",
1579 G_OBJECT_TYPE_NAME (cell), height,
1580 minimum_width ? *minimum_width : 20000,
1581 natural_width ? *natural_width : 20000);
1586 * gtk_cell_renderer_get_preferred_height_for_width:
1587 * @cell: a #GtkCellRenderer instance
1588 * @widget: the #GtkWidget this cell will be rendering to
1589 * @width: the size which is available for allocation
1590 * @minimum_height: (out) (allow-none): location for storing the minimum size, or %NULL
1591 * @natural_height: (out) (allow-none): location for storing the preferred size, or %NULL
1593 * Retreives a cell renderers's minimum and natural height if it were rendered to
1594 * @widget with the specified @width.
1599 gtk_cell_renderer_get_preferred_height_for_width (GtkCellRenderer *cell,
1602 gint *minimum_height,
1603 gint *natural_height)
1605 GtkCellRendererClass *klass;
1608 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1609 g_return_if_fail (GTK_IS_WIDGET (widget));
1610 g_return_if_fail (NULL != minimum_height || NULL != natural_height);
1612 gtk_cell_renderer_get_fixed_size (GTK_CELL_RENDERER (cell), NULL, &height);
1616 klass = GTK_CELL_RENDERER_GET_CLASS (cell);
1617 klass->get_preferred_height_for_width (cell, widget, width, minimum_height, natural_height);
1622 *minimum_height = height;
1624 *natural_height = height;
1627 #if DEBUG_CELL_SIZE_REQUEST
1628 g_message ("%s height for width: %d is minimum %d and natural: %d",
1629 G_OBJECT_TYPE_NAME (cell), width,
1630 minimum_height ? *minimum_height : 20000,
1631 natural_height ? *natural_height : 20000);
1636 * gtk_cell_renderer_get_preferred_size:
1637 * @cell: a #GtkCellRenderer instance
1638 * @widget: the #GtkWidget this cell will be rendering to
1639 * @minimum_size: (out) (allow-none): location for storing the minimum size, or %NULL
1640 * @natural_size: (out) (allow-none): location for storing the natural size, or %NULL
1642 * Retrieves the minimum and natural size of a cell taking
1643 * into account the widget's preference for height-for-width management.
1648 gtk_cell_renderer_get_preferred_size (GtkCellRenderer *cell,
1650 GtkRequisition *minimum_size,
1651 GtkRequisition *natural_size)
1653 gint min_width, nat_width;
1654 gint min_height, nat_height;
1656 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1658 if (gtk_cell_renderer_get_request_mode (cell) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
1660 gtk_cell_renderer_get_preferred_width (cell, widget, &min_width, &nat_width);
1664 minimum_size->width = min_width;
1665 gtk_cell_renderer_get_preferred_height_for_width (cell, widget, min_width,
1666 &minimum_size->height, NULL);
1671 natural_size->width = nat_width;
1672 gtk_cell_renderer_get_preferred_height_for_width (cell, widget, nat_width,
1673 NULL, &natural_size->height);
1676 else /* GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT */
1678 gtk_cell_renderer_get_preferred_height (cell, widget, &min_height, &nat_height);
1682 minimum_size->height = min_height;
1683 gtk_cell_renderer_get_preferred_width_for_height (cell, widget, min_height,
1684 &minimum_size->width, NULL);
1689 natural_size->height = nat_height;
1690 gtk_cell_renderer_get_preferred_width_for_height (cell, widget, nat_height,
1691 NULL, &natural_size->width);
1697 * gtk_cell_renderer_get_aligned_area:
1698 * @cell: a #GtkCellRenderer instance
1699 * @widget: the #GtkWidget this cell will be rendering to
1700 * @flags: render flags
1701 * @cell_area: cell area which would be passed to gtk_cell_renderer_render()
1702 * @aligned_area: (out): the return location for the space inside @cell_area
1703 * that would acually be used to render.
1705 * Gets the aligned area used by @cell inside @cell_area. Used for finding
1706 * the appropriate edit and focus rectangle.
1711 gtk_cell_renderer_get_aligned_area (GtkCellRenderer *cell,
1713 GtkCellRendererState flags,
1714 const GdkRectangle *cell_area,
1715 GdkRectangle *aligned_area)
1717 GtkCellRendererClass *klass;
1719 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
1720 g_return_if_fail (GTK_IS_WIDGET (widget));
1721 g_return_if_fail (cell_area != NULL);
1722 g_return_if_fail (aligned_area != NULL);
1724 klass = GTK_CELL_RENDERER_GET_CLASS (cell);
1725 klass->get_aligned_area (cell, widget, flags, cell_area, aligned_area);
1727 g_assert (aligned_area->x >= cell_area->x && aligned_area->x <= cell_area->x + cell_area->width);
1728 g_assert (aligned_area->y >= cell_area->y && aligned_area->y <= cell_area->y + cell_area->height);
1729 g_assert ((aligned_area->x - cell_area->x) + aligned_area->width <= cell_area->width);
1730 g_assert ((aligned_area->y - cell_area->y) + aligned_area->height <= cell_area->height);
1734 * gtk_cell_renderer_get_state:
1735 * @cell: a #GtkCellRenderer, or %NULL
1736 * @widget: a #GtkWidget, or %NULL
1737 * @cell_state: cell renderer state
1739 * Translates the cell renderer state to #GtkStateFlags,
1740 * based on the cell renderer and widget sensitivity, and
1741 * the given #GtkCellRendererState.
1743 * Returns: the widget state flags applying to @cell
1748 gtk_cell_renderer_get_state (GtkCellRenderer *cell,
1750 GtkCellRendererState cell_state)
1752 GtkStateFlags state = 0;
1754 g_return_val_if_fail (!cell || GTK_IS_CELL_RENDERER (cell), 0);
1755 g_return_val_if_fail (!widget || GTK_IS_WIDGET (widget), 0);
1758 state |= gtk_widget_get_state_flags (widget);
1760 state &= ~(GTK_STATE_FLAG_FOCUSED | GTK_STATE_FLAG_PRELIGHT | GTK_STATE_FLAG_SELECTED);
1762 if ((state & GTK_STATE_FLAG_INSENSITIVE) != 0 ||
1763 (cell && !gtk_cell_renderer_get_sensitive (cell)) ||
1764 (cell_state & GTK_CELL_RENDERER_INSENSITIVE) != 0)
1766 state |= GTK_STATE_FLAG_INSENSITIVE;
1770 if ((widget && gtk_widget_has_focus (widget)) &&
1771 (cell_state & GTK_CELL_RENDERER_FOCUSED) != 0)
1772 state |= GTK_STATE_FLAG_FOCUSED;
1774 if ((cell_state & GTK_CELL_RENDERER_PRELIT) != 0)
1775 state |= GTK_STATE_FLAG_PRELIGHT;
1778 if ((cell_state & GTK_CELL_RENDERER_SELECTED) != 0)
1779 state |= GTK_STATE_FLAG_SELECTED;
1785 * _gtk_cell_renderer_class_set_accessible_type:
1786 * @renderer_class: class to set the accessible type for
1787 * @type: The object type that implements the accessible for @widget_class.
1788 * The type must be a subtype of #GtkRendererCellAccessible
1790 * Sets the type to be used for creating accessibles for cells rendered by
1791 * cell renderers of @renderer_class. Note that multiple accessibles will
1794 * This function should only be called from class init functions of cell
1798 _gtk_cell_renderer_class_set_accessible_type (GtkCellRendererClass *renderer_class,
1801 GtkCellRendererClassPrivate *priv;
1803 g_return_if_fail (GTK_IS_CELL_RENDERER_CLASS (renderer_class));
1804 g_return_if_fail (g_type_is_a (type, GTK_TYPE_RENDERER_CELL_ACCESSIBLE));
1806 priv = renderer_class->priv;
1808 priv->accessible_type = type;
1812 _gtk_cell_renderer_get_accessible_type (GtkCellRenderer *renderer)
1814 g_return_val_if_fail (GTK_IS_CELL_RENDERER (renderer), GTK_TYPE_RENDERER_CELL_ACCESSIBLE);
1816 return GTK_CELL_RENDERER_GET_CLASS (renderer)->priv->accessible_type;