summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-gtkradioaction.xml
blob: 93eb81119a2bbf91212c5217ba83e0359ed8ad41 (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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
<?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-gtkradioaction">
  <refnamediv>
    <refname>gtk.RadioAction</refname>

    <refpurpose>an action that can be grouped so that only one can be
    active (new in PyGTK 2.4)</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>gtk.RadioAction</classname></ooclass>
      <ooclass><classname><link linkend="class-gtktoggleaction">gtk.ToggleAction</link></classname></ooclass>
      <constructorsynopsis language="python">
	<methodname><link linkend="constructor-gtkradioaction">gtk.RadioAction</link></methodname>
	<methodparam><parameter role="keyword">name</parameter></methodparam>
	<methodparam><parameter role="keyword">label</parameter></methodparam>
	<methodparam><parameter role="keyword">tooltip</parameter></methodparam>
	<methodparam><parameter role="keyword">stock_id</parameter></methodparam>
	<methodparam><parameter role="keyword">value</parameter></methodparam>
      </constructorsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkradioaction--set-group">set_group</link></methodname>
	<methodparam><parameter role="keyword">group</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkradioaction--get-group">get_group</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkradioaction--set-current-value">set_current_value</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkradioaction--get-current-value">get_current_value</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
    </classsynopsis>

  </refsect1>

  <refsect1>
    <title>Ancestry</title>

<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
  +-- <link linkend="class-gtkaction">gtk.Action</link>
    +-- <link linkend="class-gtktoggleaction">gtk.ToggleAction</link>
      +-- <link linkend="class-gtkradioaction">gtk.RadioAction</link>
</synopsis>

  </refsect1>
  
  <refsect1>
		<title>Implemented Interfaces</title>
		<para>
			<link linkend="class-gtkradioaction"><classname>gtk.RadioAction</classname></link>
			implements 
			<link linkend="class-gtkbuildable"><classname>gtk.Buildable</classname></link>
		</para>
	</refsect1>


  <refsect1 id="properties-gtkradioaction">
    <title>gtk.RadioAction Properties</title>

    <para><link linkend="properties-gtkaction">gtk.Action Properties</link></para>
    <para><link linkend="properties-gtktoggleaction">gtk.ToggleAction 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="4in"/>
	  <tbody>

        <row valign="top">
          <entry>"current-value"</entry>
          <entry>Read-Write</entry>
          <entry>The value property of the currently active member of the
          group to which this action belongs.  This property is available in
          GTK+ 2.10 and above.</entry>
        </row>

	    <row valign="top">
	      <entry>"group"</entry>
	      <entry>Write</entry>
	      <entry>Sets a new group for a radio action. This property is
	      available in GTK+ 2.4 and above</entry>
	    </row>

	    <row valign="top">
	      <entry>"value"</entry>
	      <entry>Read-Write</entry>

	      <entry>The value is an arbitrary integer which can be used as
	      a convenient way to determine which action in the group is
	      currently active in an "activate" or "changed" signal
	      handler. See the <link
	      linkend="method-gtkradioaction--get-current-value"><methodname>get_current_value</methodname>()</link>
	      and the <link
	      linkend="method-gtkactiongroup--add-radio-actions"><methodname>gtk.ActionGroup.add_radio_actions</methodname>()</link>
	      methods for convenient ways to get and set this property. This
	      property is available in GTK+ 2.4 and above</entry>
	    </row>

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

  </refsect1>

  <refsect1 id="signal-prototypes-gtkradioaction">
    <title>gtk.RadioAction Signal Prototypes</title>

    <para><link linkend="signal-prototypes-gobject">gobject.GObject Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkaction">gtk.Action Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtktoggleaction">gtk.ToggleAction Signal Prototypes</link></para>

    <variablelist>
      <varlistentry>
        <term>"<link linkend="signal-gtkradioaction--changed">changed</link>"</term>
        <listitem>
          <methodsynopsis language="python"><methodname>callback</methodname>
            <methodparam><parameter>radioaction</parameter></methodparam>
            <methodparam><parameter>current</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.4 and above.</para>
    </note>

    <para>A <link
linkend="class-gtkradioaction"><classname>gtk.RadioAction</classname></link>
is a subclass of <link
linkend="class-gtktoggleaction"><classname>gtk.ToggleAction</classname></link>
and similar to <link
linkend="class-gtkradiomenuitem"><classname>gtk.RadioMenuItem</classname></link>.
A number of radio actions can be linked together so that only one may be
active at any one time.</para>

  </refsect1>

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

    <programlisting><constructorsynopsis language="python">
	<methodname>gtk.RadioAction</methodname>
	<methodparam><parameter role="keyword">name</parameter></methodparam>
	<methodparam><parameter role="keyword">label</parameter></methodparam>
	<methodparam><parameter role="keyword">tooltip</parameter></methodparam>
	<methodparam><parameter role="keyword">stock_id</parameter></methodparam>
	<methodparam><parameter role="keyword">value</parameter></methodparam>
      </constructorsynopsis></programlisting>
    <variablelist>
      <varlistentry>
	<term><parameter role="keyword">name</parameter>&nbsp;:</term>
	<listitem><simpara>A unique name for the action</simpara></listitem>
      </varlistentry>
      <varlistentry>
	<term><parameter role="keyword">label</parameter>&nbsp;:</term>
	<listitem><simpara>The label displayed in menu items and on
	buttons</simpara></listitem>
      </varlistentry>
      <varlistentry>
	<term><parameter role="keyword">tooltip</parameter>&nbsp;:</term>
	<listitem><simpara>A tooltip for this action</simpara></listitem>
      </varlistentry>
      <varlistentry>
	<term><parameter role="keyword">stock_id</parameter>&nbsp;:</term>
	<listitem><simpara>The stock icon to display in widgets representing
	this action</simpara></listitem>
      </varlistentry>
      <varlistentry>
	<term><parameter role="keyword">value</parameter>&nbsp;:</term>
	<listitem><simpara>A unique integer value that <link
	linkend="method-gtkradioaction--get-current-value"><methodname>get_current_value()</methodname></link>
	should return if this action is selected.</simpara></listitem>
      </varlistentry>
      <varlistentry>
	<term><emphasis>Returns</emphasis>&nbsp;:</term>
	<listitem><simpara>a new <link
	linkend="class-gtkradioaction"><classname>gtk.RadioAction</classname></link></simpara></listitem>
      </varlistentry>
    </variablelist>

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

    <para>Creates a new <link
linkend="class-gtkradioaction"><classname>gtk.RadioAction</classname></link>
object suing the properties specified by: <parameter>name</parameter>,
<parameter>label</parameter>, <parameter>tooltip</parameter>,
<parameter>stock_id</parameter> and <parameter>value</parameter>. To add the
action to a <link
linkend="class-gtkactiongroup"><classname>gtk.ActionGroup</classname></link>
and set the accelerator for the action, call the <link
linkend="method-gtkactiongroup--add-action-with-accel"><methodname>gtk.ActionGroup.add_action_with_accel()</methodname></link>.</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-gtkradioaction--set-group">
      <title>gtk.RadioAction.set_group</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_group</methodname>
	  <methodparam><parameter role="keyword">group</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">group</parameter>&nbsp;:</term>
	  <listitem><simpara>another <link
	  linkend="class-gtkradioaction"><classname>gtk.RadioAction</classname></link> or <literal>None</literal></simpara></listitem>
	</varlistentry>
      </variablelist>

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

      <para>The <methodname>set_group</methodname>() method sets the radio
group for the radio action to the same group as the <link
linkend="class-gtkradioaction"><classname>gtk.RadioAction</classname></link>
specified by <parameter>group</parameter> i.e. the radio action joins the
group.</para>

      <para>In PyGTK 2.6.2 and above, if <parameter>group</parameter> is
<literal>None</literal> the radio action is removed from its current
group.</para>

    </refsect2>

    <refsect2 id="method-gtkradioaction--get-group">
      <title>gtk.RadioAction.get_group</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_group</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a list containing the radio actions in the
	  group or <parameter>None</parameter></simpara></listitem>
	</varlistentry>
      </variablelist>

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

      <para>The <methodname>get_group</methodname>() method returns a list
containing the group that the radio action belongs to or
<literal>None</literal> if the radio action is not part of a group.</para>

    </refsect2>

    <refsect2 id="method-gtkradioaction--set-current-value">
      <title>gtk.RadioAction.set_current_value</title>

      <programlisting><methodsynopsis language="python">
        <methodname>set_current_value</methodname>
        <methodparam></methodparam>
      </methodsynopsis></programlisting>
      <variablelist>
        <varlistentry>
          <term><parameter role="keyword">current_value</parameter>&nbsp;:</term>
          <listitem><simpara>the new value.</simpara></listitem>
        </varlistentry>
      </variablelist>

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

      <para>The <methodname>get_current_value</methodname>() method sets the currently
      active group member to the member with value property current_value.</para>

    </refsect2>

    <refsect2 id="method-gtkradioaction--get-current-value">
      <title>gtk.RadioAction.get_current_value</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_current_value</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>The value of the currently active group
	  member</simpara></listitem>
	</varlistentry>
      </variablelist>

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

      <para>The <methodname>get_current_value</methodname>() method returns
the "value" property of the the currently active member of the group that
the radio action belongs to.</para>

    </refsect2>

  </refsect1>

  <refsect1>
    <title>Signals</title>

    <refsect2 id="signal-gtkradioaction--changed">
      <title>The "changed" gtk.RadioAction Signal</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>callback</methodname>
	  <methodparam><parameter>radioaction</parameter></methodparam>
	  <methodparam><parameter>current</parameter></methodparam>
	  <methodparam><parameter>user_param1</parameter></methodparam>
	  <methodparam><parameter>...</parameter></methodparam>
	</methodsynopsis></programlisting>

      <variablelist>
	<varlistentry>
	  <term><parameter>radioaction</parameter>&nbsp;:</term>
	  <listitem><simpara>the radioaction that received the
signal</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>current</parameter>&nbsp;:</term>
	  <listitem><simpara>the currently active <link
	  linkend="class-gtkradioaction"><classname>gtk.RadioAction</classname></link>
	  in the group</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>

      <note>
	<para>This signal is available in GTK+ 2.4 and above.</para>
      </note>

      <para>The "changed" signal is emitted on every member of a radio group
when the active member is changed. The signal gets emitted after the
"activate" signals for the previous and current active members.</para>

    </refsect2>

  </refsect1>

</refentry>