summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-gtktoggleaction.xml
blob: 7d6766e20782238790766743bff6ad0fa40ee6bb (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
<?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-gtktoggleaction">
  <refnamediv>
    <refname>gtk.ToggleAction</refname> <refpurpose>an action which can be
    toggled between two states (new in PyGTK 2.4)</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>gtk.ToggleAction</classname></ooclass>
      <ooclass><classname><link linkend="class-gtkaction">gtk.Action</link></classname></ooclass>
      <constructorsynopsis language="python">
	<methodname><link linkend="constructor-gtktoggleaction">gtk.ToggleAction</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>
      </constructorsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtktoggleaction--toggled">toggled</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtktoggleaction--set-active">set_active</link></methodname>
	<methodparam><parameter role="keyword">is_active</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtktoggleaction--get-active">get_active</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtktoggleaction--set-draw-as-radio">set_draw_as_radio</link></methodname>
	<methodparam><parameter role="keyword">draw_as_radio</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtktoggleaction--get-draw-as-radio">get_draw_as_radio</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>
</synopsis>

  </refsect1>

  <refsect1>
    <title>Properties</title>

    <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>"draw-as-radio"</entry>
	      <entry>Read-Write</entry>
	      <entry>If <literal>TRUE</literal>, the proxies for this action
look like radio action proxies. Available in GTK+ 2.4 and above.</entry>
	    </row>

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

  </refsect1>

  <refsect1>
    <title>Signal Prototypes</title>

    <variablelist>
      <varlistentry>
        <term>"<link linkend="signal-gtktoggleaction--toggled">toggled</link>"</term>
        <listitem>
          <methodsynopsis language="python"><methodname>callback</methodname>
            <methodparam><parameter>toggleaction</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-gtktoggleaction"><classname>gtk.ToggleAction</classname></link>
which is a subclass of <link
linkend="class-gtkaction"><classname>gtk.Action</classname></link>
corresponds roughly to a <link
linkend="class-gtkcheckmenuitem"><classname>gtk.CheckMenuItem</classname></link>. It
has an "active" state specifying whether the action has been checked or
not.</para>

  </refsect1>

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

    <programlisting><constructorsynopsis language="python">
	<methodname>gtk.ToggleAction</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>
      </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 the action</simpara></listitem>
      </varlistentry>
      <varlistentry>
	<term><parameter role="keyword">stock_id</parameter>&nbsp;:</term>
	<listitem><simpara>the stock icon to display in widgets representing
the action</simpara></listitem>
      </varlistentry>
      <varlistentry>
	<term><emphasis>Returns</emphasis>&nbsp;:</term>
	<listitem><simpara>a new <link
linkend="class-gtktoggleaction"><classname>gtk.ToggleAction</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-gtktoggleaction"><classname>gtk.ToggleAction</classname></link>
object. 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>
method.</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-gtktoggleaction--toggled">
      <title>gtk.ToggleAction.toggled</title>

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

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

      <para>The <methodname>toggled</methodname>() method emits the
"toggled" signal on the toggle action.</para>

    </refsect2>

    <refsect2 id="method-gtktoggleaction--set-active">
      <title>gtk.ToggleAction.set_active</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_active</methodname>
	  <methodparam><parameter role="keyword">is_active</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter
	  role="keyword">is_active</parameter>&nbsp;:</term>
	  <listitem><simpara>if <literal>TRUE</literal> the action should be
	  checked</simpara></listitem>
	</varlistentry>
      </variablelist>

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

      <para>The <methodname>set_active</methodname>() method sets the
checked state on the toggle action.</para>

    </refsect2>

    <refsect2 id="method-gtktoggleaction--get-active">
      <title>gtk.ToggleAction.get_active</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_active</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara><literal>TRUE</literal> if the toggle action is
	  checked</simpara></listitem>
	</varlistentry>
      </variablelist>

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

      <para>The <methodname>get_active</methodname>() method returns
<literal>TRUE</literal> if the toggle action is checked.</para>

    </refsect2>

    <refsect2 id="method-gtktoggleaction--set-draw-as-radio">
      <title>gtk.ToggleAction.set_draw_as_radio</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_draw_as_radio</methodname>
	  <methodparam><parameter role="keyword">draw_as_radio</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter
	  role="keyword">draw_as_radio</parameter>&nbsp;:</term>
	  <listitem><simpara>if <literal>TRUE</literal> the action should
	  have proxies like a radio action</simpara></listitem>
	</varlistentry>
      </variablelist>

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

      <para>The <methodname>set_draw_as_radio</methodname>() method sets the
"draw-as-radio" property to the value of
<parameter>draw_as_radio</parameter>. If
<parameter>draw_as_radio</parameter> is <literal>TRUE</literal> the action
should have proxies like a radio action.</para>

    </refsect2>

    <refsect2 id="method-gtktoggleaction--get-draw-as-radio">
      <title>gtk.ToggleAction.get_draw_as_radio</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_draw_as_radio</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara><literal>TRUE</literal> if the action should
	  have proxies like a radio action.</simpara></listitem>
	</varlistentry>
      </variablelist>

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

      <para>The <methodname>get_draw_as_radio</methodname>() method returns
the value of the "draw-as-radio" property. If "draw-as-radio" is
<literal>TRUE</literal> the action should have proxies like a radio
action.</para>

    </refsect2>

  </refsect1>

  <refsect1>
    <title>Signals</title>

    <refsect2 id="signal-gtktoggleaction--toggled">
      <title>The "toggled"  Signal</title>

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

      <variablelist>
	<varlistentry>
	  <term><parameter>toggleaction</parameter>&nbsp;:</term>
	  <listitem><simpara>the toggleaction that received the
signal</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 "toggled" signal is emitted when the toggle action changes
its active state.</para>

    </refsect2>

  </refsect1>

</refentry>