<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="class-gtkcelllayout">
  <refnamediv>
    <refname>gtk.CellLayout</refname>
    <refpurpose>an interface for packing cells</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>gtk.CellLayout</classname></ooclass>
      <ooclass><classname>gobject.GInterface</classname></ooclass>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkcelllayout--pack-start">pack_start</link></methodname>
	<methodparam><parameter role="keyword">cell</parameter></methodparam>
	<methodparam><parameter role="keyword">expand</parameter><initializer>True</initializer></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkcelllayout--pack-end">pack_end</link></methodname>
	<methodparam><parameter role="keyword">cell</parameter></methodparam>
	<methodparam><parameter role="keyword">expand</parameter><initializer>True</initializer></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkcelllayout--clear">clear</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkcelllayout--get-cells">get_cells</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkcelllayout--set-attributes">set_attributes</link></methodname>
	<methodparam><parameter>cell</parameter></methodparam>
	<methodparam><parameter>...</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkcelllayout--add-attribute">add_attribute</link></methodname>
	<methodparam><parameter role="keyword">cell</parameter></methodparam>
	<methodparam><parameter role="keyword">attribute</parameter></methodparam>
	<methodparam><parameter role="keyword">column</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkcelllayout--set-cell-data-func">set_cell_data_func</link></methodname>
	<methodparam><parameter role="keyword">cell</parameter></methodparam>
	<methodparam><parameter role="keyword">func</parameter></methodparam>
	<methodparam><parameter role="keyword">func_data</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkcelllayout--clear-attributes">clear_attributes</link></methodname>
	<methodparam><parameter role="keyword">cell</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkcelllayout--reorder">reorder</link></methodname>
	<methodparam><parameter role="keyword">cell</parameter></methodparam>
	<methodparam><parameter role="keyword">position</parameter></methodparam>
      </methodsynopsis>
    </classsynopsis>

  </refsect1>

  <refsect1>
    <title>Description</title>

    <note>
      <para>This interface is available in PyGTK 2.4 and above.</para>
    </note>

    <para><link
linkend="class-gtkcelllayout"><classname>gtk.CellLayout</classname></link>
is an interface to be implemented by all objects that want to provide a
<link
linkend="class-gtktreeviewcolumn"><classname>gtk.TreeViewColumn</classname></link>-like
API for packing cells, setting attributes and data funcs. The <link
linkend="class-gtkcelllayout"><classname>gtk.CellLayout</classname></link>
interface is implemented by the <link
linkend="class-gtkcomboboxentry"><classname>gtk.ComboBoxEntry</classname></link>,
<link
linkend="class-gtkcombobox"><classname>gtk.ComboBox</classname></link>,
<link
linkend="class-gtkentrycompletion"><classname>gtk.EntryCompletion</classname></link>
and <link
linkend="class-gtktreeviewcolumn"><classname>gtk.TreeViewColumn</classname></link>
widgets.</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-gtkcelllayout--pack-start">
      <title>gtk.CellLayout.pack_start</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>pack_start</methodname>
	  <methodparam><parameter role="keyword">cell</parameter></methodparam>
	  <methodparam><parameter role="keyword">expand</parameter><initializer>True</initializer></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">cell</parameter>&nbsp;:</term>
	  <listitem><simpara>A <link linkend="class-gtkcellrenderer"><classname>gtk.CellRenderer</classname></link>.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">expand</parameter>&nbsp;:</term>
	  <listitem><simpara>if <literal>True</literal>, the
	  <parameter>cell</parameter> is to be given extra space that is
	  allocated to the cell layout.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>pack_start</methodname>() method packs the <link
linkend="class-gtkcellrenderer"><classname>gtk.CellRenderer</classname></link>
specified by <parameter>cell</parameter> into the beginning of the cell
layout. If the optional parameter <parameter>expand</parameter> is
<literal>False</literal>, then <parameter>cell</parameter> is allocated no
more space than it needs. Any unused space is divided evenly between cells
for which <parameter>expand</parameter> is <literal>True</literal>.</para>

    </refsect2>

    <refsect2 id="method-gtkcelllayout--pack-end">
      <title>gtk.CellLayout.pack_end</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>pack_end</methodname>
	  <methodparam><parameter role="keyword">cell</parameter></methodparam>
	  <methodparam><parameter role="keyword">expand</parameter><initializer>True</initializer></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">cell</parameter>&nbsp;:</term>
	  <listitem><simpara>A <link linkend="class-gtkcellrenderer"><classname>gtk.CellRenderer</classname></link>.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">expand</parameter>&nbsp;:</term>
	  <listitem><simpara>if <literal>True</literal>, the
	  <parameter>cell</parameter> is to be given extra space that is
	  allocated to the cell layout.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>pack_end</methodname>() method adds the <link
linkend="class-gtkcellrenderer"><classname>gtk.CellRenderer</classname></link>
specified by <parameter>cell</parameter> to the end of the cell layout. If
the optional parameter <parameter>expand</parameter> is
<literal>False</literal>, then the <parameter>cell</parameter> is allocated
no more space than it needs. Any unused space is divided evenly between
cells for which <parameter>expand</parameter> is
<literal>True</literal>.</para>

    </refsect2>

    <refsect2 id="method-gtkcelllayout--clear">
      <title>gtk.CellLayout.clear</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>clear</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>clear</methodname>() method unsets all the
attribute mappings on all cell renderers in the cell layout.</para>

    </refsect2>

    <refsect2 id="method-gtkcelllayout--get-cells">
      <title>gtk.CellLayout.get_cells</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_cells</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
        <variablelist>
            <varlistentry>
                <term><emphasis>Returns</emphasis>&nbsp;:</term>
                <listitem><simpara>A list of cell renderers.</simpara></listitem>
            </varlistentry>
        </variablelist>

      <note>
	<para>This method is available in PyGTK 2.12 and above.</para>
      </note>

      <para>The <methodname>get_cells</methodname>() method returns the cell
      renderers which have been added to cell_layout.</para>

    </refsect2>

    <refsect2 id="method-gtkcelllayout--set-attributes">
      <title>gtk.CellLayout.set_attributes</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_attributes</methodname>
	  <methodparam><parameter>cell</parameter></methodparam>
	<methodparam><parameter>...</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter>cell</parameter>&nbsp;:</term>
	  <listitem><simpara>A <link
	  linkend="class-gtkcellrenderer"><classname>gtk.CellRenderer</classname></link>.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>...</parameter>&nbsp;:</term>
	  <listitem><simpara>Zero or more keyword-value arguments in the format
	  attribute=column.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>set_attributes</methodname>() method sets the
attributes provided as a keyword argument list as the attributes of the
<link
linkend="class-gtkcellrenderer"><classname>gtk.CellRenderer</classname></link>
specified by <parameter>cell</parameter>. The attributes should be supplied
as keyword-value arguments in the format: attribute=column (e.g. text=0,
background=1). All existing attributes are removed, and replaced with the
new attributes.</para>

    </refsect2>

    <refsect2 id="method-gtkcelllayout--add-attribute">
      <title>gtk.CellLayout.add_attribute</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>add_attribute</methodname>
	  <methodparam><parameter role="keyword">cell</parameter></methodparam>
	  <methodparam><parameter role="keyword">attribute</parameter></methodparam>
	  <methodparam><parameter role="keyword">column</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">cell</parameter>&nbsp;:</term>
	  <listitem><simpara>A <link linkend="class-gtkcellrenderer"><classname>gtk.CellRenderer</classname></link>.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">attribute</parameter>&nbsp;:</term>
	  <listitem><simpara>An attribute on the renderer.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">column</parameter>&nbsp;:</term>
	  <listitem><simpara>The column number in the model to get the attribute from.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>add_attribute</methodname>() method adds an
attribute mapping to the list in the cell layout. The
<parameter>column</parameter> parameter is the column of the model to get a
value from, and the <parameter>attribute</parameter> parameter is the
attribute of <parameter>cell</parameter> to be set from the value. So for
example if column 2 of the model contains strings, you could have the "text"
attribute of a <link
linkend="class-gtkcellrenderertext"><classname>gtk.CellRendererText</classname></link>
get its values from column 2.</para>

    </refsect2>

    <refsect2 id="method-gtkcelllayout--set-cell-data-func">
      <title>gtk.CellLayout.set_cell_data_func</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_cell_data_func</methodname>
	  <methodparam><parameter role="keyword">cell</parameter></methodparam>
	  <methodparam><parameter role="keyword">func</parameter></methodparam>
	  <methodparam><parameter role="keyword">func_data</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">cell</parameter>&nbsp;:</term>
	  <listitem><simpara>A <link linkend="class-gtkcellrenderer"><classname>gtk.CellRenderer</classname></link>.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">func</parameter>&nbsp;:</term>
	  <listitem><simpara>The function to use.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">func_data</parameter>&nbsp;:</term>
	  <listitem><simpara>The user data for <parameter>func</parameter>.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>set_cell_data_func</methodname>() method sets
the function (or method) specified by <parameter>func</parameter> to be used
for setting the column value of the <link
linkend="class-gtkcellrenderer"><classname>gtk.CellRenderer</classname></link>
specified by <parameter>cell</parameter> instead of using the standard
attribute mapping method. <parameter>func</parameter> may be
<literal>None</literal> to remove the current function. The signature of
<parameter>func</parameter> is:</para>

      <programlisting>
<methodsynopsis language="python">
          <methodname>celldatafunction</methodname>
          <methodparam><parameter>celllayout</parameter></methodparam>
          <methodparam><parameter>cell</parameter></methodparam>
          <methodparam><parameter>model</parameter></methodparam>
          <methodparam><parameter>iter</parameter></methodparam>
          <methodparam><parameter>user_data</parameter></methodparam>
        </methodsynopsis>
<methodsynopsis language="python">
          <methodname>celldatamethod</methodname>
          <methodparam><parameter>self</parameter></methodparam>
          <methodparam><parameter>celllayout</parameter></methodparam>
          <methodparam><parameter>cell</parameter></methodparam>
          <methodparam><parameter>model</parameter></methodparam>
          <methodparam><parameter>iter</parameter></methodparam>
          <methodparam><parameter>user_data</parameter></methodparam>
        </methodsynopsis>
</programlisting>

      <para>where <parameter>celllayout</parameter> is the <link
linkend="class-gtkcelllayout"><classname>gtk.CellLayout</classname></link>,
<parameter>cell</parameter> is the <link
linkend="class-gtkcellrenderer"><classname>gtk.CellRenderer</classname></link>
for <parameter>celllayout</parameter>, <parameter>model</parameter> is the
<link
linkend="class-gtktreemodel"><classname>gtk.TreeModel</classname></link> and
<parameter>iter</parameter> is the <link
linkend="class-gtktreeiter"><classname>gtk.TreeIter</classname></link>
pointing at the row.</para>

    </refsect2>

    <refsect2 id="method-gtkcelllayout--clear-attributes">
      <title>gtk.CellLayout.clear_attributes</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>clear_attributes</methodname>
	  <methodparam><parameter role="keyword">cell</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">cell</parameter>&nbsp;:</term>
	  <listitem><simpara>A <link linkend="class-gtkcellrenderer"><classname>gtk.CellRenderer</classname></link> to clear the attribute mapping on.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>clear_attributes</methodname>() method clears
all existing attribute mappings from the <link
linkend="class-gtkcellrenderer"><classname>gtk.CellRenderer</classname></link>
specified by <parameter>cell</parameter> previously set with the <link
linkend="method-gtkcelllayout--set-attributes"><methodname>set_attributes</methodname>()</link>
or <link
linkend="method-gtkcelllayout--add-attribute"><methodname>add_attribute</methodname>()</link>
methods.</para>

    </refsect2>

    <refsect2 id="method-gtkcelllayout--reorder">
      <title>gtk.CellLayout.reorder</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>reorder</methodname>
	  <methodparam><parameter role="keyword">cell</parameter></methodparam>
	  <methodparam><parameter role="keyword">position</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">cell</parameter>&nbsp;:</term>
	  <listitem><simpara>A <link linkend="class-gtkcellrenderer"><classname>gtk.CellRenderer</classname></link> to reorder.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">position</parameter>&nbsp;:</term>
	  <listitem><simpara>New position to insert <parameter>cell</parameter> at.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>reorder</methodname>() method re-inserts the
<link
linkend="class-gtkcellrenderer"><classname>gtk.CellRenderer</classname></link>
specified by <parameter>cell</parameter> at
<parameter>position</parameter>. Note that <parameter>cell</parameter> has
to already be packed into <parameter>cell_layout</parameter> for this to
function properly.</para>

    </refsect2>

  </refsect1>

</refentry>
