📄 gtkmenu.html
字号:
<div class="refsect2" lang="en"><a name="id3884687"></a><h3><a name="gtk-menu-reorder-child"></a>gtk_menu_reorder_child ()</h3><a class="indexterm" name="id3884700"></a><pre class="programlisting">void gtk_menu_reorder_child (<a class="link" href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu, <a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *child, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> position);</pre><p>Moves a <a class="link" href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> to a new position within the <a class="link" href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</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"><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 move.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>position</code></em> :</span></p></td><td>the new position to place <em class="parameter"><code>child</code></em>. Positions are numbered from 0 to n-1.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3884829"></a><h3><a name="gtk-menu-attach"></a>gtk_menu_attach ()</h3><a class="indexterm" name="id3884843"></a><pre class="programlisting">void gtk_menu_attach (<a class="link" href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu, <a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *child, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint">guint</a> left_attach, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint">guint</a> right_attach, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint">guint</a> top_attach, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint">guint</a> bottom_attach);</pre><p>Adds a new <a class="link" href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> to a (table) menu. The number of 'cells' thatan item will occupy is specified by <em class="parameter"><code>left_attach</code></em>, <em class="parameter"><code>right_attach</code></em>,<em class="parameter"><code>top_attach</code></em> and <em class="parameter"><code>bottom_attach</code></em>. These each represent the leftmost,rightmost, uppermost and lower column and row numbers of the table.(Columns and rows are indexed from zero).</p><p>Note that this function is not related to <a class="link" href="GtkMenu.html#gtk-menu-detach"><code class="function">gtk_menu_detach()</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"><em class="parameter"><code>child</code></em> :</span></p></td><td> a <a class="link" href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>left_attach</code></em> :</span></p></td><td> The column number to attach the left side of the item to.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>right_attach</code></em> :</span></p></td><td> The column number to attach the right side of the item to.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>top_attach</code></em> :</span></p></td><td> The row number to attach the top of the item to.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>bottom_attach</code></em> :</span></p></td><td> The row number to attach the bottom of the item to.</td></tr></tbody></table></div><p class="since">Since 2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3885076"></a><h3><a name="gtk-menu-popup"></a>gtk_menu_popup ()</h3><a class="indexterm" name="id3885089"></a><pre class="programlisting">void gtk_menu_popup (<a class="link" href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu, <a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *parent_menu_shell, <a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *parent_menu_item, <a class="link" href="GtkMenu.html#GtkMenuPositionFunc">GtkMenuPositionFunc</a> func, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer">gpointer</a> data, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint">guint</a> button, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> activate_time);</pre><p>Displays a menu and makes it available for selection. Applications can usethis function to display context-sensitive menus, and will typically supply<ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a> for the <em class="parameter"><code>parent_menu_shell</code></em>, <em class="parameter"><code>parent_menu_item</code></em>, <em class="parameter"><code>func</code></em> and <em class="parameter"><code>data</code></em> parameters. The default menu positioning function will position the menuat the current mouse cursor position.</p><p>The <em class="parameter"><code>button</code></em> parameter should be the mouse button pressed to initiatethe menu popup. If the menu popup was initiated by something other thana mouse button press, such as a mouse button release or a keypress,<em class="parameter"><code>button</code></em> should be 0.</p><p>The <em class="parameter"><code>activate_time</code></em> parameter is used to conflict-resolve initiation ofconcurrent requests for mouse/keyboard grab requests. To functionproperly, this needs to be the time stamp of the user event (such asa mouse click or key press) that caused the initiation of the popup.Only if no such event is available, <a class="link" href="gtk-General.html#gtk-get-current-event-time"><code class="function">gtk_get_current_event_time()</code></a> canbe used instead.</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>parent_menu_shell</code></em> :</span></p></td><td> the menu shell containing the triggering menu item, or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>parent_menu_item</code></em> :</span></p></td><td> the menu item whose activation triggered the popup, or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td><td> a user supplied function used to position the menu, or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td><td> user supplied data to be passed to <em class="parameter"><code>func</code></em>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>button</code></em> :</span></p></td><td> the mouse button which was pressed to initiate the event.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>activate_time</code></em> :</span></p></td><td> the time at which the activation event occurred.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3885399"></a><h3><a name="gtk-menu-set-accel-group"></a>gtk_menu_set_accel_group ()</h3><a class="indexterm" name="id3885412"></a><pre class="programlisting">void gtk_menu_set_accel_group (<a class="link" href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu, <a class="link" href="gtk-Keyboard-Accelerators.html#GtkAccelGroup">GtkAccelGroup</a> *accel_group);</pre><p>Set the <a class="link" href="gtk-Keyboard-Accelerators.html#GtkAccelGroup"><span class="type">GtkAccelGroup</span></a> which holds global accelerators for the menu.This accelerator group needs to also be added to all windows thatthis menu is being used in with <a class="link" href="GtkWindow.html#gtk-window-add-accel-group"><code class="function">gtk_window_add_accel_group()</code></a>, in orderfor those windows to support all the accelerators contained in this group.</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>accel_group</code></em> :</span></p></td><td>the <a class="link" href="gtk-Keyboard-Accelerators.html#GtkAccelGroup"><span class="type">GtkAccelGroup</span></a> to be associated with the menu.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3885521"></a><h3><a name="gtk-menu-get-accel-group"></a>gtk_menu_get_accel_group ()</h3><a class="indexterm" name="id3885534"></a><pre class="programlisting"><a class="link" href="gtk-Keyboard-Accelerators.html#GtkAccelGroup">GtkAccelGroup</a>* gtk_menu_get_accel_group (<a class="link" href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);</pre><p>Gets the <a class="link" href="gtk-Keyboard-Accelerators.html#GtkAccelGroup"><span class="type">GtkAccelGroup</span></a> which holds global accelerators for the menu.See <a class="link" href="GtkMenu.html#gtk-menu-set-accel-group"><code class="function">gtk_menu_set_accel_group()</code></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="gtk-Keyboard-Accelerators.html#GtkAccelGroup"><span class="type">GtkAccelGroup</span></a> associated with the menu.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3885627"></a><h3><a name="gtk-menu-set-accel-path"></a>gtk_menu_set_accel_path ()</h3><a class="indexterm" name="id3885640"></a><pre class="programlisting">void gtk_menu_set_accel_path (<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> *accel_path);</pre><p>Sets an accelerator path for this menu from which accelerator pathsfor its immediate children, its menu items, can be constructed.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -