📄 gtkmenushell.html
字号:
<td><p><span class="term"><em class="parameter"><code>child</code></em> :</span></p></td><td>The <a class="link" href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> to add.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>position</code></em> :</span></p></td><td>The position in the item list where <em class="parameter"><code>child</code></em> is added.Positions are numbered from 0 to n-1.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id4269110"></a><h3><a name="gtk-menu-shell-deactivate"></a>gtk_menu_shell_deactivate ()</h3><a class="indexterm" name="id4269123"></a><pre class="programlisting">void gtk_menu_shell_deactivate (<a class="link" href="GtkMenuShell.html" title="GtkMenuShell">GtkMenuShell</a> *menu_shell);</pre><p>Deactivates the menu shell. Typically this results in the menu shellbeing erased from the screen.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>menu_shell</code></em> :</span></p></td><td>a <a class="link" href="GtkMenuShell.html" title="GtkMenuShell"><span class="type">GtkMenuShell</span></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id4269180"></a><h3><a name="gtk-menu-shell-select-item"></a>gtk_menu_shell_select_item ()</h3><a class="indexterm" name="id4269194"></a><pre class="programlisting">void gtk_menu_shell_select_item (<a class="link" href="GtkMenuShell.html" title="GtkMenuShell">GtkMenuShell</a> *menu_shell, <a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *menu_item);</pre><p>Selects the menu item from the menu shell.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>menu_shell</code></em> :</span></p></td><td>a <a class="link" href="GtkMenuShell.html" title="GtkMenuShell"><span class="type">GtkMenuShell</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>menu_item</code></em> :</span></p></td><td>The <a class="link" href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> to select.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id4269279"></a><h3><a name="gtk-menu-shell-select-first"></a>gtk_menu_shell_select_first ()</h3><a class="indexterm" name="id4269295"></a><pre class="programlisting">void gtk_menu_shell_select_first (<a class="link" href="GtkMenuShell.html" title="GtkMenuShell">GtkMenuShell</a> *menu_shell, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> search_sensitive);</pre><p>Select the first visible or selectable child of the menu shell;don't select tearoff items unless the only item is a tearoffitem.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>menu_shell</code></em> :</span></p></td><td> a <a class="link" href="GtkMenuShell.html" title="GtkMenuShell"><span class="type">GtkMenuShell</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>search_sensitive</code></em> :</span></p></td><td> if <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, search for the first selectable menu item, otherwise select nothing if the first item isn't sensitive. This should be <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if the menu is being popped up initially.</td></tr></tbody></table></div><p class="since">Since 2.2</p></div><hr><div class="refsect2" lang="en"><a name="id4269408"></a><h3><a name="gtk-menu-shell-deselect"></a>gtk_menu_shell_deselect ()</h3><a class="indexterm" name="id4269421"></a><pre class="programlisting">void gtk_menu_shell_deselect (<a class="link" href="GtkMenuShell.html" title="GtkMenuShell">GtkMenuShell</a> *menu_shell);</pre><p>Deselects the currently selected item from the menu shell, if any.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>menu_shell</code></em> :</span></p></td><td>a <a class="link" href="GtkMenuShell.html" title="GtkMenuShell"><span class="type">GtkMenuShell</span></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id4269478"></a><h3><a name="gtk-menu-shell-activate-item"></a>gtk_menu_shell_activate_item ()</h3><a class="indexterm" name="id4269492"></a><pre class="programlisting">void gtk_menu_shell_activate_item (<a class="link" href="GtkMenuShell.html" title="GtkMenuShell">GtkMenuShell</a> *menu_shell, <a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *menu_item, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> force_deactivate);</pre><p>Activates the menu item within the menu shell.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>menu_shell</code></em> :</span></p></td><td>a <a class="link" href="GtkMenuShell.html" title="GtkMenuShell"><span class="type">GtkMenuShell</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>menu_item</code></em> :</span></p></td><td>The <a class="link" href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> to activate.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>force_deactivate</code></em> :</span></p></td><td>If TRUE, force the deactivation of the menu shellafter the menu item is activated.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id4269601"></a><h3><a name="gtk-menu-shell-cancel"></a>gtk_menu_shell_cancel ()</h3><a class="indexterm" name="id4269616"></a><pre class="programlisting">void gtk_menu_shell_cancel (<a class="link" href="GtkMenuShell.html" title="GtkMenuShell">GtkMenuShell</a> *menu_shell);</pre><p>Cancels the selection within the menu shell.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>menu_shell</code></em> :</span></p></td><td> a <a class="link" href="GtkMenuShell.html" title="GtkMenuShell"><span class="type">GtkMenuShell</span></a></td></tr></tbody></table></div><p class="since">Since 2.4</p></div><hr><div class="refsect2" lang="en"><a name="id4269682"></a><h3><a name="gtk-menu-shell-set-take-focus"></a>gtk_menu_shell_set_take_focus ()</h3><a class="indexterm" name="id4269697"></a><pre class="programlisting">void gtk_menu_shell_set_take_focus (<a class="link" href="GtkMenuShell.html" title="GtkMenuShell">GtkMenuShell</a> *menu_shell, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> take_focus);</pre><p>If <em class="parameter"><code>take_focus</code></em> is <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> (the default) the menu shell will take the keyboard focus so that it will receive all keyboard events which is needed to enablekeyboard navigation in menus.</p><p>Setting <em class="parameter"><code>take_focus</code></em> to <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> is useful only for special applicationslike virtual keyboard implementations which should not take keyboardfocus.</p><p>The <em class="parameter"><code>take_focus</code></em> state of a menu or menu bar is automatically propagatedto submenus whenever a submenu is popped up, so you don't have to worryabout recursively setting it for your entire menu hierarchy. Only whenprogrammatically picking a submenu and popping it up manually, the<em class="parameter"><code>take_focus</code></em> property of the submenu needs to be set explicitely.</p><p>Note that setting it to <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> has side-effects:</p><p>If the focus is in some other app, it keeps the focus and keynav inthe menu doesn't work. Consequently, keynav on the menu will onlywork if the focus is on some toplevel owned by the onscreen keyboard.</p><p>To avoid confusing the user, menus with <em class="parameter"><code>take_focus</code></em> set to <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>should not display mnemonics or accelerators, since it cannot beguaranteed that they will work.</p><p>See also <ahref="/usr/share/gtk-doc/html/gdk/gdk-General.html#gdk-keyboard-grab"><code class="function">gdk_keyboard_grab()</code></a></p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>menu_shell</code></em> :</span></p></td><td> a <a class="link" href="GtkMenuShell.html" title="GtkMenuShell"><span class="type">GtkMenuShell</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>take_focus</code></em> :</span></p></td><td> <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the menu shell should take the keyboard focus on popup.</td></tr></tbody></table></div><p class="since">Since 2.8</p></div><hr><div class="refsect2" lang="en"><a name="id4269912"></a><h3><a name="gtk-menu-shell-get-take-focus"></a>gtk_menu_shell_get_take_focus ()</h3><a class="indexterm" name="id4269928"></a><pre class="programlisting"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> gtk_menu_shell_get_take_focus (<a class="link" href="GtkMenuShell.html" title="GtkMenuShell">GtkMenuShell</a> *menu_shell);</pre><p>Returns <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the menu shell will take the keyboard focus on popup.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>menu_shell</code></em> :</span></p></td><td> a <a class="link" href="GtkMenuShell.html" title="GtkMenuShell"><span class="type">GtkMenuShell</span></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the menu shell will take the keyboard focus on popup.</td></tr></tbody></table></div><p class="since">Since 2.8</p></div><hr><div class="refsect2" lang="en"><a name="id4270026"></a><h3><a name="GtkMenuDirectionType"></a>enum GtkMenuDirectionType</h3><a class="indexterm" name="id4270039"></a><pre class="programlisting">typedef enum{ GTK_MENU_DIR_PARENT, GTK_MENU_DIR_CHILD, GTK_MENU_DIR_NEXT, GTK_MENU_DIR_PREV} GtkMenuDirectionType;</pre><p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -