summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-gtkcellrenderercombo.xml
blob: 04a0b54de855fde312a382bdc1345151ff0fe572 (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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<?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-gtkcellrenderercombo">
  <refnamediv>
    <refname>gtk.CellRendererCombo</refname> <refpurpose>an object that
    renders a <link
    linkend="class-gtkcomboboxentry"><classname>gtk.ComboBoxEntry</classname></link>
    into a <link
    linkend="class-gtktreeview"><classname>gtk.TreeView</classname></link>
    cell (new in PyGTK 2.6)</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>gtk.CellRendererCombo</classname></ooclass>
      <ooclass><classname><link
linkend="class-gtkcellrenderertext">gtk.CellRendererText</link></classname></ooclass>
      <constructorsynopsis language="python">
	<methodname><link
linkend="constructor-gtkcellrenderercombo">gtk.CellRendererCombo</link></methodname>
	<methodparam></methodparam>
      </constructorsynopsis>
    </classsynopsis>

  </refsect1>

  <refsect1>
    <title>Ancestry</title>

<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
  +-- <link linkend="class-gtkobject">gtk.Object</link>
    +-- <link linkend="class-gtkcellrenderer">gtk.CellRenderer</link>
      +-- <link linkend="class-gtkcellrenderertext">gtk.CellRendererText</link>
        +-- <link linkend="class-gtkcellrenderercombo">gtk.CellRendererCombo</link>
</synopsis>

  </refsect1>

  <refsect1 id="properties-gtkcellrenderercombo">
    <title>gtk.CellRendererCombo Properties</title>

    <para><link linkend="properties-gtkobject">gtk.Object Properties</link></para>
    <para><link linkend="properties-gtkcellrenderer">gtk.CellRenderer Properties</link></para>
    <para><link linkend="properties-gtkcellrenderertext">gtk.CellRendererText Properties</link></para>

    <blockquote role="properties">
      <informaltable pgwide="1" frame="none">
	<tgroup cols="3">
	  <colspec column="1" colwidth="1in"/>
	  <colspec column="2" colwidth="1in"/>
	  <colspec column="3" colwidth="3.5in"/>
	  <tbody>

	    <row valign="top">
	      <entry>"has-entry"</entry>
	      <entry>Read/Write</entry>
	<entry>If <literal>False</literal>, don't allow entering strings
other than the given ones. Default value: <literal>True</literal>. Available
in GTK+ 2.6 and above.</entry>
	  </row>

	<row valign="top">
	  <entry>"model"</entry>
	  <entry>Read/Write</entry>
	  <entry>The tree model containing the possible values for the combo
box entry. Available in GTK+ 2.6 and above.</entry>
	</row>

	<row valign="top">
	  <entry>"text-column"</entry>
	  <entry>Read/Write</entry>
	  <entry>A column in the data source model to get the strings from.
Allowed values: >= -1. Default value: -1. Available in GTK+ 2.6 and
above.</entry>
	</row>

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

  </refsect1>

  <refsect1 id="signal-prototypes-gtkcellrenderercombo">
    <title>gtk.CellRendererCombo Signal Prototypes</title>

    <para><link linkend="signal-prototypes-gobject">gobject.GObject Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkobject">gtk.Object Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkcellrenderer">gtk.CellRenderer Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkcellrenderertext">gtk.CellRendererText Signal Prototypes</link></para>
    
    <variablelist>
      <varlistentry>
        <term>"<link
linkend="signal-gtkcellrenderercombo--changed">changed</link>"</term>
        <listitem>
          <methodsynopsis
	    language="python"><methodname>callback</methodname>
            <methodparam><parameter>combo</parameter></methodparam>
	    <methodparam><parameter>path_string</parameter></methodparam>
	    <methodparam><parameter>new_iter</parameter></methodparam>
            <methodparam><parameter>user_param1</parameter>
            </methodparam>
            <methodparam><parameter>...</parameter>
            </methodparam>
          </methodsynopsis>
        </listitem>
      </varlistentry>
    </variablelist>
  </refsect1>

  <refsect1>
    <title>Description</title>

    <note>
      <para>This object is available in PyGTK 2.6 and above.</para>
    </note>

    <para>The <link
linkend="class-gtkcellrenderercombo"><classname>gtk.CellRendererCombo</classname></link>
manages the rendering of a <link
linkend="class-gtkcomboboxentry"><classname>gtk.ComboBoxEntry</classname></link>
into a <link
linkend="class-gtktreeview"><classname>gtk.TreeView</classname></link>
cell.</para>

  </refsect1>

  <refsect1 id="constructor-gtkcellrenderercombo">
    <title>Constructor</title>

    <programlisting><constructorsynopsis language="python">
	<methodname>gtk.CellRendererCombo</methodname>
	<methodparam></methodparam>  </constructorsynopsis></programlisting>
    <variablelist>
      <varlistentry>
	<term><emphasis>Returns</emphasis>&nbsp;:</term>
	<listitem><simpara>the new cell renderer</simpara></listitem>
      </varlistentry>
    </variablelist>

    <note>
      <para>This constructor is available in PyGTK 2.6 and above.</para>
    </note>

    <para>Creates a new <link
linkend="class-gtkcellrenderercombo"><classname>gtk.CellRendererCombo</classname></link>. 
Rendering parameters are adjusted using the object properties. The object
properties can be set globally (with <link
linkend="method-gobject--set-property"><methodname>set_property</methodname>()</link>). 
Also, with <link
linkend="class-gtktreeviewcolumn"><classname>gtk.TreeViewColumn</classname></link>, 
you can bind a property to a value in a <link
linkend="class-gtktreemodel"><classname>gtk.TreeModel</classname></link>.
For example, you can bind the "text" property on the cell renderer to a
string value in the model, thus rendering a different string in each row of
the <link
linkend="class-gtktreeview"><classname>gtk.TreeView</classname></link>.</para>

  </refsect1>
<refsect1>
    <title>Signals</title>

    <refsect2 id="signal-gtkcellrenderercombo--changed">
      <title>The "changed" gtk.CellRendererCombo Signal</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>callback</methodname>
	  <methodparam><parameter>combo</parameter></methodparam>
	  <methodparam><parameter>path_string</parameter></methodparam>
	  <methodparam><parameter>new_iter</parameter></methodparam>
	  <methodparam><parameter>user_param1</parameter></methodparam>
	  <methodparam><parameter>...</parameter></methodparam>
	</methodsynopsis></programlisting>

      <variablelist>
	<varlistentry>
	  <term><parameter>combo</parameter>&nbsp;:</term>
	  <listitem><simpara>the object on which the signal is emitted </simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>path_string</parameter>&nbsp;:</term>
	  <listitem><simpara>a string of the path identifying the edited cell
	  (relative to the tree view model) </simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>new_iter</parameter>&nbsp;:</term>
	  <listitem><simpara>the new iter selected in the combo box
	  (relative to the combo box model) </simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>user_param1</parameter>&nbsp;:</term>
          <listitem><simpara>the first user parameter (if any) specified
with the <link
linkend="method-gobject--connect"><methodname>connect</methodname>()</link>
method</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>...</parameter>&nbsp;:</term>
	  <listitem><simpara>additional user parameters (if
any)</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>
	The "changed" signal is emitted each time after the user selected an item in
	the combo box, either by using the mouse or the arrow keys. Contrary to GtkComboBox,
        GtkCellRendererCombo::changed is not emitted for changes made to a selected item in
	the entry. The argument new_iter corresponds to the newly selected item in the combo
	box and it is relative to the GtkTreeModel set via the model property on GtkCellRendererCombo.
      </para>
      <para>
	Note that as soon as you change the model displayed in the tree view, the tree view will
	immediately cease the editing operating. This means that you most probably want to refrain
	from changing the model until the combo cell renderer emits the edited or editing_canceled signal.
      </para>
      <note>
	  <para>This method is available in PyGTK 2.14 and above.</para>
      </note>
    </refsect2>
  </refsect1>
</refentry>