/usr/share/gtk-doc/html/pygtk/class-gtkmenushell.html is in python-gtk2-doc 2.24.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gtk.MenuShell</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="gtk-class-reference.html" title="The gtk Class Reference"><link rel="prev" href="class-gtkmenuitem.html" title="gtk.MenuItem"><link rel="next" href="class-gtkmenutoolbutton.html" title="gtk.MenuToolButton"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">gtk.MenuShell</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtkmenuitem.html">Prev</a> </td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-gtkmenutoolbutton.html">Next</a></td></tr></table><hr></div><div class="refentry" title="gtk.MenuShell"><a name="class-gtkmenushell"></a><div class="titlepage"></div><div class="refnamediv"><h2>gtk.MenuShell</h2><p>gtk.MenuShell — a base class for menu objects.</p></div><div class="refsect1" title="Synopsis"><a name="id3794184"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.MenuShell</span></span>(<span class="ooclass"><span class="classname"><a class="link" href="class-gtkcontainer.html" title="gtk.Container">gtk.Container</a></span></span>):
<code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenushell.html#method-gtkmenushell--append" title="gtk.MenuShell.append">append</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>child</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenushell.html#method-gtkmenushell--prepend" title="gtk.MenuShell.prepend">prepend</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>child</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenushell.html#method-gtkmenushell--insert" title="gtk.MenuShell.insert">insert</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>child</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>position</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenushell.html#method-gtkmenushell--deactivate" title="gtk.MenuShell.deactivate">deactivate</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenushell.html#method-gtkmenushell--select-item" title="gtk.MenuShell.select_item">select_item</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>menu_item</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenushell.html#method-gtkmenushell--deselect" title="gtk.MenuShell.deselect">deselect</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenushell.html#method-gtkmenushell--activate-item" title="gtk.MenuShell.activate_item">activate_item</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>menu_item</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>force_deactivate</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenushell.html#method-gtkmenushell--select-first" title="gtk.MenuShell.select_first">select_first</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>search_sensitive</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenushell.html#method-gtkmenushell--cancel" title="gtk.MenuShell.cancel">cancel</a></span>()</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenushell.html#method-gtkmenushell--set-take-focus" title="gtk.MenuShell.set_take_focus">set_take_focus</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>take_focus</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenushell.html#method-gtkmenushell--get-take-focus" title="gtk.MenuShell.get_take_focus">get_take_focus</a></span>()</code><br></pre></td></tr></table></div><div class="refsect1" title="Ancestry"><a name="id3794501"></a><h2>Ancestry</h2><pre class="synopsis">+-- <PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK>
+-- <a class="link" href="class-gtkobject.html" title="gtk.Object">gtk.Object</a>
+-- <a class="link" href="class-gtkwidget.html" title="gtk.Widget">gtk.Widget</a>
+-- <a class="link" href="class-gtkcontainer.html" title="gtk.Container">gtk.Container</a>
+-- <a class="link" href="class-gtkmenushell.html" title="gtk.MenuShell">gtk.MenuShell</a>
</pre></div><div class="refsect1" title="Implemented Interfaces"><a name="id3794545"></a><h2>Implemented Interfaces</h2><p>
<a class="link" href="class-gtkmenushell.html" title="gtk.MenuShell"><code class="classname">gtk.MenuShell</code></a>
implements
<a class="link" href="class-gtkbuildable.html" title="gtk.Buildable"><code class="classname">gtk.Buildable</code></a>
</p></div><div class="refsect1" title="gtk.MenuShell Properties"><a name="properties-gtkmenushell"></a><h2>gtk.MenuShell Properties</h2><p><a class="link" href="class-gtkobject.html#properties-gtkobject" title="gtk.Object Properties">gtk.Object Properties</a></p><p><a class="link" href="class-gtkwidget.html#properties-gtkwidget" title="gtk.Widget Properties">gtk.Widget Properties</a></p><p><a class="link" href="class-gtkcontainer.html#properties-gtkcontainer" title="gtk.Container Properties">gtk.Container Properties</a></p><div class="blockquote"><table width="100%" border="0" bgcolor="#E0E0E0"><tr><td valign="top"><div class="informaltable"><table width="100%" border="0"><colgroup><col width="1in"><col width="1in"><col width="4in"></colgroup><tbody><tr valign="top"><td valign="top">"take-focus"</td><td valign="top">Read-Write</td><td valign="top">If <code class="literal">True</code> the menu and its submenus grab
the keyboard focus on popup. Default value: <code class="literal">True</code>.
Available in GTK+ 2.8 and above.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" title="gtk.MenuShell Style Properties"><a name="style-properties-gtkmenushell"></a><h2>gtk.MenuShell Style Properties</h2><p><a class="link" href="class-gtkwidget.html#style-properties-gtkwidget" title="gtk.Widget Style Properties">gtk.Widget Style Properties</a></p></div><div class="refsect1" title="gtk.MenuShell Signal Prototypes"><a name="signal-prototypes-gtkmenushell"></a><h2>gtk.MenuShell Signal Prototypes</h2><p><PYGTKDOCLINK HREF="signal-prototypes-gobject">gobject.GObject Signal Prototypes</PYGTKDOCLINK></p><p><a class="link" href="class-gtkobject.html#signal-prototypes-gtkobject" title="gtk.Object Signal Prototypes">gtk.Object Signal Prototypes</a></p><p><a class="link" href="class-gtkwidget.html#signal-prototypes-gtkwidget" title="gtk.Widget Signal Prototypes">gtk.Widget Signal Prototypes</a></p><p><a class="link" href="class-gtkcontainer.html#signal-prototypes-gtkcontainer" title="gtk.Container Signal Prototypes">gtk.Container Signal Prototypes</a></p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term">"<a class="link" href="class-gtkmenushell.html#signal-gtkmenushell--activate-current" title='The "activate-current" gtk.MenuShell Signal'>activate-current</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>menushell</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>force_hide</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr><tr><td><p><span class="term">"<a class="link" href="class-gtkmenushell.html#signal-gtkmenushell--cancel" title='The "cancel" gtk.MenuShell Signal'>cancel</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>menushell</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr><tr><td><p><span class="term">"<a class="link" href="class-gtkmenushell.html#signal-gtkmenushell--cycle-focus" title='The "cycle-focus" gtk.MenuShell Signal'>cycle-focus</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>menushell</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>direction</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr><tr><td><p><span class="term">"<a class="link" href="class-gtkmenushell.html#signal-gtkmenushell--deactivate" title='The "deactivate" gtk.MenuShell Signal'>deactivate</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>menushell</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr><tr><td><p><span class="term">"<a class="link" href="class-gtkmenushell.html#signal-gtkmenushell--move-current" title='The "move-current" gtk.MenuShell Signal'>move-current</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>menushell</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>direction</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr><tr><td><p><span class="term">"<a class="link" href="class-gtkmenushell.html#signal-gtkmenushell--move-selected" title='The "move-selected" gtk.MenuShell Signal'>move-selected</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>menushell</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>distance</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr><tr><td><p><span class="term">"<a class="link" href="class-gtkmenushell.html#signal-gtkmenushell--selection-done" title='The "selection-done" gtk.MenuShell Signal'>selection-done</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>menushell</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr></tbody></table></div><div class="refsect1" title="Description"><a name="id3795260"></a><h2>Description</h2><p>A <a class="link" href="class-gtkmenushell.html" title="gtk.MenuShell"><code class="classname">gtk.MenuShell</code></a> is
the abstract base class used to derive the <a class="link" href="class-gtkmenu.html" title="gtk.Menu"><code class="classname">gtk.Menu</code></a> and <a class="link" href="class-gtkmenubar.html" title="gtk.MenuBar"><code class="classname">gtk.MenuBar</code></a>
subclasses. A <a class="link" href="class-gtkmenushell.html" title="gtk.MenuShell"><code class="classname">gtk.MenuShell</code></a> is
a container of <a class="link" href="class-gtkmenuitem.html" title="gtk.MenuItem"><code class="classname">gtk.MenuItem</code></a>
objects arranged in a list which can be navigated, selected, and activated
by the user to perform application functions. A <a class="link" href="class-gtkmenuitem.html" title="gtk.MenuItem"><code class="classname">gtk.MenuItem</code></a> can
have a submenu associated with it, allowing for nested hierarchical
menus.</p></div><div class="refsect1" title="Methods"><a name="id3795320"></a><h2>Methods</h2><div class="refsect2" title="gtk.MenuShell.append"><a name="method-gtkmenushell--append"></a><h3>gtk.MenuShell.append</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">append</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>child</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>child</code></strong> :</span></p></td><td>The <a class="link" href="class-gtkmenuitem.html" title="gtk.MenuItem"><code class="classname">gtk.MenuItem</code></a> to
add.</td></tr></tbody></table><p>The <code class="methodname">append</code>() method adds a new <a class="link" href="class-gtkmenuitem.html" title="gtk.MenuItem"><code class="classname">gtk.MenuItem</code></a>
specified by <em class="parameter"><code>child</code></em> to the end of the menu shell's
item list.</p></div><div class="refsect2" title="gtk.MenuShell.prepend"><a name="method-gtkmenushell--prepend"></a><h3>gtk.MenuShell.prepend</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">prepend</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>child</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>child</code></strong> :</span></p></td><td>The <a class="link" href="class-gtkmenuitem.html" title="gtk.MenuItem"><code class="classname">gtk.MenuItem</code></a> to
add.</td></tr></tbody></table><p>The <code class="methodname">prepend</code>() method adds a new <a class="link" href="class-gtkmenuitem.html" title="gtk.MenuItem"><code class="classname">gtk.MenuItem</code></a>
specified by <em class="parameter"><code>child</code></em> to the beginning of the menu
shell's item list.</p></div><div class="refsect2" title="gtk.MenuShell.insert"><a name="method-gtkmenushell--insert"></a><h3>gtk.MenuShell.insert</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">insert</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>child</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>position</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>child</code></strong> :</span></p></td><td>The <a class="link" href="class-gtkmenuitem.html" title="gtk.MenuItem"><code class="classname">gtk.MenuItem</code></a> to
add.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>position</code></strong> :</span></p></td><td>The position in the item list where child
should be added. Positions are numbered starting from
0.</td></tr></tbody></table><p>The <code class="methodname">insert</code>() method adds a new <a class="link" href="class-gtkmenuitem.html" title="gtk.MenuItem"><code class="classname">gtk.MenuItem</code></a>
specified by <em class="parameter"><code>child</code></em> to the menu shell's item list at
the position specified by <em class="parameter"><code>position</code></em>. </p></div><div class="refsect2" title="gtk.MenuShell.deactivate"><a name="method-gtkmenushell--deactivate"></a><h3>gtk.MenuShell.deactivate</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">deactivate</span>(<span class="methodparam"></span>)</code></pre><p>The <code class="methodname">deactivate</code>() method deactivates the
menu shell. Typically this results in the menu shell being removed from the
screen.</p></div><div class="refsect2" title="gtk.MenuShell.select_item"><a name="method-gtkmenushell--select-item"></a><h3>gtk.MenuShell.select_item</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">select_item</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>menu_item</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>menu_item</code></strong> :</span></p></td><td>The <a class="link" href="class-gtkmenuitem.html" title="gtk.MenuItem"><code class="classname">gtk.MenuItem</code></a> to
select.</td></tr></tbody></table><p>The <code class="methodname">select_item</code>() method selects the
menu item specified by <em class="parameter"><code>menu_item</code></em> from the menu
shell.</p></div><div class="refsect2" title="gtk.MenuShell.deselect"><a name="method-gtkmenushell--deselect"></a><h3>gtk.MenuShell.deselect</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">deselect</span>(<span class="methodparam"></span>)</code></pre><p>The <code class="methodname">deselect</code>() method deselects the
currently selected item from the menu shell, if any.</p></div><div class="refsect2" title="gtk.MenuShell.activate_item"><a name="method-gtkmenushell--activate-item"></a><h3>gtk.MenuShell.activate_item</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">activate_item</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>menu_item</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>force_deactivate</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>menu_item</code></strong> :</span></p></td><td>The <a class="link" href="class-gtkmenuitem.html" title="gtk.MenuItem"><code class="classname">gtk.MenuItem</code></a> to
activate.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>force_deactivate</code></strong> :</span></p></td><td>If <code class="literal">True</code>, force the
deactivation of the menu shell after the menu item is
activated.</td></tr></tbody></table><p>The <code class="methodname">activate_item</code>() method activates
the menu item specified by<em class="parameter"><code> menu_item</code></em>. If
<em class="parameter"><code>force_deactivate</code></em> is <code class="literal">True</code> the
menushell is forcibly deactivated after<em class="parameter"><code> menu_item</code></em> is
activated.</p></div><div class="refsect2" title="gtk.MenuShell.select_first"><a name="method-gtkmenushell--select-first"></a><h3>gtk.MenuShell.select_first</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">select_first</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>search_sensitive</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>search_sensitive</code></strong> :</span></p></td><td>if <code class="literal">True</code>, search for the
first selectable menu item, otherwise select nothing if the first
item isn't sensitive.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.2 and above.</p></div><p>The <code class="methodname">select_first</code>() method selects the
first visible or selectable child of the menu shell if
<em class="parameter"><code>search_sensitive</code></em> is <code class="literal">True</code>. Don't
select tearoff items unless the only item is a tearoff item. If
<em class="parameter"><code>search_sensitive</code></em> is <code class="literal">False</code> select
nothing if the first item isn't sensitive.
<em class="parameter"><code>search_sensitive</code></em> should be <code class="literal">False</code>
if the menu is being popped up initially.</p></div><div class="refsect2" title="gtk.MenuShell.cancel"><a name="method-gtkmenushell--cancel"></a><h3>gtk.MenuShell.cancel</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">cancel</span>(<span class="methodparam"></span>)</code></pre><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <code class="methodname">cancel</code>() method cancels the
selection within the menu shell.</p></div><div class="refsect2" title="gtk.MenuShell.set_take_focus"><a name="method-gtkmenushell--set-take-focus"></a><h3>gtk.MenuShell.set_take_focus</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_take_focus</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>take_focus</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>take_focus</code></strong> :</span></p></td><td>if <code class="literal">True</code>, the menu shell should
take the keyboard focus on popup.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.8 and above.</p></div><p>The <code class="methodname">set_take_focus</code>() method sets the
"take-focus" property to the value of <em class="parameter"><code>take_focus</code></em>. If
<em class="parameter"><code>take_focus</code></em> is <code class="literal">True</code> the menu shell
will take the keyboard focus so that it will receive all keyboard events to
enable keyboard navigation in menus.</p><p>Setting the "take-focus" property to <code class="literal">False</code> is
useful only for special applications like virtual keyboard implementations
which should not take keyboard focus.</p><p>The "take-focus" state of a menu or menu bar is automatically
propagated to submenus whenever a submenu is popped up, so you don't have to
worry about recursively setting it for your entire menu hierarchy. Only when
programmatically picking a submenu and popping it up manually, should the
"take-focus" property of the submenu be set explicitly.</p><p>Note that setting it to False has side-effects:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>If the focus is in some other app, it keeps the focus and
keyboard navigation in the menu doesn't work. Consequently, keyboard
navigation on the menu will only work if the focus is on some toplevel owned
by the onscreen keyboard.</p></li><li class="listitem"><p>To avoid confusing the user, menus with the "take-focus"
property set to <code class="literal">False</code> should not display mnemonics or
accelerators, since they may not work.</p></li></ul></div><p>Also see the <a class="link" href="gdk-functions.html#function-gdk--keyboard-grab" title="gtk.gdk.keyboard_grab"><code class="function">gtk.gdk.keyboard_grab</code>()</a>
function for more information.</p></div><div class="refsect2" title="gtk.MenuShell.get_take_focus"><a name="method-gtkmenushell--get-take-focus"></a><h3>gtk.MenuShell.get_take_focus</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_take_focus</span>()</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if the men shell will
take keyboard foucs on popup.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.8 and above.</p></div><p>The <code class="methodname">get_take_focus</code>() method returns the
value of the "take-focus" property. See the <a class="link" href="class-gtkmenushell.html#method-gtkmenushell--set-take-focus" title="gtk.MenuShell.set_take_focus"><code class="methodname">set_take_focus</code>()</a>
method for more information.</p></div></div><div class="refsect1" title="Signals"><a name="id3796376"></a><h2>Signals</h2><div class="refsect2" title='The "activate-current" gtk.MenuShell Signal'><a name="signal-gtkmenushell--activate-current"></a><h3>The "activate-current" gtk.MenuShell Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>menushell</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>force_hide</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>menushell</code></em> :</span></p></td><td>the menushell that received the
signal</td></tr><tr><td><p><span class="term"><em class="parameter"><code>force_hide</code></em> :</span></p></td><td>if True, hide the menu after activating the
menu item.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_param1</code></em> :</span></p></td><td>the first user parameter (if any) specified
with the <PYGTKDOCLINK HREF="method-gobject--connect"><code class="methodname">connect</code>()</PYGTKDOCLINK>
method</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td>additional user parameters (if
any)</td></tr></tbody></table><p>The "activate-current" signal is emitted to activate the current
menu item in the menushell.</p></div><div class="refsect2" title='The "cancel" gtk.MenuShell Signal'><a name="signal-gtkmenushell--cancel"></a><h3>The "cancel" gtk.MenuShell Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>menushell</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>menushell</code></em> :</span></p></td><td>the menushell that received the
signal</td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_param1</code></em> :</span></p></td><td>the first user parameter (if any) specified
with the <PYGTKDOCLINK HREF="method-gobject--connect"><code class="methodname">connect</code>()</PYGTKDOCLINK>
method</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td>additional user parameters (if
any)</td></tr></tbody></table><p>The "cancel" signal is emitted to cancel the selection in the
menushell. Also causes the "<a class="link" href="class-gtkmenushell.html#signal-gtkmenushell--selection-done" title='The "selection-done" gtk.MenuShell Signal'>selection-done</a>" signal
to be emitted. </p></div><div class="refsect2" title='The "cycle-focus" gtk.MenuShell Signal'><a name="signal-gtkmenushell--cycle-focus"></a><h3>The "cycle-focus" gtk.MenuShell Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>menushell</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>menushell</code></em> :</span></p></td><td>the menushell that received the
signal</td></tr><tr><td><p><span class="term"><em class="parameter"><code>direction</code></em> :</span></p></td><td>the direction to cycle the focus; one of:
<code class="literal">gtk.DIR_TAB_FORWARD</code>,
<code class="literal">gtk.DIR_TAB_BACKWARD</code>, <code class="literal">gtk.DIR_UP</code>,
<code class="literal">gtk.DIR_DOWN</code>, <code class="literal">gtk.DIR_LEFT</code> or
<code class="literal">gtk.DIR_RIGHT</code></td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_param1</code></em> :</span></p></td><td>the first user parameter (if any) specified
with the <PYGTKDOCLINK HREF="method-gobject--connect"><code class="methodname">connect</code>()</PYGTKDOCLINK>
method</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td>additional user parameters (if
any)</td></tr></tbody></table><p>The "cycle-focus" signal is emitted when an action occurs requesting the focus move to the next menubar.</p></div><div class="refsect2" title='The "deactivate" gtk.MenuShell Signal'><a name="signal-gtkmenushell--deactivate"></a><h3>The "deactivate" gtk.MenuShell Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>menushell</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>menushell</code></em> :</span></p></td><td>the menushell that received the
signal</td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_param1</code></em> :</span></p></td><td>the first user parameter (if any) specified
with the <PYGTKDOCLINK HREF="method-gobject--connect"><code class="methodname">connect</code>()</PYGTKDOCLINK>
method</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td>additional user parameters (if
any)</td></tr></tbody></table><p>The "deactivate" signal is emitted when the menushell is
deactivated.</p></div><div class="refsect2" title='The "move-current" gtk.MenuShell Signal'><a name="signal-gtkmenushell--move-current"></a><h3>The "move-current" gtk.MenuShell Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>menushell</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>direction</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>menushell</code></em> :</span></p></td><td>the menushell that received the
signal</td></tr><tr><td><p><span class="term"><em class="parameter"><code>direction</code></em> :</span></p></td><td>the direction to move; one of:
<code class="literal">gtk.MENU_DIR_PARENT</code>,
<code class="literal">gtk.MENU_DIR_CHILD</code>, <code class="literal">gtk.MENU_DIR_NEXT</code>
or <code class="literal">gtk.MENU_DIR_PREV</code></td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_param1</code></em> :</span></p></td><td>the first user parameter (if any) specified
with the <PYGTKDOCLINK HREF="method-gobject--connect"><code class="methodname">connect</code>()</PYGTKDOCLINK>
method</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td>additional user parameters (if
any)</td></tr></tbody></table><p>The "move-current" signal is emitted when the current menu item
is to be moved in the direction specified by
<em class="parameter"><code>direction</code></em> which is one of:</p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><code class="literal">gtk.MENU_DIR_PARENT</code></span></p></td><td>To the parent menu shell.</td></tr><tr><td><p><span class="term"><code class="literal">gtk.MENU_DIR_CHILD</code></span></p></td><td>To the submenu, if any, associated with the
item.</td></tr><tr><td><p><span class="term"><code class="literal">gtk.MENU_DIR_NEXT</code></span></p></td><td>To the next menu item.</td></tr><tr><td><p><span class="term"><code class="literal">gtk.MENU_DIR_PREV</code></span></p></td><td>To the previous menu item.</td></tr></tbody></table></div><div class="refsect2" title='The "move-selected" gtk.MenuShell Signal'><a name="signal-gtkmenushell--move-selected"></a><h3>The "move-selected" gtk.MenuShell Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>menushell</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>distance</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>menushell</code></em> :</span></p></td><td>the menushell that received the
signal</td></tr><tr><td><p><span class="term"><em class="parameter"><code>distance</code></em> :</span></p></td><td>+1 to move to the next item,
-1 to move to the previous</td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_param1</code></em> :</span></p></td><td>the first user parameter (if any) specified
with the <PYGTKDOCLINK HREF="method-gobject--connect"><code class="methodname">connect</code>()</PYGTKDOCLINK>
method</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td>additional user parameters (if
any)</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This signal is available in GTK+ 2.12 and above.</p></div><p>The "move-selected" signal is emitted to move the selection to another item.</p></div><div class="refsect2" title='The "selection-done" gtk.MenuShell Signal'><a name="signal-gtkmenushell--selection-done"></a><h3>The "selection-done" gtk.MenuShell Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>menushell</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>menushell</code></em> :</span></p></td><td>the menushell that received the
signal</td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_param1</code></em> :</span></p></td><td>the first user parameter (if any) specified
with the <PYGTKDOCLINK HREF="method-gobject--connect"><code class="methodname">connect</code>()</PYGTKDOCLINK>
method</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td>additional user parameters (if
any)</td></tr></tbody></table><p>The "selection-done" signal is emitted when a selection has been
completed within a menu shell.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="class-gtkmenuitem.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="gtk-class-reference.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="class-gtkmenutoolbutton.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.MenuItem </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> gtk.MenuToolButton</td></tr></table></div></body></html>
|