<refentry id="GtkCellRenderer">
<refmeta>
<refentrytitle>GtkCellRenderer</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>GtkCellRenderer</refname><refpurpose></refpurpose>
</refnamediv>

<refsynopsisdiv><title>Synopsis</title>
<synopsis>

#include &lt;gtk/gtk.h&gt;


enum        <link linkend="GtkCellRendererState">GtkCellRendererState</link>;
enum        <link linkend="GtkCellRendererMode">GtkCellRendererMode</link>;
struct      <link linkend="GtkCellRenderer-struct">GtkCellRenderer</link>;
void        <link linkend="gtk-cell-renderer-get-size">gtk_cell_renderer_get_size</link>      (<link linkend="GtkCellRenderer">GtkCellRenderer</link> *cell,
                                             <link linkend="GtkWidget">GtkWidget</link> *widget,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *cell_area,
                                             <link linkend="gint">gint</link> *x_offset,
                                             <link linkend="gint">gint</link> *y_offset,
                                             <link linkend="gint">gint</link> *width,
                                             <link linkend="gint">gint</link> *height);
void        <link linkend="gtk-cell-renderer-render">gtk_cell_renderer_render</link>        (<link linkend="GtkCellRenderer">GtkCellRenderer</link> *cell,
                                             <link linkend="GdkWindow">GdkWindow</link> *window,
                                             <link linkend="GtkWidget">GtkWidget</link> *widget,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *background_area,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *cell_area,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *expose_area,
                                             <link linkend="GtkCellRendererState">GtkCellRendererState</link> flags);
<link linkend="gboolean">gboolean</link>    <link linkend="gtk-cell-renderer-activate">gtk_cell_renderer_activate</link>      (<link linkend="GtkCellRenderer">GtkCellRenderer</link> *cell,
                                             <link linkend="GdkEvent">GdkEvent</link> *event,
                                             <link linkend="GtkWidget">GtkWidget</link> *widget,
                                             const <link linkend="gchar">gchar</link> *path,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *background_area,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *cell_area,
                                             <link linkend="GtkCellRendererState">GtkCellRendererState</link> flags);
<link linkend="GtkCellEditable">GtkCellEditable</link>* <link linkend="gtk-cell-renderer-start-editing">gtk_cell_renderer_start_editing</link>
                                            (<link linkend="GtkCellRenderer">GtkCellRenderer</link> *cell,
                                             <link linkend="GdkEvent">GdkEvent</link> *event,
                                             <link linkend="GtkWidget">GtkWidget</link> *widget,
                                             const <link linkend="gchar">gchar</link> *path,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *background_area,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *cell_area,
                                             <link linkend="GtkCellRendererState">GtkCellRendererState</link> flags);
void        <link linkend="gtk-cell-renderer-get-fixed-size">gtk_cell_renderer_get_fixed_size</link>
                                            (<link linkend="GtkCellRenderer">GtkCellRenderer</link> *cell,
                                             <link linkend="gint">gint</link> *width,
                                             <link linkend="gint">gint</link> *height);
void        <link linkend="gtk-cell-renderer-set-fixed-size">gtk_cell_renderer_set_fixed_size</link>
                                            (<link linkend="GtkCellRenderer">GtkCellRenderer</link> *cell,
                                             <link linkend="gint">gint</link> width,
                                             <link linkend="gint">gint</link> height);


</synopsis>
</refsynopsisdiv>

<refsect1>
<title>Object Hierarchy</title>
<synopsis>

  <link linkend="GObject">GObject</link>
   +----<link linkend="GtkObject">GtkObject</link>
         +----GtkCellRenderer
</synopsis>

</refsect1>

<refsect1>
<title>Properties</title>
<synopsis>

  &quot;<link linkend="GtkCellRenderer--mode">mode</link>&quot;                 <link linkend="GtkCellRendererMode">GtkCellRendererMode</link>  : Read / Write
  &quot;<link linkend="GtkCellRenderer--visible">visible</link>&quot;              <link linkend="gboolean">gboolean</link>             : Read / Write
  &quot;<link linkend="GtkCellRenderer--xalign">xalign</link>&quot;               <link linkend="gfloat">gfloat</link>               : Read / Write
  &quot;<link linkend="GtkCellRenderer--yalign">yalign</link>&quot;               <link linkend="gfloat">gfloat</link>               : Read / Write
  &quot;<link linkend="GtkCellRenderer--xpad">xpad</link>&quot;                 <link linkend="guint">guint</link>                : Read / Write
  &quot;<link linkend="GtkCellRenderer--ypad">ypad</link>&quot;                 <link linkend="guint">guint</link>                : Read / Write
  &quot;<link linkend="GtkCellRenderer--width">width</link>&quot;                <link linkend="gint">gint</link>                 : Read / Write
  &quot;<link linkend="GtkCellRenderer--height">height</link>&quot;               <link linkend="gint">gint</link>                 : Read / Write
  &quot;<link linkend="GtkCellRenderer--is-expander">is-expander</link>&quot;          <link linkend="gboolean">gboolean</link>             : Read / Write
  &quot;<link linkend="GtkCellRenderer--is-expanded">is-expanded</link>&quot;          <link linkend="gboolean">gboolean</link>             : Read / Write
</synopsis>
</refsect1>



<refsect1>
<title>Description</title>
<para>

</para>
</refsect1>

<refsect1>
<title>Details</title>
<refsect2>
<title><anchor id="GtkCellRendererState">enum GtkCellRendererState</title>
<programlisting>typedef enum
{
  GTK_CELL_RENDERER_SELECTED    = 1 &lt;&lt; 0,
  GTK_CELL_RENDERER_PRELIT      = 1 &lt;&lt; 1,
  GTK_CELL_RENDERER_INSENSITIVE = 1 &lt;&lt; 2,
  /* this flag means the cell is in the sort column/row */
  GTK_CELL_RENDERER_SORTED      = 1 &lt;&lt; 3
} GtkCellRendererState;
</programlisting>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="GtkCellRendererMode">enum GtkCellRendererMode</title>
<programlisting>typedef enum
{
  GTK_CELL_RENDERER_MODE_INERT,
  GTK_CELL_RENDERER_MODE_ACTIVATABLE,
  GTK_CELL_RENDERER_MODE_EDITABLE
} GtkCellRendererMode;
</programlisting>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="GtkCellRenderer-struct">struct GtkCellRenderer</title>
<programlisting>struct GtkCellRenderer;</programlisting>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="gtk-cell-renderer-get-size">gtk_cell_renderer_get_size ()</title>
<programlisting>void        gtk_cell_renderer_get_size      (<link linkend="GtkCellRenderer">GtkCellRenderer</link> *cell,
                                             <link linkend="GtkWidget">GtkWidget</link> *widget,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *cell_area,
                                             <link linkend="gint">gint</link> *x_offset,
                                             <link linkend="gint">gint</link> *y_offset,
                                             <link linkend="gint">gint</link> *width,
                                             <link linkend="gint">gint</link> *height);</programlisting>
<para>
Obtains the width and height needed to render the cell. Used by view widgets
to determine the appropriate size for the cell_area passed to
<link linkend="gtk-cell-renderer-render">gtk_cell_renderer_render</link>().  If <parameter>cell_area</parameter> is not <literal>NULL</literal>, fills in the x and y
offsets (if set) of the cell relative to this location.  Please note that the
values set in <parameter>width</parameter> and <parameter>height</parameter>, as well as those in <parameter>x_offset</parameter> and <parameter>y_offset</parameter>
are inclusive of the xpad and ypad properties.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>cell</parameter>&nbsp;:</entry>
<entry> a <link linkend="GtkCellRenderer">GtkCellRenderer</link>
</entry></row>
<row><entry align="right"><parameter>widget</parameter>&nbsp;:</entry>
<entry> the widget the renderer is rendering to
</entry></row>
<row><entry align="right"><parameter>cell_area</parameter>&nbsp;:</entry>
<entry> The area a cell will be allocated, or <literal>NULL</literal>
</entry></row>
<row><entry align="right"><parameter>x_offset</parameter>&nbsp;:</entry>
<entry> location to return x offset of cell relative to <parameter>cell_area</parameter>, or <literal>NULL</literal>
</entry></row>
<row><entry align="right"><parameter>y_offset</parameter>&nbsp;:</entry>
<entry> location to return y offset of cell relative to <parameter>cell_area</parameter>, or <literal>NULL</literal>
</entry></row>
<row><entry align="right"><parameter>width</parameter>&nbsp;:</entry>
<entry> location to return width needed to render a cell, or <literal>NULL</literal>
</entry></row>
<row><entry align="right"><parameter>height</parameter>&nbsp;:</entry>
<entry> location to return height needed to render a cell, or <literal>NULL</literal>
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-cell-renderer-render">gtk_cell_renderer_render ()</title>
<programlisting>void        gtk_cell_renderer_render        (<link linkend="GtkCellRenderer">GtkCellRenderer</link> *cell,
                                             <link linkend="GdkWindow">GdkWindow</link> *window,
                                             <link linkend="GtkWidget">GtkWidget</link> *widget,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *background_area,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *cell_area,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *expose_area,
                                             <link linkend="GtkCellRendererState">GtkCellRendererState</link> flags);</programlisting>
<para>
Invokes the virtual render function of the <link linkend="GtkCellRenderer">GtkCellRenderer</link>. The three
passed-in rectangles are areas of <parameter>window</parameter>. Most renderers will draw within
<parameter>cell_area</parameter>; the xalign, yalign, xpad, and ypad fields of the <link linkend="GtkCellRenderer">GtkCellRenderer</link>
should be honored with respect to <parameter>cell_area</parameter>. <parameter>background_area</parameter> includes the
blank space around the cell, and also the area containing the tree expander;
so the <parameter>background_area</parameter> rectangles for all cells tile to cover the entire
<parameter>window</parameter>.  <parameter>expose_area</parameter> is a clip rectangle.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>cell</parameter>&nbsp;:</entry>
<entry> a <link linkend="GtkCellRenderer">GtkCellRenderer</link>
</entry></row>
<row><entry align="right"><parameter>window</parameter>&nbsp;:</entry>
<entry> a <link linkend="GdkDrawable">GdkDrawable</link> to draw to
</entry></row>
<row><entry align="right"><parameter>widget</parameter>&nbsp;:</entry>
<entry> the widget owning <parameter>window</parameter>
</entry></row>
<row><entry align="right"><parameter>background_area</parameter>&nbsp;:</entry>
<entry> entire cell area (including tree expanders and maybe padding on the sides)
</entry></row>
<row><entry align="right"><parameter>cell_area</parameter>&nbsp;:</entry>
<entry> area normally rendered by a cell renderer
</entry></row>
<row><entry align="right"><parameter>expose_area</parameter>&nbsp;:</entry>
<entry> area that actually needs updating
</entry></row>
<row><entry align="right"><parameter>flags</parameter>&nbsp;:</entry>
<entry> flags that affect rendering
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-cell-renderer-activate">gtk_cell_renderer_activate ()</title>
<programlisting><link linkend="gboolean">gboolean</link>    gtk_cell_renderer_activate      (<link linkend="GtkCellRenderer">GtkCellRenderer</link> *cell,
                                             <link linkend="GdkEvent">GdkEvent</link> *event,
                                             <link linkend="GtkWidget">GtkWidget</link> *widget,
                                             const <link linkend="gchar">gchar</link> *path,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *background_area,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *cell_area,
                                             <link linkend="GtkCellRendererState">GtkCellRendererState</link> flags);</programlisting>
<para>
Passes an activate event to the cell renderer for possible processing.  Some
cell renderers may use events; for example, <link linkend="GtkCellRendererToggle">GtkCellRendererToggle</link> toggles
when it gets a mouse click.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>cell</parameter>&nbsp;:</entry>
<entry> a <link linkend="GtkCellRenderer">GtkCellRenderer</link>
</entry></row>
<row><entry align="right"><parameter>event</parameter>&nbsp;:</entry>
<entry> a <link linkend="GdkEvent">GdkEvent</link>
</entry></row>
<row><entry align="right"><parameter>widget</parameter>&nbsp;:</entry>
<entry> widget that received the event
</entry></row>
<row><entry align="right"><parameter>path</parameter>&nbsp;:</entry>
<entry> widget-dependent string representation of the event location; e.g. for <link linkend="GtkTreeView">GtkTreeView</link>, a string representation of <link linkend="GtkTreePath">GtkTreePath</link>
</entry></row>
<row><entry align="right"><parameter>background_area</parameter>&nbsp;:</entry>
<entry> background area as passed to <parameter>gtk_cell_renderer_render</parameter>
</entry></row>
<row><entry align="right"><parameter>cell_area</parameter>&nbsp;:</entry>
<entry> cell area as passed to <parameter>gtk_cell_renderer_render</parameter>
</entry></row>
<row><entry align="right"><parameter>flags</parameter>&nbsp;:</entry>
<entry> render flags
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> <literal>TRUE</literal> if the event was consumed/handled
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-cell-renderer-start-editing">gtk_cell_renderer_start_editing ()</title>
<programlisting><link linkend="GtkCellEditable">GtkCellEditable</link>* gtk_cell_renderer_start_editing
                                            (<link linkend="GtkCellRenderer">GtkCellRenderer</link> *cell,
                                             <link linkend="GdkEvent">GdkEvent</link> *event,
                                             <link linkend="GtkWidget">GtkWidget</link> *widget,
                                             const <link linkend="gchar">gchar</link> *path,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *background_area,
                                             <link linkend="GdkRectangle">GdkRectangle</link> *cell_area,
                                             <link linkend="GtkCellRendererState">GtkCellRendererState</link> flags);</programlisting>
<para>
Passes an activate event to the cell renderer for possible processing.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>cell</parameter>&nbsp;:</entry>
<entry> a <link linkend="GtkCellRenderer">GtkCellRenderer</link>
</entry></row>
<row><entry align="right"><parameter>event</parameter>&nbsp;:</entry>
<entry> a <link linkend="GdkEvent">GdkEvent</link>
</entry></row>
<row><entry align="right"><parameter>widget</parameter>&nbsp;:</entry>
<entry> widget that received the event
</entry></row>
<row><entry align="right"><parameter>path</parameter>&nbsp;:</entry>
<entry> widget-dependent string representation of the event location; e.g. for <link linkend="GtkTreeView">GtkTreeView</link>, a string representation of <link linkend="GtkTreePath">GtkTreePath</link>
</entry></row>
<row><entry align="right"><parameter>background_area</parameter>&nbsp;:</entry>
<entry> background area as passed to <parameter>gtk_cell_renderer_render</parameter>
</entry></row>
<row><entry align="right"><parameter>cell_area</parameter>&nbsp;:</entry>
<entry> cell area as passed to <parameter>gtk_cell_renderer_render</parameter>
</entry></row>
<row><entry align="right"><parameter>flags</parameter>&nbsp;:</entry>
<entry> render flags
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> A new <link linkend="GtkCellEditable">GtkCellEditable</link>, or <literal>NULL</literal>
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-cell-renderer-get-fixed-size">gtk_cell_renderer_get_fixed_size ()</title>
<programlisting>void        gtk_cell_renderer_get_fixed_size
                                            (<link linkend="GtkCellRenderer">GtkCellRenderer</link> *cell,
                                             <link linkend="gint">gint</link> *width,
                                             <link linkend="gint">gint</link> *height);</programlisting>
<para>
Fills in <parameter>width</parameter> and <parameter>height</parameter> with the appropriate size of <parameter>cell</parameter>.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>cell</parameter>&nbsp;:</entry>
<entry> A <link linkend="GtkCellRenderer">GtkCellRenderer</link>
</entry></row>
<row><entry align="right"><parameter>width</parameter>&nbsp;:</entry>
<entry> location to fill in with the fixed width of the widget, or <literal>NULL</literal>
</entry></row>
<row><entry align="right"><parameter>height</parameter>&nbsp;:</entry>
<entry> location to fill in with the fixed height of the widget, or <literal>NULL</literal>
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-cell-renderer-set-fixed-size">gtk_cell_renderer_set_fixed_size ()</title>
<programlisting>void        gtk_cell_renderer_set_fixed_size
                                            (<link linkend="GtkCellRenderer">GtkCellRenderer</link> *cell,
                                             <link linkend="gint">gint</link> width,
                                             <link linkend="gint">gint</link> height);</programlisting>
<para>
Sets the renderer size to be explicit, independent of the properties set.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>cell</parameter>&nbsp;:</entry>
<entry> A <link linkend="GtkCellRenderer">GtkCellRenderer</link>
</entry></row>
<row><entry align="right"><parameter>width</parameter>&nbsp;:</entry>
<entry> the width of the cell renderer, or -1
</entry></row>
<row><entry align="right"><parameter>height</parameter>&nbsp;:</entry>
<entry> the height of the cell renderer, or -1
</entry></row>
</tbody></tgroup></informaltable></refsect2>

</refsect1>
<refsect1>
<title>Properties</title>
<variablelist>
<varlistentry><term><anchor id="GtkCellRenderer--mode">&quot;<literal>mode</literal>&quot; (<link linkend="GtkCellRendererMode">GtkCellRendererMode</link> : Read / Write)</term>
<listitem>
<para>

</para></listitem></varlistentry>
<varlistentry><term><anchor id="GtkCellRenderer--visible">&quot;<literal>visible</literal>&quot; (<link linkend="gboolean">gboolean</link> : Read / Write)</term>
<listitem>
<para>

</para></listitem></varlistentry>
<varlistentry><term><anchor id="GtkCellRenderer--xalign">&quot;<literal>xalign</literal>&quot; (<link linkend="gfloat">gfloat</link> : Read / Write)</term>
<listitem>
<para>

</para></listitem></varlistentry>
<varlistentry><term><anchor id="GtkCellRenderer--yalign">&quot;<literal>yalign</literal>&quot; (<link linkend="gfloat">gfloat</link> : Read / Write)</term>
<listitem>
<para>

</para></listitem></varlistentry>
<varlistentry><term><anchor id="GtkCellRenderer--xpad">&quot;<literal>xpad</literal>&quot; (<link linkend="guint">guint</link> : Read / Write)</term>
<listitem>
<para>

</para></listitem></varlistentry>
<varlistentry><term><anchor id="GtkCellRenderer--ypad">&quot;<literal>ypad</literal>&quot; (<link linkend="guint">guint</link> : Read / Write)</term>
<listitem>
<para>

</para></listitem></varlistentry>
<varlistentry><term><anchor id="GtkCellRenderer--width">&quot;<literal>width</literal>&quot; (<link linkend="gint">gint</link> : Read / Write)</term>
<listitem>
<para>

</para></listitem></varlistentry>
<varlistentry><term><anchor id="GtkCellRenderer--height">&quot;<literal>height</literal>&quot; (<link linkend="gint">gint</link> : Read / Write)</term>
<listitem>
<para>

</para></listitem></varlistentry>
<varlistentry><term><anchor id="GtkCellRenderer--is-expander">&quot;<literal>is-expander</literal>&quot; (<link linkend="gboolean">gboolean</link> : Read / Write)</term>
<listitem>
<para>

</para></listitem></varlistentry>
<varlistentry><term><anchor id="GtkCellRenderer--is-expanded">&quot;<literal>is-expanded</literal>&quot; (<link linkend="gboolean">gboolean</link> : Read / Write)</term>
<listitem>
<para>

</para></listitem></varlistentry>

</variablelist>
</refsect1>




</refentry>
