<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
<!ENTITY pi "&#960;">
<!ENTITY solidus "&#8260;">
]>
<refentry id="GtkCellRendererToggle">
<refmeta>
<refentrytitle role="top_of_page" id="GtkCellRendererToggle.top_of_page">GtkCellRendererToggle</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK4 Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>GtkCellRendererToggle</refname>
<refpurpose>Renders a toggle button in a cell</refpurpose>
</refnamediv>

<refsect1 id="GtkCellRendererToggle.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_proto_type" colwidth="150px"/>
<colspec colname="functions_proto_name"/>
<tbody>
<row><entry role="function_type"><link linkend="GtkCellRenderer"><returnvalue>GtkCellRenderer</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-cell-renderer-toggle-new">gtk_cell_renderer_toggle_new</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-cell-renderer-toggle-get-radio">gtk_cell_renderer_toggle_get_radio</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-cell-renderer-toggle-set-radio">gtk_cell_renderer_toggle_set_radio</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-cell-renderer-toggle-get-active">gtk_cell_renderer_toggle_get_active</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-cell-renderer-toggle-set-active">gtk_cell_renderer_toggle_set_active</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-cell-renderer-toggle-get-activatable">gtk_cell_renderer_toggle_get_activatable</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-cell-renderer-toggle-set-activatable">gtk_cell_renderer_toggle_set_activatable</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkCellRendererToggle.properties" role="properties">
<title role="properties.title">Properties</title>
<informaltable frame="none">
<tgroup cols="3">
<colspec colname="properties_type" colwidth="150px"/>
<colspec colname="properties_name" colwidth="300px"/>
<colspec colname="properties_flags" colwidth="200px"/>
<tbody>
<row><entry role="property_type"><link linkend="gboolean"><type>gboolean</type></link></entry><entry role="property_name"><link linkend="GtkCellRendererToggle--activatable">activatable</link></entry><entry role="property_flags">Read / Write</entry></row>
<row><entry role="property_type"><link linkend="gboolean"><type>gboolean</type></link></entry><entry role="property_name"><link linkend="GtkCellRendererToggle--active">active</link></entry><entry role="property_flags">Read / Write</entry></row>
<row><entry role="property_type"><link linkend="gboolean"><type>gboolean</type></link></entry><entry role="property_name"><link linkend="GtkCellRendererToggle--inconsistent">inconsistent</link></entry><entry role="property_flags">Read / Write</entry></row>
<row><entry role="property_type"><link linkend="gboolean"><type>gboolean</type></link></entry><entry role="property_name"><link linkend="GtkCellRendererToggle--radio">radio</link></entry><entry role="property_flags">Read / Write</entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkCellRendererToggle.signals" role="signal_proto">
<title role="signal_proto.title">Signals</title>
<informaltable frame="none">
<tgroup cols="3">
<colspec colname="signal_proto_type" colwidth="150px"/>
<colspec colname="signal_proto_name" colwidth="300px"/>
<colspec colname="signal_proto_flags" colwidth="200px"/>
<tbody>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkCellRendererToggle-toggled">toggled</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkCellRendererToggle.other" role="other_proto">
<title role="other_proto.title">Types and Values</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="other_proto_type" colwidth="150px"/>
<colspec colname="other_proto_name"/>
<tbody>
<row><entry role="datatype_keyword"></entry><entry role="function_name"><link linkend="GtkCellRendererToggle-struct">GtkCellRendererToggle</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkCellRendererToggle.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<screen>    <link linkend="GObject">GObject</link>
    <phrase role="lineart">&#9584;&#9472;&#9472;</phrase> <link linkend="GInitiallyUnowned">GInitiallyUnowned</link>
        <phrase role="lineart">&#9584;&#9472;&#9472;</phrase> <link linkend="GtkCellRenderer">GtkCellRenderer</link>
            <phrase role="lineart">&#9584;&#9472;&#9472;</phrase> GtkCellRendererToggle
</screen>
</refsect1>

<refsect1 id="GtkCellRendererToggle.includes"><title>Includes</title><synopsis>#include &lt;gtk/gtk.h&gt;
</synopsis></refsect1>

<refsect1 id="GtkCellRendererToggle.description" role="desc">
<title role="desc.title">Description</title>
<para><link linkend="GtkCellRendererToggle"><type>GtkCellRendererToggle</type></link> renders a toggle button in a cell. The
button is drawn as a radio or a checkbutton, depending on the
<link linkend="GtkCellRendererToggle--radio"><type>“radio”</type></link> property.
When activated, it emits the <link linkend="GtkCellRendererToggle-toggled"><type>“toggled”</type></link> signal.</para>

</refsect1>
<refsect1 id="GtkCellRendererToggle.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="gtk-cell-renderer-toggle-new" role="function">
<title>gtk_cell_renderer_toggle_new&#160;()</title>
<indexterm zone="gtk-cell-renderer-toggle-new"><primary>gtk_cell_renderer_toggle_new</primary></indexterm>
<programlisting language="C"><link linkend="GtkCellRenderer"><returnvalue>GtkCellRenderer</returnvalue></link>&#160;*
gtk_cell_renderer_toggle_new (<parameter><type>void</type></parameter>);</programlisting>
<para>Creates a new <link linkend="GtkCellRendererToggle"><type>GtkCellRendererToggle</type></link>. Adjust rendering
parameters using object properties. Object properties can be set
globally (with <link linkend="g-object-set"><function>g_object_set()</function></link>). Also, with <link linkend="GtkTreeViewColumn"><type>GtkTreeViewColumn</type></link>, you
can bind a property to a value in a <link linkend="GtkTreeModel"><type>GtkTreeModel</type></link>. For example, you
can bind the “active” property on the cell renderer to a boolean value
in the model, thus causing the check button to reflect the state of
the model.</para>
<refsect3 id="gtk-cell-renderer-toggle-new.returns" role="returns">
<title>Returns</title>
<para> the new cell renderer</para>
</refsect3></refsect2>
<refsect2 id="gtk-cell-renderer-toggle-get-radio" role="function">
<title>gtk_cell_renderer_toggle_get_radio&#160;()</title>
<indexterm zone="gtk-cell-renderer-toggle-get-radio"><primary>gtk_cell_renderer_toggle_get_radio</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gtk_cell_renderer_toggle_get_radio (<parameter><link linkend="GtkCellRendererToggle"><type>GtkCellRendererToggle</type></link> *toggle</parameter>);</programlisting>
<para>Returns whether we’re rendering radio toggles rather than checkboxes.</para>
<refsect3 id="gtk-cell-renderer-toggle-get-radio.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>toggle</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkCellRendererToggle"><type>GtkCellRendererToggle</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-cell-renderer-toggle-get-radio.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if we’re rendering radio toggles rather than checkboxes</para>
</refsect3></refsect2>
<refsect2 id="gtk-cell-renderer-toggle-set-radio" role="function">
<title>gtk_cell_renderer_toggle_set_radio&#160;()</title>
<indexterm zone="gtk-cell-renderer-toggle-set-radio"><primary>gtk_cell_renderer_toggle_set_radio</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_cell_renderer_toggle_set_radio (<parameter><link linkend="GtkCellRendererToggle"><type>GtkCellRendererToggle</type></link> *toggle</parameter>,
                                    <parameter><link linkend="gboolean"><type>gboolean</type></link> radio</parameter>);</programlisting>
<para>If <parameter>radio</parameter>
 is <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, the cell renderer renders a radio toggle
(i.e. a toggle in a group of mutually-exclusive toggles).
If <link linkend="FALSE:CAPS"><literal>FALSE</literal></link>, it renders a check toggle (a standalone boolean option).
This can be set globally for the cell renderer, or changed just
before rendering each cell in the model (for <link linkend="GtkTreeView"><type>GtkTreeView</type></link>, you set
up a per-row setting using <link linkend="GtkTreeViewColumn"><type>GtkTreeViewColumn</type></link> to associate model
columns with cell renderer properties).</para>
<refsect3 id="gtk-cell-renderer-toggle-set-radio.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>toggle</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkCellRendererToggle"><type>GtkCellRendererToggle</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>radio</para></entry>
<entry role="parameter_description"><para><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> to make the toggle look like a radio button</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-cell-renderer-toggle-get-active" role="function">
<title>gtk_cell_renderer_toggle_get_active&#160;()</title>
<indexterm zone="gtk-cell-renderer-toggle-get-active"><primary>gtk_cell_renderer_toggle_get_active</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gtk_cell_renderer_toggle_get_active (<parameter><link linkend="GtkCellRendererToggle"><type>GtkCellRendererToggle</type></link> *toggle</parameter>);</programlisting>
<para>Returns whether the cell renderer is active. See
<link linkend="gtk-cell-renderer-toggle-set-active"><function>gtk_cell_renderer_toggle_set_active()</function></link>.</para>
<refsect3 id="gtk-cell-renderer-toggle-get-active.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>toggle</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkCellRendererToggle"><type>GtkCellRendererToggle</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-cell-renderer-toggle-get-active.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the cell renderer is active.</para>
</refsect3></refsect2>
<refsect2 id="gtk-cell-renderer-toggle-set-active" role="function">
<title>gtk_cell_renderer_toggle_set_active&#160;()</title>
<indexterm zone="gtk-cell-renderer-toggle-set-active"><primary>gtk_cell_renderer_toggle_set_active</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_cell_renderer_toggle_set_active (<parameter><link linkend="GtkCellRendererToggle"><type>GtkCellRendererToggle</type></link> *toggle</parameter>,
                                     <parameter><link linkend="gboolean"><type>gboolean</type></link> setting</parameter>);</programlisting>
<para>Activates or deactivates a cell renderer.</para>
<refsect3 id="gtk-cell-renderer-toggle-set-active.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>toggle</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkCellRendererToggle"><type>GtkCellRendererToggle</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>setting</para></entry>
<entry role="parameter_description"><para>the value to set.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-cell-renderer-toggle-get-activatable" role="function">
<title>gtk_cell_renderer_toggle_get_activatable&#160;()</title>
<indexterm zone="gtk-cell-renderer-toggle-get-activatable"><primary>gtk_cell_renderer_toggle_get_activatable</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gtk_cell_renderer_toggle_get_activatable
                               (<parameter><link linkend="GtkCellRendererToggle"><type>GtkCellRendererToggle</type></link> *toggle</parameter>);</programlisting>
<para>Returns whether the cell renderer is activatable. See
<link linkend="gtk-cell-renderer-toggle-set-activatable"><function>gtk_cell_renderer_toggle_set_activatable()</function></link>.</para>
<refsect3 id="gtk-cell-renderer-toggle-get-activatable.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>toggle</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkCellRendererToggle"><type>GtkCellRendererToggle</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-cell-renderer-toggle-get-activatable.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the cell renderer is activatable.</para>
</refsect3></refsect2>
<refsect2 id="gtk-cell-renderer-toggle-set-activatable" role="function">
<title>gtk_cell_renderer_toggle_set_activatable&#160;()</title>
<indexterm zone="gtk-cell-renderer-toggle-set-activatable"><primary>gtk_cell_renderer_toggle_set_activatable</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_cell_renderer_toggle_set_activatable
                               (<parameter><link linkend="GtkCellRendererToggle"><type>GtkCellRendererToggle</type></link> *toggle</parameter>,
                                <parameter><link linkend="gboolean"><type>gboolean</type></link> setting</parameter>);</programlisting>
<para>Makes the cell renderer activatable.</para>
<refsect3 id="gtk-cell-renderer-toggle-set-activatable.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>toggle</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkCellRendererToggle"><type>GtkCellRendererToggle</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>setting</para></entry>
<entry role="parameter_description"><para>the value to set.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>

</refsect1>
<refsect1 id="GtkCellRendererToggle.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="GtkCellRendererToggle-struct" role="struct">
<title>GtkCellRendererToggle</title>
<indexterm zone="GtkCellRendererToggle-struct"><primary>GtkCellRendererToggle</primary></indexterm>
<programlisting language="C">typedef struct _GtkCellRendererToggle GtkCellRendererToggle;</programlisting>
</refsect2>

</refsect1>
<refsect1 id="GtkCellRendererToggle.property-details" role="property_details">
<title role="property_details.title">Property Details</title>
<refsect2 id="GtkCellRendererToggle--activatable" role="property"><title>The <literal>“activatable”</literal> property</title>
<indexterm zone="GtkCellRendererToggle--activatable"><primary>GtkCellRendererToggle:activatable</primary></indexterm>
<programlisting>  “activatable”              <link linkend="gboolean"><type>gboolean</type></link></programlisting>
<para>The toggle button can be activated.</para><para>Owner: GtkCellRendererToggle</para>
<para>Flags: Read / Write</para>
<para>Default value: TRUE</para>
</refsect2>
<refsect2 id="GtkCellRendererToggle--active" role="property"><title>The <literal>“active”</literal> property</title>
<indexterm zone="GtkCellRendererToggle--active"><primary>GtkCellRendererToggle:active</primary></indexterm>
<programlisting>  “active”                   <link linkend="gboolean"><type>gboolean</type></link></programlisting>
<para>The toggle state of the button.</para><para>Owner: GtkCellRendererToggle</para>
<para>Flags: Read / Write</para>
<para>Default value: FALSE</para>
</refsect2>
<refsect2 id="GtkCellRendererToggle--inconsistent" role="property"><title>The <literal>“inconsistent”</literal> property</title>
<indexterm zone="GtkCellRendererToggle--inconsistent"><primary>GtkCellRendererToggle:inconsistent</primary></indexterm>
<programlisting>  “inconsistent”             <link linkend="gboolean"><type>gboolean</type></link></programlisting>
<para>The inconsistent state of the button.</para><para>Owner: GtkCellRendererToggle</para>
<para>Flags: Read / Write</para>
<para>Default value: FALSE</para>
</refsect2>
<refsect2 id="GtkCellRendererToggle--radio" role="property"><title>The <literal>“radio”</literal> property</title>
<indexterm zone="GtkCellRendererToggle--radio"><primary>GtkCellRendererToggle:radio</primary></indexterm>
<programlisting>  “radio”                    <link linkend="gboolean"><type>gboolean</type></link></programlisting>
<para>Draw the toggle button as a radio button.</para><para>Owner: GtkCellRendererToggle</para>
<para>Flags: Read / Write</para>
<para>Default value: FALSE</para>
</refsect2>

</refsect1>
<refsect1 id="GtkCellRendererToggle.signal-details" role="signals">
<title role="signals.title">Signal Details</title>
<refsect2 id="GtkCellRendererToggle-toggled" role="signal"><title>The <literal>“toggled”</literal> signal</title>
<indexterm zone="GtkCellRendererToggle-toggled"><primary>GtkCellRendererToggle::toggled</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GtkCellRendererToggle"><type>GtkCellRendererToggle</type></link> *cell_renderer,
               <link linkend="gchar"><type>gchar</type></link>                 *path,
               <link linkend="gpointer"><type>gpointer</type></link>               user_data)</programlisting>
<para>The ::toggled signal is emitted when the cell is toggled. </para>
<para>It is the responsibility of the application to update the model
with the correct value to store at <parameter>path</parameter>
.  Often this is simply the
opposite of the value currently stored at <parameter>path</parameter>
.</para>
<refsect3 id="GtkCellRendererToggle-toggled.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>cell_renderer</para></entry>
<entry role="parameter_description"><para>the object which received the signal</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>path</para></entry>
<entry role="parameter_description"><para>string representation of <link linkend="GtkTreePath"><type>GtkTreePath</type></link> describing the
event location</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2>
</refsect1>

</refentry>
