📄 gtkmenu.html
字号:
The main purpose of this function is to spare the programmer theinconvenience of having to call <a class="link" href="GtkMenuItem.html#gtk-menu-item-set-accel-path"><code class="function">gtk_menu_item_set_accel_path()</code></a> oneach menu item that should support runtime user changable accelerators.Instead, by just calling <a class="link" href="GtkMenu.html#gtk-menu-set-accel-path"><code class="function">gtk_menu_set_accel_path()</code></a> on their parent,each menu item of this menu, that contains a label describing its purpose,automatically gets an accel path assigned. For example, a menu containingmenu items "New" and "Exit", will, after <code class="literal">gtk_menu_set_accel_path (menu, "<Gnumeric-Sheet>/File");</code>has been called, assign its items the accel paths:<code class="literal">"<Gnumeric-Sheet>/File/New"</code> and <code class="literal">"<Gnumeric-Sheet>/File/Exit"</code>.Assigning accel paths to menu items then enables the user to changetheir accelerators at runtime. More details about accelerator pathsand their default setups can be found at <a class="link" href="gtk-Accelerator-Maps.html#gtk-accel-map-add-entry"><code class="function">gtk_accel_map_add_entry()</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</code></em> :</span></p></td><td> a valid <a class="link" href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>accel_path</code></em> :</span></p></td><td> a valid accelerator path</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3885787"></a><h3><a name="gtk-menu-set-title"></a>gtk_menu_set_title ()</h3><a class="indexterm" name="id3885801"></a><pre class="programlisting">void gtk_menu_set_title (<a class="link" href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu, const <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar">gchar</a> *title);</pre><p>Sets the title string for the menu. The title is displayed when the menuis shown as a tearoff menu. If <em class="parameter"><code>title</code></em> is <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>, the menu will see if it isattached to a parent menu item, and if so it will try to use the same text asthat menu item's label.</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</code></em> :</span></p></td><td> a <a class="link" href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>title</code></em> :</span></p></td><td> a string containing the title for the menu.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3885900"></a><h3><a name="gtk-menu-get-tearoff-state"></a>gtk_menu_get_tearoff_state ()</h3><a class="indexterm" name="id3885914"></a><pre class="programlisting"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> gtk_menu_get_tearoff_state (<a class="link" href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);</pre><p>Returns whether the menu is torn off. See<a class="link" href="GtkMenu.html#gtk-menu-set-tearoff-state"><code class="function">gtk_menu_set_tearoff_state()</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</code></em> :</span></p></td><td> a <a class="link" href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</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 is currently torn off.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3886004"></a><h3><a name="gtk-menu-get-title"></a>gtk_menu_get_title ()</h3><a class="indexterm" name="id3886016"></a><pre class="programlisting">const <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar">gchar</a>* gtk_menu_get_title (<a class="link" href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);</pre><p>Returns the title of the menu. See <a class="link" href="GtkMenu.html#gtk-menu-set-title"><code class="function">gtk_menu_set_title()</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</code></em> :</span></p></td><td> a <a class="link" href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the title of the menu, or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a> if the menu has notitle set on it. This string is owned by the widget and shouldnot be modified or freed.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3886108"></a><h3><a name="gtk-menu-popdown"></a>gtk_menu_popdown ()</h3><a class="indexterm" name="id3886121"></a><pre class="programlisting">void gtk_menu_popdown (<a class="link" href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);</pre><p>Removes the menu 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</code></em> :</span></p></td><td>a <a class="link" href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3886176"></a><h3><a name="gtk-menu-reposition"></a>gtk_menu_reposition ()</h3><a class="indexterm" name="id3886190"></a><pre class="programlisting">void gtk_menu_reposition (<a class="link" href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);</pre><p>Repositions the menu according to its position function.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>menu</code></em> :</span></p></td><td>a <a class="link" href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3886244"></a><h3><a name="gtk-menu-get-active"></a>gtk_menu_get_active ()</h3><a class="indexterm" name="id3886258"></a><pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* gtk_menu_get_active (<a class="link" href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);</pre><p>Returns the selected menu item from the menu. This is used by the <a class="link" href="GtkOptionMenu.html" title="GtkOptionMenu"><span class="type">GtkOptionMenu</span></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>menu</code></em> :</span></p></td><td>a <a class="link" href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the <a class="link" href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> that was last selected in the menu. If a selection has not yet been made, the first menu item is selected.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3886341"></a><h3><a name="gtk-menu-set-active"></a>gtk_menu_set_active ()</h3><a class="indexterm" name="id3886354"></a><pre class="programlisting">void gtk_menu_set_active (<a class="link" href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint">guint</a> index_);</pre><p>Selects the specified menu item within the menu. This is used by the<a class="link" href="GtkOptionMenu.html" title="GtkOptionMenu"><span class="type">GtkOptionMenu</span></a> and should not be used by anyone else.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>menu</code></em> :</span></p></td><td>a <a class="link" href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>index_</code></em> :</span></p></td><td>the index of the menu item to select. Index values are from0 to n-1.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3886441"></a><h3><a name="gtk-menu-set-tearoff-state"></a>gtk_menu_set_tearoff_state ()</h3><a class="indexterm" name="id3886455"></a><pre class="programlisting">void gtk_menu_set_tearoff_state (<a class="link" href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> torn_off);</pre><p>Changes the tearoff state of the menu. A menu is normally displayed as drop down menu which persists as long as the menu is active. It can also be displayed as a tearoff menu which persists until it is closed or reattached.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>menu</code></em> :</span></p></td><td>a <a class="link" href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>torn_off</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>, menu is displayed as a tearoff menu.</td></tr></tbody>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -