summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-gtkitemfactory.xml
blob: 8f1e984b4b289206d343a76fcb40179a36d6b73b (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
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
<?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-gtkitemfactory">
  <refnamediv>
    <refname>gtk.ItemFactory</refname>
    <refpurpose>creates menus, menubars and option menus from a data
description.</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>gtk.ItemFactory</classname></ooclass>
      <ooclass><classname><link
linkend="class-gtkobject">gtk.Object</link></classname></ooclass>
      <constructorsynopsis language="python">
	<methodname><link
linkend="constructor-gtkitemfactory">gtk.ItemFactory</link></methodname>
	<methodparam><parameter
		       role="keyword">container_type</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">path</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">accel_group</parameter><initializer>None</initializer></methodparam>
      </constructorsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkitemfactory--construct">construct</link></methodname>
	<methodparam><parameter
		       role="keyword">container_type</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">path</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">accel_group</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkitemfactory--get-item">get_item</link></methodname>
	<methodparam><parameter
		       role="keyword">path</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkitemfactory--get-widget">get_widget</link></methodname>
	<methodparam><parameter
		       role="keyword">path</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkitemfactory--get-widget-by-action">get_widget_by_action</link></methodname>
	<methodparam><parameter
		       role="keyword">action</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkitemfactory--get-item-by-action">get_item_by_action</link></methodname>
	<methodparam><parameter
		       role="keyword">action</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkitemfactory--create-items">create_items</link></methodname>
	<methodparam><parameter
		       role="keyword">entries</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">callback_data</parameter><initializer>None</initializer></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkitemfactory--delete-item">delete_item</link></methodname>
	<methodparam><parameter
		       role="keyword">path</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkitemfactory--popup">popup</link></methodname>
	<methodparam><parameter role="keyword">x</parameter></methodparam>
	<methodparam><parameter role="keyword">y</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">mouse_button</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">time</parameter><initializer>GDK_CURRENT_TIME</initializer></methodparam>
      </methodsynopsis>
    </classsynopsis>

<programlisting>
<emphasis role="bold">Functions</emphasis>

<methodsynopsis language="python">
    <methodname><link linkend="function-gtk--item-factory-from-widget">gtk.item_factory_from_widget</link></methodname>
    <methodparam><parameter role="keyword">widget</parameter></methodparam>
  </methodsynopsis><methodsynopsis language="python">
    <methodname><link linkend="function-gtk--item-factory-path-from-widget">gtk.item_factory_path_from_widget</link></methodname>
    <methodparam><parameter role="keyword">widget</parameter></methodparam>
  </methodsynopsis></programlisting>

  </refsect1>

  <refsect1>
    <title>Ancestry</title>

<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
  +-- <link linkend="class-gtkobject">gtk.Object</link>
    +-- <link linkend="class-gtkitemfactory">gtk.ItemFactory</link>
</synopsis>

  </refsect1>

  <refsect1 id="properties-gtkitemfactory">
    <title>gtk.ItemFactory Properties</title>

    <para><link linkend="properties-gtkobject">gtk.Object Properties</link></para>

  </refsect1>

  <refsect1 id="signal-prototypes-gtkitemfactory">
    <title>gtk.ItemFactory 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>
  </refsect1>

  <refsect1>
    <title>Description</title>

    <warning>
      <para><link
linkend="class-gtkitemfactory"><classname>gtk.ItemFactory</classname></link>
is deprecated in PyGTK 2.4 and above. The <link
linkend="class-gtkuimanager"><classname>gtk.UIManager</classname></link>
should be used instead.</para>
    </warning>

    <para>The <link
linkend="class-gtkitemfactory"><classname>gtk.ItemFactory</classname></link>
provides a convenient way to create and manage menus, menubars and option
menus from a data description. The data description is a tuple or list
containing a list of entry tuples that each describe an individual menu,
menuitem, etc. Each entry tuple may contain the following entry fields
though only the path must be specified; the other fields are
optional:</para>

    <itemizedlist>
      <listitem>
	<simpara>A path that defines the logical position of the menu or
menuitem in the menu hierarchy. a path is similar to a file path in that it
starts with a slash (/) character and all components are joined by a slash
(/) character. The last component may have an underscore that indicates that
the following character is to be used as the accelerator mnemonic.</simpara>
      </listitem>
      <listitem>
	<simpara>An accelerator that defines a key sequence that will
activate the menuitem. The key sequence is a set of zero or more modifiers
followed by a single key. The modifier keys are:</simpara>

	<variablelist>
	  <varlistentry>
	    <term>"&lt;alt&gt;"</term>
	    <listitem>
	      <simpara><keycap>Alt-L</keycap>or
<keycap>Alt-R</keycap></simpara>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term>"&lt;ctl&gt;"</term>
	    <term>"&lt;ctrl&gt;"</term>
	    <term>"&lt;control&gt;"</term>
	    <listitem>
	      <simpara><keycap>Ctrl-L</keycap>or
<keycap>Ctrl-R</keycap></simpara>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term>"&lt;shift&gt;"</term>
	    <term>"&lt;shft&gt;"</term>
	    <listitem>
	      <simpara><keycap>Shift-L</keycap>or
<keycap>Shift-R</keycap></simpara>
	    </listitem>
	  </varlistentry>
	</variablelist>

      </listitem>
      <listitem>
	<simpara>A callback function or method that will be invoked when the
menu item is activated or the accelerator key sequence is pressed. The
callback function is defined as either:</simpara>

	<programlisting>
    def callback(callback_data, callback_action, widget)
    def callback(callback_action, widget)
</programlisting>

	<simpara>where <parameter>callback_action</parameter> is the
callback action defined below, <parameter>callback_data</parameter> is the
data passed with the <link
linkend="method-gtkitemfactory--create-items"><methodname>create_items</methodname>()</link> 
method and <parameter>widget</parameter> is the menuitem widget. The second
definition must be used if no <parameter>callback_data</parameter> argument
is specified by the call to <link
linkend="method-gtkitemfactory--create-items"><methodname>create_items</methodname>()</link>.</simpara>
      </listitem>
      <listitem>
	<simpara>A callback action that is an arbitrary integer
value.</simpara>
      </listitem>
      <listitem>
	<simpara>An item type is a string describing the type of the
item:</simpara>

	<variablelist>
	  <varlistentry>
	    <term>"None"</term>
	    <term>""</term>
	    <term>"Item"</term>
	    <listitem>
	      <simpara>a simple menu item</simpara>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term>"&lt;Title&gt;"</term>
	    <listitem>
	      <simpara>a title item</simpara>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term>"&lt;ImageItem&gt;"</term>
	    <listitem>
	      <simpara>an image item</simpara>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term>"&lt;StockItem&gt;"</term>
	    <listitem>
	      <simpara>an item holding a stock image</simpara>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term>"&lt;CheckItem&gt;"</term>
	    <listitem>
	      <simpara>a check item</simpara>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term>"&lt;ToggleItem&gt;"</term>
	    <listitem>
	      <simpara>a toggle item</simpara>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term>"&lt;RadioItem&gt;"</term>
	    <listitem>
	      <simpara>a radio item</simpara>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term>&lt;path&gt;</term>
	    <listitem>
	      <simpara>the path of a radio item group to add item
to</simpara>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term>"&lt;Separator&gt;"</term>
	    <listitem>
	      <simpara>a separator</simpara>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term>"&lt;Tearoff&gt;"</term>
	    <listitem>
	      <simpara>a tearoff separator</simpara>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term>"&lt;Branch&gt;"</term>
	    <listitem>
	      <simpara>an item to hold sub items</simpara>
	    </listitem>
	  </varlistentry>
	  <varlistentry>
	    <term>"&lt;LastBranch&gt;"</term>
	    <listitem>
	      <simpara>a right justified item to hold sub items</simpara>
	    </listitem>
	  </varlistentry>
	</variablelist>

      </listitem>
      <listitem>
	<simpara>extra data that is either a <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link> or a
stock ID</simpara>
      </listitem>
   </itemizedlist>

  </refsect1>

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

    <programlisting><constructorsynopsis language="python">
	<methodname>gtk.ItemFactory</methodname>
	<methodparam><parameter
		       role="keyword">container_type</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">path</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">accel_group</parameter><initializer>None</initializer></methodparam>
      </constructorsynopsis></programlisting>
    <variablelist>
      <varlistentry>
	<term><parameter
role="keyword">container_type</parameter>&nbsp;:</term>
	<listitem><simpara>the kind of menu to create; one of: <link
linkend="class-gtkmenubar"><classname>gtk.MenuBar</classname></link>, <link
linkend="class-gtkmenu"><classname>gtk.Menu</classname></link> or <link
linkend="class-gtkoptionmenu"><classname>gtk.OptionMenu</classname></link>.</simpara></listitem>
      </varlistentry>
      <varlistentry>
	<term><parameter role="keyword">path</parameter>&nbsp;:</term>
	<listitem><simpara>the path of the new item factory, a string of the
form <literal>"&lt;name&gt;"</literal></simpara></listitem>
      </varlistentry>
      <varlistentry>
	<term><parameter
role="keyword">accel_group</parameter>&nbsp;:</term>
	<listitem><simpara>a <link
linkend="class-gtkaccelgroup"><classname>gtk.AccelGroup</classname></link>
to which the accelerators for the menu items will be added, or
<literal>None</literal> to create a new one</simpara></listitem>
      </varlistentry>
      <varlistentry>
	<term><emphasis>Returns</emphasis>&nbsp;:</term>
	<listitem><simpara>a new <link
linkend="class-gtkitemfactory"><classname>gtk.ItemFactory</classname></link></simpara></listitem>
      </varlistentry>
    </variablelist>

    <para>Creates a new <link
linkend="class-gtkitemfactory"><classname>gtk.ItemFactory</classname></link>
object.</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-gtkitemfactory--construct">
      <title>gtk.ItemFactory.construct</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>construct</methodname>
	  <methodparam><parameter
			 role="keyword">container_type</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">path</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">accel_group</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter
role="keyword">container_type</parameter>&nbsp;:</term>
	  <listitem><simpara>the kind of menu to create; one of: <link
linkend="class-gtkmenubar"><classname>gtk.MenuBar</classname></link>, <link
linkend="class-gtkmenu"><classname>gtk.Menu</classname></link> or <link
linkend="class-gtkoptionmenu"><classname>gtk.OptionMenu</classname></link>.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">path</parameter>&nbsp;:</term>
	  <listitem><simpara>the path of the item factory, a string of the
form <literal>"&lt;name&gt;"</literal></simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter
role="keyword">accel_group</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gtkaccelgroup"><classname>gtk.AccelGroup</classname></link>
to which the accelerators for the menu items will be added, or
<literal>None</literal> to create a new one</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>construct</methodname>() method initializes an
item factory.</para>

    </refsect2>

    <refsect2 id="method-gtkitemfactory--get-item">
      <title>gtk.ItemFactory.get_item</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_item</methodname>
	  <methodparam><parameter
			 role="keyword">path</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">path</parameter>&nbsp;:</term>
	  <listitem><simpara>the path to the menu item</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the menu item with the specified
<parameter>path</parameter>, or <literal>None</literal> if
<parameter>path</parameter> doesn't lead to a menu item</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_item</methodname>() method returns the menu
item that corresponds to <parameter>path</parameter>. If the widget
corresponding to <parameter>path</parameter> is a menu item that opens a
submenu, then the item is returned. If you are interested in the submenu,
use the <link
linkend="method-gtkitemfactory--get-widget"><methodname>get_widget</methodname>()</link> 
method instead.</para>

    </refsect2>

    <refsect2 id="method-gtkitemfactory--get-widget">
      <title>gtk.ItemFactory.get_widget</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_widget</methodname>
	  <methodparam><parameter
			 role="keyword">path</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">path</parameter>&nbsp;:</term>
	  <listitem><simpara>the path to the widget</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the widget associated with the specified
<parameter>path</parameter>, or <literal>None</literal> if
<parameter>path</parameter> doesn't lead to a widget</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_widget</methodname>() method returns the
widget that corresponds to <parameter>path</parameter>. If the widget
corresponding to <parameter>path</parameter> is a menu item that opens a
submenu, then the submenu is returned. If you are interested in the menu
item, use <link
linkend="method-gtkitemfactory--get-item"><methodname>get_item</methodname>()</link> 
instead.</para>

    </refsect2>

    <refsect2 id="method-gtkitemfactory--get-widget-by-action">
      <title>gtk.ItemFactory.get_widget_by_action</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_widget_by_action</methodname>
	  <methodparam><parameter
			 role="keyword">action</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">action</parameter>&nbsp;:</term>
	  <listitem><simpara>a callback action value</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the widget that corresponds to the given
action, or <literal>None</literal> if no widget was
found</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_widget_by_action</methodname>() method
returns the widget that is associated with the specified
<parameter>action</parameter>. If there are multiple items with the same
<parameter>action</parameter>, the result is undefined.</para>

    </refsect2>

    <refsect2 id="method-gtkitemfactory--get-item-by-action">
      <title>gtk.ItemFactory.get_item_by_action</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_item_by_action</methodname>
	  <methodparam><parameter
			 role="keyword">action</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">action</parameter>&nbsp;:</term>
	  <listitem><simpara>a callback action value</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the menu item that corresponds to the specified
<parameter>action</parameter>, or <literal>None</literal> if no menu item
was found</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_item_by_action</methodname>() returns the
menu item that is associated with the specified
<parameter>action</parameter>.</para>

    </refsect2>

    <refsect2 id="method-gtkitemfactory--create-items">
      <title>gtk.ItemFactory.create_items</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>create_items</methodname>
	  <methodparam><parameter
			 role="keyword">entries</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">callback_data</parameter><initializer>None</initializer></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">entries</parameter>&nbsp;:</term>
	  <listitem><simpara>a tuple or list of item factory
entries</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter
role="keyword">callback_data</parameter>&nbsp;:</term>
	  <listitem><simpara>optional data passed to the callback functions
of all entries</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>create_items</methodname>() method creates the
menu items from the specified item factory <parameter>entries</parameter>.
If no <parameter>callback_data</parameter> is specified it will not be
passed to the callback functions i.e the callback functions will be passed
one less argument.</para>

    </refsect2>

    <refsect2 id="method-gtkitemfactory--delete-item">
      <title>gtk.ItemFactory.delete_item</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>delete_item</methodname>
	  <methodparam><parameter
			 role="keyword">path</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">path</parameter>&nbsp;:</term>
	  <listitem><simpara>a path</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>delete_item</methodname>() method deletes the
menu item that was created with the specified
<parameter>path</parameter>.</para>

    </refsect2>

    <refsect2 id="method-gtkitemfactory--popup">
      <title>gtk.ItemFactory.popup</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>popup</methodname>
	  <methodparam><parameter role="keyword">x</parameter></methodparam>
	  <methodparam><parameter role="keyword">y</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">mouse_button</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">time</parameter><initializer>0L</initializer></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">x</parameter>&nbsp;:</term>
	  <listitem><simpara>the x position</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">y</parameter>&nbsp;:</term>
	  <listitem><simpara>the y position</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter
role="keyword">mouse_button</parameter>&nbsp;:</term>
	  <listitem><simpara>the mouse button that was pressed to initiate
this action</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">time</parameter>&nbsp;:</term>
	  <listitem><simpara>an optional timestamp for this action; default
is 0L which means use the current time</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>popup</methodname>() method pops up the menu
constructed from the item factory at the specified location
(<parameter>x</parameter>, <parameter>y</parameter>). This method is
generally invoked in response to a "button_press_event" so the arguments are
retrieved from the event information.</para>

    </refsect2>

  </refsect1>

  <refsect1>
    <title>Functions</title>

    <refsect2 id="function-gtk--item-factory-from-widget">
      <title>gtk.item_factory_from_widget</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.item_factory_from_widget</methodname>
	  <methodparam><parameter
			 role="keyword">widget</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">widget</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gtkwidget"><classname>gtk.Widget</classname></link>
object</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the <link
	  linkend="class-gtkitemfactory"><classname>gtk.ItemFactory</classname></link>
	  that created <parameter>widget</parameter></simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>gtk.item_factory_from_widget</function>() function
returns the <link
linkend="class-gtkitemfactory"><classname>gtk.ItemFactory</classname></link>
object that created the <link
linkend="class-gtkwidget"><classname>gtk.Widget</classname></link> specified
by <parameter>widget</parameter>.</para>

    </refsect2>

    <refsect2 id="function-gtk--item-factory-path-from-widget">
      <title>gtk.item_factory_path_from_widget</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.item_factory_path_from_widget</methodname>
	  <methodparam><parameter
			 role="keyword">widget</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">widget</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gtkwidget"><classname>gtk.Widget</classname></link>
object</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the full path to the <link
linkend="class-gtkitemfactory"><classname>gtk.ItemFactory</classname></link>
that created <parameter>widget</parameter></simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>gtk.item_factory_path_from_widget</function>()
function returns the full path to the <link
linkend="class-gtkitemfactory"><classname>gtk.ItemFactory</classname></link>
that created the <link
linkend="class-gtkwidget"><classname>gtk.Widget</classname></link> specified
by <parameter>widget</parameter>.</para>

    </refsect2>

  </refsect1>

</refentry>