1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>gtk.CellLayout</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="gtk-class-reference.html" title="The gtk Class Reference"><link rel="previous" href="class-gtkcelleditable.html" title="gtk.CellEditable"><link rel="next" href="class-gtkcellrenderer.html" title="gtk.CellRenderer"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">gtk.CellLayout</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtkcelleditable.html">Prev</a></td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"><a accesskey="n" href="class-gtkcellrenderer.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-gtkcelllayout"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>gtk.CellLayout</h2><p>gtk.CellLayout — an interface for packing cells</p></div><div class="refsect1" lang="en"><a name="id3288594"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.CellLayout</span></span>(<span class="ooclass"><span class="classname">gobject.GInterface</span></span>):
<code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkcelllayout.html#method-gtkcelllayout--pack-start" title="gtk.CellLayout.pack_start">pack_start</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>cell</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>expand</tt></b></span><span class="initializer">=TRUE</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkcelllayout.html#method-gtkcelllayout--pack-end" title="gtk.CellLayout.pack_end">pack_end</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>cell</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>expand</tt></b></span><span class="initializer">=TRUE</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkcelllayout.html#method-gtkcelllayout--clear" title="gtk.CellLayout.clear">clear</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkcelllayout.html#method-gtkcelllayout--set-attributes" title="gtk.CellLayout.set_attributes">set_attributes</a></span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>cell</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>...</tt></i></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkcelllayout.html#method-gtkcelllayout--add-attribute" title="gtk.CellLayout.add_attribute">add_attribute</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>cell</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>attribute</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>column</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkcelllayout.html#method-gtkcelllayout--set-cell-data-func" title="gtk.CellLayout.set_cell_data_func">set_cell_data_func</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>cell</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>func</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>func_data</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkcelllayout.html#method-gtkcelllayout--clear-attributes" title="gtk.CellLayout.clear_attributes">clear_attributes</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>cell</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkcelllayout.html#method-gtkcelllayout--reorder" title="gtk.CellLayout.reorder">reorder</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>cell</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>position</tt></b></span></span>)</code><br></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3227255"></a><h2>Description</h2><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This interface is available in PyGTK 2.4 and above.</p></div><p><a href="class-gtkcelllayout.html" title="gtk.CellLayout"><tt class="classname">gtk.CellLayout</tt></a>
is an interface to be implemented by all objects that want to provide a
<a href="class-gtktreeviewcolumn.html" title="gtk.TreeViewColumn"><tt class="classname">gtk.TreeViewColumn</tt></a>-like
API for packing cells, setting attributes and data funcs. The <a href="class-gtkcelllayout.html" title="gtk.CellLayout"><tt class="classname">gtk.CellLayout</tt></a>
interface is implemented by the <a href="class-gtkcomboboxentry.html" title="gtk.ComboBoxEntry"><tt class="classname">gtk.ComboBoxEntry</tt></a>,
<a href="class-gtkcombobox.html" title="gtk.ComboBox"><tt class="classname">gtk.ComboBox</tt></a>,
<a href="class-gtkentrycompletion.html" title="gtk.EntryCompletion"><tt class="classname">gtk.EntryCompletion</tt></a>
and <a href="class-gtktreeviewcolumn.html" title="gtk.TreeViewColumn"><tt class="classname">gtk.TreeViewColumn</tt></a>
widgets.</p></div><div class="refsect1" lang="en"><a name="id3143335"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gtkcelllayout--pack-start"></a><h3>gtk.CellLayout.pack_start</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">pack_start</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>cell</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>expand</tt></b></span><span class="initializer">=TRUE</span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>cell</tt></b>:</span></td><td>A <a href="class-gtkcellrenderer.html" title="gtk.CellRenderer"><tt class="classname">gtk.CellRenderer</tt></a>.</td></tr><tr><td><span class="term"><b class="parameter"><tt>expand</tt></b>:</span></td><td>if <tt class="literal">TRUE</tt>, the
<i class="parameter"><tt>cell</tt></i> is to be given extra space that is
allocated to the cell layout.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">pack_start</tt>() method packs the <a href="class-gtkcellrenderer.html" title="gtk.CellRenderer"><tt class="classname">gtk.CellRenderer</tt></a>
specified by <i class="parameter"><tt>cell</tt></i> into the beginning of the cell
layout. If the optional parameter <i class="parameter"><tt>expand</tt></i> is
<tt class="literal">FALSE</tt>, then <i class="parameter"><tt>cell</tt></i> is allocated no
more space than it needs. Any unused space is divided evenly between cells
for which <i class="parameter"><tt>expand</tt></i> is <tt class="literal">TRUE</tt>.</p></div><div class="refsect2" lang="en"><a name="method-gtkcelllayout--pack-end"></a><h3>gtk.CellLayout.pack_end</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">pack_end</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>cell</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>expand</tt></b></span><span class="initializer">=TRUE</span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>cell</tt></b>:</span></td><td>A <a href="class-gtkcellrenderer.html" title="gtk.CellRenderer"><tt class="classname">gtk.CellRenderer</tt></a>.</td></tr><tr><td><span class="term"><b class="parameter"><tt>expand</tt></b>:</span></td><td>if <tt class="literal">TRUE</tt>, the
<i class="parameter"><tt>cell</tt></i> is to be given extra space that is
allocated to the cell layout.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">pack_end</tt>() method adds the <a href="class-gtkcellrenderer.html" title="gtk.CellRenderer"><tt class="classname">gtk.CellRenderer</tt></a>
specified by <i class="parameter"><tt>cell</tt></i> to the end of the cell layout. If
the optional parameter <i class="parameter"><tt>expand</tt></i> is
<tt class="literal">FALSE</tt>, then the <i class="parameter"><tt>cell</tt></i> is allocated
no more space than it needs. Any unused space is divided evenly between
cells for which <i class="parameter"><tt>expand</tt></i> is
<tt class="literal">TRUE</tt>.</p></div><div class="refsect2" lang="en"><a name="method-gtkcelllayout--clear"></a><h3>gtk.CellLayout.clear</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">clear</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">clear</tt>() method unsets all the
attribute mappings on all cell renderers in the cell layout.</p></div><div class="refsect2" lang="en"><a name="method-gtkcelllayout--set-attributes"></a><h3>gtk.CellLayout.set_attributes</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_attributes</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>cell</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>...</tt></i></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><i class="parameter"><tt>cell</tt></i>:</span></td><td>A <a href="class-gtkcellrenderer.html" title="gtk.CellRenderer"><tt class="classname">gtk.CellRenderer</tt></a>.</td></tr><tr><td><span class="term"><i class="parameter"><tt>...</tt></i>:</span></td><td>Zero or more keyword-value arguments in the format
attribute=column.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">set_attributes</tt>() method sets the
attributes provided as a keyword argument list as the attributes of the
<a href="class-gtkcellrenderer.html" title="gtk.CellRenderer"><tt class="classname">gtk.CellRenderer</tt></a>
specified by <i class="parameter"><tt>cell</tt></i>. 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.</p></div><div class="refsect2" lang="en"><a name="method-gtkcelllayout--add-attribute"></a><h3>gtk.CellLayout.add_attribute</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">add_attribute</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>cell</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>attribute</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>column</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>cell</tt></b>:</span></td><td>A <a href="class-gtkcellrenderer.html" title="gtk.CellRenderer"><tt class="classname">gtk.CellRenderer</tt></a>.</td></tr><tr><td><span class="term"><b class="parameter"><tt>attribute</tt></b>:</span></td><td>An attribute on the renderer.</td></tr><tr><td><span class="term"><b class="parameter"><tt>column</tt></b>:</span></td><td>The column number in the model to get the attribute from.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">add_attribute</tt>() method adds an
attribute mapping to the list in the cell layout. The
<i class="parameter"><tt>column</tt></i> parameter is the column of the model to get a
value from, and the <i class="parameter"><tt>attribute</tt></i> parameter is the
attribute of <i class="parameter"><tt>cell</tt></i> 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 <a href="class-gtkcellrenderertext.html" title="gtk.CellRendererText"><tt class="classname">gtk.CellRendererText</tt></a>
get its values from column 2.</p></div><div class="refsect2" lang="en"><a name="method-gtkcelllayout--set-cell-data-func"></a><h3>gtk.CellLayout.set_cell_data_func</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_cell_data_func</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>cell</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>func</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>func_data</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>cell</tt></b>:</span></td><td>A <a href="class-gtkcellrenderer.html" title="gtk.CellRenderer"><tt class="classname">gtk.CellRenderer</tt></a>.</td></tr><tr><td><span class="term"><b class="parameter"><tt>func</tt></b>:</span></td><td>The function to use.</td></tr><tr><td><span class="term"><b class="parameter"><tt>func_data</tt></b>:</span></td><td>The user data for <i class="parameter"><tt>func</tt></i>.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">set_cell_data_func</tt>() method sets
the function (or method) specified by <i class="parameter"><tt>func</tt></i> to be used
for setting the column value of the <a href="class-gtkcellrenderer.html" title="gtk.CellRenderer"><tt class="classname">gtk.CellRenderer</tt></a>
specified by <i class="parameter"><tt>cell</tt></i> instead of using the standard
attribute mapping method. <i class="parameter"><tt>func</tt></i> may be
<tt class="literal">None</tt> to remove the current function. The signature of
<i class="parameter"><tt>func</tt></i> is:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
<code class="methodsynopsis"> def <span class="methodname">celldatafunction</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>celllayout</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>cell</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>model</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>iter</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>user_data</tt></i></span></span>)</code><br>
<code class="methodsynopsis"> def <span class="methodname">celldatamethod</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>self</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>celllayout</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>cell</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>model</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>iter</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>user_data</tt></i></span></span>)</code>
</pre></td></tr></table><p>where <i class="parameter"><tt>celllayout</tt></i> is the <a href="class-gtkcelllayout.html" title="gtk.CellLayout"><tt class="classname">gtk.CellLayout</tt></a>,
<i class="parameter"><tt>cell</tt></i> is the <a href="class-gtkcellrenderer.html" title="gtk.CellRenderer"><tt class="classname">gtk.CellRenderer</tt></a>
for <i class="parameter"><tt>celllayout</tt></i>, <i class="parameter"><tt>model</tt></i> is the
<a href="class-gtktreemodel.html" title="gtk.TreeModel"><tt class="classname">gtk.TreeModel</tt></a> and
<i class="parameter"><tt>iter</tt></i> is the <a href="class-gtktreeiter.html" title="gtk.TreeIter"><tt class="classname">gtk.TreeIter</tt></a>
pointing at the row.</p></div><div class="refsect2" lang="en"><a name="method-gtkcelllayout--clear-attributes"></a><h3>gtk.CellLayout.clear_attributes</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">clear_attributes</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>cell</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>cell</tt></b>:</span></td><td>A <a href="class-gtkcellrenderer.html" title="gtk.CellRenderer"><tt class="classname">gtk.CellRenderer</tt></a> to clear the attribute mapping on.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">clear_attributes</tt>() method clears
all existing attribute mappings from the <a href="class-gtkcellrenderer.html" title="gtk.CellRenderer"><tt class="classname">gtk.CellRenderer</tt></a>
specified by <i class="parameter"><tt>cell</tt></i> previously set with the <a href="class-gtkcelllayout.html#method-gtkcelllayout--set-attributes" title="gtk.CellLayout.set_attributes"><tt class="methodname">set_attributes</tt>()</a>
or <a href="class-gtkcelllayout.html#method-gtkcelllayout--add-attribute" title="gtk.CellLayout.add_attribute"><tt class="methodname">add_attribute</tt>()</a>
methods.</p></div><div class="refsect2" lang="en"><a name="method-gtkcelllayout--reorder"></a><h3>gtk.CellLayout.reorder</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">reorder</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>cell</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>position</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>cell</tt></b>:</span></td><td>A <a href="class-gtkcellrenderer.html" title="gtk.CellRenderer"><tt class="classname">gtk.CellRenderer</tt></a> to reorder.</td></tr><tr><td><span class="term"><b class="parameter"><tt>position</tt></b>:</span></td><td>New position to insert <i class="parameter"><tt>cell</tt></i> at.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">reorder</tt>() method re-inserts the
<a href="class-gtkcellrenderer.html" title="gtk.CellRenderer"><tt class="classname">gtk.CellRenderer</tt></a>
specified by <i class="parameter"><tt>cell</tt></i> at
<i class="parameter"><tt>position</tt></i>. Note that <i class="parameter"><tt>cell</tt></i> has
to already be packed into <i class="parameter"><tt>cell_layout</tt></i> for this to
function properly.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="class-gtkcelleditable.html">Prev</a></td><td width="20%" align="center"><a accesskey="u" href="gtk-class-reference.html">Up</a></td><td width="40%" align="right"><a accesskey="n" href="class-gtkcellrenderer.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.CellEditable</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">gtk.CellRenderer</td></tr></table></div></body></html>
|