summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-pygtktreemodelrow.xml
blob: b44b54b7ab42dffaaf766b364b578d072f7ff1db (plain)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?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-pygtktreemodelrow">
  <refnamediv>
    <refname>gtk.TreeModelRow</refname>
    <refpurpose>an object representing a row in a <link 
linkend="class-gtktreemodel"><classname>gtk.TreeModel</classname></link></refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>gtk.TreeModelRow</classname></ooclass>
      <methodsynopsis language="python">
        <methodname><link linkend="method-gtktreemodelrow--iterchildren">iterchildren</link></methodname>
        <methodparam></methodparam>
      </methodsynopsis>
    </classsynopsis>

</refsect1>

  <refsect1>
    <title>Ancestry</title>

<synopsis>+-- <link linkend="class-gobject">gobject.GBoxed</link>
    +-- <link linkend="class-gtkwidget">gtk.TreeModelRow</link>
</synopsis>

  </refsect1>

  <refsect1>
    <title>Attributes</title>

    <blockquote role="properties">
      <informaltable pgwide="1" frame="none">
	<tgroup cols="3">
	<?dbhtml cellpadding="5"?>
	  <colspec column="1" colwidth="1in"/>
	  <colspec column="2" colwidth="1in"/>
	  <colspec column="3" colwidth="4in"/>
	  <tbody>

	    <row valign="top">
	      <entry>"next"</entry>
              <entry>Read</entry>

              <entry>The next <link
linkend="class-pygtktreemodelrow"><classname>gtk.TreeModelRow</classname></link>
or <literal>None</literal></entry>
	    </row>

	    <row valign="top">
	      <entry>"parent"</entry>
	      <entry>Read</entry>

	      <entry>The parent <link
linkend="class-pygtktreemodelrow"><classname>gtk.TreeModelRow</classname></link>
 of this row or <literal>None</literal></entry>
	    </row>

	    <row valign="top">
	      <entry>"model"</entry>
	      <entry>Read</entry>

	      <entry>The <link
linkend="class-gtktreemodel"><classname>gtk.TreeModel</classname></link>
that the row is part of.</entry>
	    </row>

	    <row valign="top">
	      <entry>"path"</entry>
	      <entry>Read</entry>
	      <entry>The tree path of the row</entry>
	    </row>

	    <row valign="top">
	      <entry>"iter"</entry>
              <entry>Read</entry>

              <entry>A <link
linkend="class-gtktreeiter"><classname>gtk.TreeIter</classname></link>
pointing at the row.</entry>
	    </row>

	</tbody>
      </tgroup>
      </informaltable>
    </blockquote>

  </refsect1>

  <refsect1>
    <title>Description</title>

    <para>A <link
linkend="class-pygtktreemodelrow"><classname>gtk.TreeModelRow</classname></link>
object represents a row in a <link
linkend="class-gtktreemodel"><classname>gtk.TreeModel</classname></link>. A
<link
linkend="class-pygtktreemodelrow"><classname>gtk.TreeModelRow</classname></link>
is created by taking the mapping of a <link
linkend="class-gtktreemodel"><classname>gtk.TreeModel</classname></link>. For
example:</para>

    <programlisting>
  treemodelrow = liststore[0]
  treemodelrow = liststore[(0,)]
  treemodelrow = liststore['0']
</programlisting>

    <para>all create a <link
linkend="class-pygtktreemodelrow"><classname>gtk.TreeModelRow</classname></link>
for the first row in <parameter>liststore</parameter>. The <link
linkend="class-pygtktreemodelrow"><classname>gtk.TreeModelRow</classname></link>
implements some of the Python sequence protocol that makes the row behave
like a sequence of objects. Specifically a tree model row has the capability
of:</para>

    <itemizedlist>
      <listitem>
        <simpara>getting and setting column values,</simpara>
      </listitem>
      <listitem>
        <simpara>returning a tuple or list containing the column values,
and</simpara>
      </listitem>
      <listitem>
        <simpara>getting the number of values in the row i.e. the number of
columns</simpara>
      </listitem>
   </itemizedlist>

    <para>For example to get and set the value in the second column of a
row, you could do the following:</para>

    <programlisting>
  value = treemodelrow[1]
  treemodelrow[1] = value
</programlisting>

    <para>You can use the Python <function>len</function>() function to get
the number of columns in the row and you can retrieve all the column values
as a list (tuple) using the Python <function>list</function>()
(<function>tuple</function>()) function.</para>

    <para>The <link
linkend="class-pygtktreemodelrow"><classname>gtk.TreeModelRow</classname></link>
supports one method: the <link
linkend="method-gtktreemodelrow--iterchildren"><methodname>iterchildren</methodname>()</link>
method that returns a <link
linkend="class-pygtktreemodelrowiter"><classname>gtk.TreeModelRowIter</classname></link>
for iterating over the children of the row.</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-gtktreemodelrow--iterchildren">
      <title>gtk.TreeModelRow.iterchildren</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>iterchildren</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	<term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a <link
	  linkend="class-pygtktreemodelrowiter"><classname>gtk.TreeModelRowIter</classname></link>
	  for the row's children or
	  <literal>None</literal></simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>iterchildren</methodname>() method returns a
<link
linkend="class-pygtktreemodelrowiter"><classname>gtk.TreeModelRowIter</classname></link>
for iterating over the children of the row or <literal>None</literal> if the
row has no children.</para>

    </refsect2>

  </refsect1>

</refentry>