|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /usr/share/gtk-doc/html/gtk/ |
Upload File : |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>GtkMenu</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
<link rel="start" href="index.html" title="GTK+ Reference Manual">
<link rel="up" href="MenusAndCombos.html" title="Menus, Combo Box, Toolbar">
<link rel="prev" href="GtkComboBoxEntry.html" title="GtkComboBoxEntry">
<link rel="next" href="GtkMenuBar.html" title="GtkMenuBar">
<meta name="generator" content="GTK-Doc V1.6 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="part" href="gtk.html" title="Part I. GTK+ Overview">
<link rel="part" href="gtkbase.html" title="Part II. GTK+ Core Reference">
<link rel="part" href="gtkobjects.html" title="Part III. GTK+ Widgets and Objects">
<link rel="chapter" href="ch01.html" title="Object Hierarchy">
<link rel="chapter" href="ch02.html" title="Widget Gallery">
<link rel="chapter" href="WindowWidgets.html" title="Windows">
<link rel="chapter" href="DisplayWidgets.html" title="Display Widgets">
<link rel="chapter" href="ButtonWidgets.html" title="Buttons and Toggles">
<link rel="chapter" href="NumericEntry.html" title="Numeric/Text Data Entry">
<link rel="chapter" href="TextWidgetObjects.html" title="Multiline Text Editor">
<link rel="chapter" href="TreeWidgetObjects.html" title="Tree, List and Icon Grid Widgets">
<link rel="chapter" href="MenusAndCombos.html" title="Menus, Combo Box, Toolbar">
<link rel="chapter" href="Actions.html" title="Action-based menus and toolbars">
<link rel="chapter" href="SelectorWidgets.html" title="Selectors (File/Font/Color/Input Devices)">
<link rel="chapter" href="LayoutContainers.html" title="Layout Containers">
<link rel="chapter" href="Ornaments.html" title="Ornaments">
<link rel="chapter" href="ScrollingWidgets.html" title="Scrolling">
<link rel="chapter" href="Printing.html" title="Printing">
<link rel="chapter" href="MiscObjects.html" title="Miscellaneous">
<link rel="chapter" href="AbstractObjects.html" title="Abstract Base Classes">
<link rel="chapter" href="PlugSocket.html" title="Cross-process Embedding">
<link rel="chapter" href="SpecialObjects.html" title="Special-purpose features">
<link rel="chapter" href="RecentDocuments.html" title="Recently Used Documents">
<link rel="chapter" href="DeprecatedObjects.html" title="Deprecated">
<link rel="part" href="migrating.html" title="Part IV. Migrating from Previous Versions of GTK+">
<link rel="chapter" href="gtk-migrating-checklist.html" title="Migration Checklist">
<link rel="chapter" href="gtk-migrating-GtkFileChooser.html" title="Migrating from GtkFileSelection to GtkFileChooser">
<link rel="chapter" href="gtk-migrating-GtkAction.html" title="Migrating from old menu and toolbar systems to GtkAction">
<link rel="chapter" href="gtk-migrating-GtkComboBox.html" title="Migrating from GtkOptionMenu and GtkCombo to GtkComboBox and
GtkComboBoxEntry">
<link rel="chapter" href="gtk-migrating-GtkIconView.html" title="Migrating from GnomeIconList to GtkIconView">
<link rel="chapter" href="gtk-migrating-GtkAboutDialog.html" title="Migrating from GnomeAbout to GtkAboutDialog">
<link rel="chapter" href="gtk-migrating-GtkColorButton.html" title="Migrating from GnomeColorPicker to GtkColorButton">
<link rel="chapter" href="gtk-migrating-GtkAssistant.html" title="Migrating from GnomeDruid to GtkAssistant">
<link rel="chapter" href="gtk-migrating-GtkRecentChooser.html" title="Migrating from EggRecent to GtkRecentChooser">
<link rel="chapter" href="gtk-migrating-GtkLinkButton.html" title="Migrating from GnomeHRef to GtkLinkButton">
<link rel="part" href="pt05.html" title="Part V. GTK+ Tools">
<link rel="glossary" href="glossary.html" title="Glossary">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
<link rel="index" href="ix07.html" title="Index of new symbols in 2.10">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="GtkComboBoxEntry.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="MenusAndCombos.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GTK+ Reference Manual</th>
<td><a accesskey="n" href="GtkMenuBar.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id3271171" class="shortcut">Top</a>
 | 
<a href="#id3272325" class="shortcut">Description</a>
 | 
<a href="#id3271942" class="shortcut">Object Hierarchy</a>
 | 
<a href="#id3272012" class="shortcut">Implemented Interfaces</a>
 | 
<a href="#id3272035" class="shortcut">Properties</a>
 | 
<a href="#id3272086" class="shortcut">Child Properties</a>
 | 
<a href="#id3272169" class="shortcut">Style Properties</a>
 | 
<a href="#id3272268" class="shortcut">Signals</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="GtkMenu"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id3271171"></a><span class="refentrytitle">GtkMenu</span>
</h2>
<p>GtkMenu — A menu widget</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">
#include <gtk/gtk.h>
<a href="GtkMenu.html#GtkMenu-struct">GtkMenu</a>;
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* <a href="GtkMenu.html#gtk-menu-new">gtk_menu_new</a> (void);
void <a href="GtkMenu.html#gtk-menu-set-screen">gtk_menu_set_screen</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
<a
href="../gdk/GdkScreen.html"
>GdkScreen</a> *screen);
#define <a href="GtkMenu.html#gtk-menu-append">gtk_menu_append</a> (menu,child)
#define <a href="GtkMenu.html#gtk-menu-prepend">gtk_menu_prepend</a> (menu,child)
#define <a href="GtkMenu.html#gtk-menu-insert">gtk_menu_insert</a> (menu,child,pos)
void <a href="GtkMenu.html#gtk-menu-reorder-child">gtk_menu_reorder_child</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *child,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> position);
void <a href="GtkMenu.html#gtk-menu-attach">gtk_menu_attach</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *child,
<a
href="../glib/glib-Basic-Types.html#guint"
>guint</a> left_attach,
<a
href="../glib/glib-Basic-Types.html#guint"
>guint</a> right_attach,
<a
href="../glib/glib-Basic-Types.html#guint"
>guint</a> top_attach,
<a
href="../glib/glib-Basic-Types.html#guint"
>guint</a> bottom_attach);
void <a href="GtkMenu.html#gtk-menu-popup">gtk_menu_popup</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *parent_menu_shell,
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *parent_menu_item,
<a href="GtkMenu.html#GtkMenuPositionFunc">GtkMenuPositionFunc</a> func,
<a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a> data,
<a
href="../glib/glib-Basic-Types.html#guint"
>guint</a> button,
<a
href="../glib/glib-Basic-Types.html#guint32"
>guint32</a> activate_time);
void <a href="GtkMenu.html#gtk-menu-set-accel-group">gtk_menu_set_accel_group</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
<a href="gtk-Keyboard-Accelerators.html#GtkAccelGroup">GtkAccelGroup</a> *accel_group);
<a href="gtk-Keyboard-Accelerators.html#GtkAccelGroup">GtkAccelGroup</a>* <a href="GtkMenu.html#gtk-menu-get-accel-group">gtk_menu_get_accel_group</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);
void <a href="GtkMenu.html#gtk-menu-set-accel-path">gtk_menu_set_accel_path</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
const <a
href="../glib/glib-Basic-Types.html#gchar"
>gchar</a> *accel_path);
void <a href="GtkMenu.html#gtk-menu-set-title">gtk_menu_set_title</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
const <a
href="../glib/glib-Basic-Types.html#gchar"
>gchar</a> *title);
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> <a href="GtkMenu.html#gtk-menu-get-tearoff-state">gtk_menu_get_tearoff_state</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);
const <a
href="../glib/glib-Basic-Types.html#gchar"
>gchar</a>* <a href="GtkMenu.html#gtk-menu-get-title">gtk_menu_get_title</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);
void <a href="GtkMenu.html#gtk-menu-popdown">gtk_menu_popdown</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);
void <a href="GtkMenu.html#gtk-menu-reposition">gtk_menu_reposition</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* <a href="GtkMenu.html#gtk-menu-get-active">gtk_menu_get_active</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);
void <a href="GtkMenu.html#gtk-menu-set-active">gtk_menu_set_active</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
<a
href="../glib/glib-Basic-Types.html#guint"
>guint</a> index_);
void <a href="GtkMenu.html#gtk-menu-set-tearoff-state">gtk_menu_set_tearoff_state</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> torn_off);
void <a href="GtkMenu.html#gtk-menu-attach-to-widget">gtk_menu_attach_to_widget</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *attach_widget,
<a href="GtkMenu.html#GtkMenuDetachFunc">GtkMenuDetachFunc</a> detacher);
void <a href="GtkMenu.html#gtk-menu-detach">gtk_menu_detach</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* <a href="GtkMenu.html#gtk-menu-get-attach-widget">gtk_menu_get_attach_widget</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);
<a
href="../glib/glib-Doubly-Linked-Lists.html#GList"
>GList</a>* <a href="GtkMenu.html#gtk-menu-get-for-attach-widget">gtk_menu_get_for_attach_widget</a> (<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *widget);
void (<a href="GtkMenu.html#GtkMenuPositionFunc">*GtkMenuPositionFunc</a>) (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> *x,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> *y,
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> *push_in,
<a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data);
void (<a href="GtkMenu.html#GtkMenuDetachFunc">*GtkMenuDetachFunc</a>) (<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *attach_widget,
<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);
void <a href="GtkMenu.html#gtk-menu-set-monitor">gtk_menu_set_monitor</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> monitor_num);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id3271942"></a><h2>Object Hierarchy</h2>
<pre class="synopsis">
<a
href="../gobject/gobject-The-Base-Object-Type.html#GObject"
>GObject</a>
+----<a
href="../gobject/gobject-The-Base-Object-Type.html#GInitiallyUnowned"
>GInitiallyUnowned</a>
+----<a href="GtkObject.html" title="GtkObject">GtkObject</a>
+----<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>
+----<a href="GtkContainer.html" title="GtkContainer">GtkContainer</a>
+----<a href="GtkMenuShell.html" title="GtkMenuShell">GtkMenuShell</a>
+----GtkMenu
+----<a href="GtkRecentChooserMenu.html" title="GtkRecentChooserMenu">GtkRecentChooserMenu</a>
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id3272012"></a><h2>Implemented Interfaces</h2>
<p>
GtkMenu implements
AtkImplementorIface.</p>
</div>
<div class="refsect1" lang="en">
<a name="id3272035"></a><h2>Properties</h2>
<pre class="synopsis">
"<a href="GtkMenu.html#GtkMenu--tearoff-state">tearoff-state</a>" <a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> : Read / Write
"<a href="GtkMenu.html#GtkMenu--tearoff-title">tearoff-title</a>" <a
href="../gobject/gobject-Standard-Parameter-and-Value-Types.html#gchararray"
>gchararray</a> : Read / Write
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id3272086"></a><h2>Child Properties</h2>
<pre class="synopsis">
"<a href="GtkMenu.html#GtkMenu--bottom-attach">bottom-attach</a>" <a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> : Read / Write
"<a href="GtkMenu.html#GtkMenu--left-attach">left-attach</a>" <a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> : Read / Write
"<a href="GtkMenu.html#GtkMenu--right-attach">right-attach</a>" <a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> : Read / Write
"<a href="GtkMenu.html#GtkMenu--top-attach">top-attach</a>" <a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> : Read / Write
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id3272169"></a><h2>Style Properties</h2>
<pre class="synopsis">
"<a href="GtkMenu.html#GtkMenu--double-arrows">double-arrows</a>" <a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> : Read
"<a href="GtkMenu.html#GtkMenu--horizontal-offset">horizontal-offset</a>" <a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> : Read
"<a href="GtkMenu.html#GtkMenu--horizontal-padding">horizontal-padding</a>" <a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> : Read
"<a href="GtkMenu.html#GtkMenu--vertical-offset">vertical-offset</a>" <a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> : Read
"<a href="GtkMenu.html#GtkMenu--vertical-padding">vertical-padding</a>" <a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> : Read
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id3272268"></a><h2>Signals</h2>
<pre class="synopsis">
"<a href="GtkMenu.html#GtkMenu-move-scroll">move-scroll</a>"
void user_function (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
<a href="gtk-Standard-Enumerations.html#GtkScrollType">GtkScrollType</a> *arg1,
<a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data) : Run last / Action
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id3272325"></a><h2>Description</h2>
<p>
A <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a> is a <a href="GtkMenuShell.html" title="GtkMenuShell"><span class="type">GtkMenuShell</span></a> that implements a drop down menu consisting of
a list of <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> objects which can be navigated and activated by the
user to perform application functions.
</p>
<p>
A <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a> is most commonly dropped down by activating a <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> in a
<a href="GtkMenuBar.html" title="GtkMenuBar"><span class="type">GtkMenuBar</span></a> or popped up by activating a <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> in another <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
</p>
<p>
A <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a> can also be popped up by activating a <a href="GtkOptionMenu.html" title="GtkOptionMenu"><span class="type">GtkOptionMenu</span></a>.
Other composite widgets such as the <a href="GtkNotebook.html" title="GtkNotebook"><span class="type">GtkNotebook</span></a> can pop up a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>
as well.
</p>
<p>
Applications can display a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a> as a popup menu by calling the
<a href="GtkMenu.html#gtk-menu-popup"><code class="function">gtk_menu_popup()</code></a> function. The example below shows how an application
can pop up a menu when the 3rd mouse button is pressed.
</p>
<div class="example">
<a name="id3272470"></a><p class="title"><b>Example 1. Connecting the popup signal handler.</b></p>
<pre class="programlisting">
/* connect our handler which will popup the menu */
g_signal_connect_swapped (window, "button_press_event",
G_CALLBACK (my_popup_handler), menu);
</pre>
</div>
<div class="example">
<a name="id3272486"></a><p class="title"><b>Example 2. Signal handler which displays a popup menu.</b></p>
<pre class="programlisting">
static gint
my_popup_handler (GtkWidget *widget, GdkEvent *event)
{
GtkMenu *menu;
GdkEventButton *event_button;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_MENU (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
/* The "widget" is the menu that was supplied when
* <a
href="../gobject/gobject-Signals.html#g-signal-connect-swapped"
><code class="function">g_signal_connect_swapped()</code></a> was called.
*/
menu = GTK_MENU (widget);
if (event->type == GDK_BUTTON_PRESS)
{
event_button = (GdkEventButton *) event;
if (event_button->button == 3)
{
gtk_menu_popup (menu, NULL, NULL, NULL, NULL,
event_button->button, event_button->time);
return TRUE;
}
}
return FALSE;
}
</pre>
</div>
</div>
<div class="refsect1" lang="en">
<a name="id3272522"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id3272532"></a><h3>
<a name="GtkMenu-struct"></a>GtkMenu</h3>
<a class="indexterm" name="id3272545"></a><pre class="programlisting">typedef struct _GtkMenu GtkMenu;</pre>
<p>
The <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a> struct contains private data only, and
should be accessed using the functions below.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3272570"></a><h3>
<a name="gtk-menu-new"></a>gtk_menu_new ()</h3>
<a class="indexterm" name="id3272583"></a><pre class="programlisting"><a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* gtk_menu_new (void);</pre>
<p>
Creates a new <a 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>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>a new <a 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="id3272635"></a><h3>
<a name="gtk-menu-set-screen"></a>gtk_menu_set_screen ()</h3>
<a class="indexterm" name="id3272650"></a><pre class="programlisting">void gtk_menu_set_screen (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
<a
href="../gdk/GdkScreen.html"
>GdkScreen</a> *screen);</pre>
<p>
Sets the <a
href="../gdk/GdkScreen.html"
><span class="type">GdkScreen</span></a> on which the menu will be displayed.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td> a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>screen</code></em> :</span></td>
<td> a <a
href="../gdk/GdkScreen.html"
><span class="type">GdkScreen</span></a>, or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a> if the screen should be
determined by the widget the menu is attached to.
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.2
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3272761"></a><h3>
<a name="gtk-menu-append"></a>gtk_menu_append()</h3>
<a class="indexterm" name="id3272776"></a><pre class="programlisting">#define gtk_menu_append(menu,child) gtk_menu_shell_append ((GtkMenuShell *)(menu),(child))
</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gtk_menu_append</code> is deprecated and should not be used in newly-written code. Use <a href="GtkMenuShell.html#gtk-menu-shell-append"><code class="function">gtk_menu_shell_append()</code></a> instead.</p>
</div>
<p>
Adds a new <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> to the end of the menu's item list.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>child</code></em> :</span></td>
<td>The <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> to add.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3272874"></a><h3>
<a name="gtk-menu-prepend"></a>gtk_menu_prepend()</h3>
<a class="indexterm" name="id3272890"></a><pre class="programlisting">#define gtk_menu_prepend(menu,child) gtk_menu_shell_prepend ((GtkMenuShell *)(menu),(child))
</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gtk_menu_prepend</code> is deprecated and should not be used in newly-written code. Use <a href="GtkMenuShell.html#gtk-menu-shell-prepend"><code class="function">gtk_menu_shell_prepend()</code></a> instead.</p>
</div>
<p>
Adds a new <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> to the beginning of the menu's item list.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>child</code></em> :</span></td>
<td>The <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> to add.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3272987"></a><h3>
<a name="gtk-menu-insert"></a>gtk_menu_insert()</h3>
<a class="indexterm" name="id3273003"></a><pre class="programlisting">#define gtk_menu_insert(menu,child,pos) gtk_menu_shell_insert ((GtkMenuShell *)(menu),(child),(pos))
</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gtk_menu_insert</code> is deprecated and should not be used in newly-written code. Use <a href="GtkMenuShell.html#gtk-menu-shell-insert"><code class="function">gtk_menu_shell_insert()</code></a> instead.</p>
</div>
<p>
Adds a new <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> to the menu's item list at the position
indicated by <em class="parameter"><code>position</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>child</code></em> :</span></td>
<td>The <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> to add.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>pos</code></em> :</span></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="id3273128"></a><h3>
<a name="gtk-menu-reorder-child"></a>gtk_menu_reorder_child ()</h3>
<a class="indexterm" name="id3273141"></a><pre class="programlisting">void gtk_menu_reorder_child (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *child,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> position);</pre>
<p>
Moves a <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> to a new position within the <a 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>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>child</code></em> :</span></td>
<td>the <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> to move.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>position</code></em> :</span></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="id3273269"></a><h3>
<a name="gtk-menu-attach"></a>gtk_menu_attach ()</h3>
<a class="indexterm" name="id3273283"></a><pre class="programlisting">void gtk_menu_attach (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *child,
<a
href="../glib/glib-Basic-Types.html#guint"
>guint</a> left_attach,
<a
href="../glib/glib-Basic-Types.html#guint"
>guint</a> right_attach,
<a
href="../glib/glib-Basic-Types.html#guint"
>guint</a> top_attach,
<a
href="../glib/glib-Basic-Types.html#guint"
>guint</a> bottom_attach);</pre>
<p>
Adds a new <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> to a (table) menu. The number of 'cells' that
an 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 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>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td> a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>child</code></em> :</span></td>
<td> a <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>left_attach</code></em> :</span></td>
<td> The column number to attach the left side of the item to.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>right_attach</code></em> :</span></td>
<td> The column number to attach the right side of the item to.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>top_attach</code></em> :</span></td>
<td> The row number to attach the top of the item to.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>bottom_attach</code></em> :</span></td>
<td> The row number to attach the bottom of the item to.
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3273513"></a><h3>
<a name="gtk-menu-popup"></a>gtk_menu_popup ()</h3>
<a class="indexterm" name="id3273526"></a><pre class="programlisting">void gtk_menu_popup (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *parent_menu_shell,
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *parent_menu_item,
<a href="GtkMenu.html#GtkMenuPositionFunc">GtkMenuPositionFunc</a> func,
<a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a> data,
<a
href="../glib/glib-Basic-Types.html#guint"
>guint</a> button,
<a
href="../glib/glib-Basic-Types.html#guint32"
>guint32</a> activate_time);</pre>
<p>
Displays a menu and makes it available for selection. Applications can use
this function to display context-sensitive menus, and will typically supply
<a
href="../glib/glib-Standard-Macros.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 menu
at the current mouse cursor position.
</p>
<p>
The <em class="parameter"><code>button</code></em> parameter should be the mouse button pressed to initiate
the menu popup. If the menu popup was initiated by something other than
a 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 should be the time stamp of the event that
initiated the popup. If such an event is not available, use
<a href="gtk-General.html#gtk-get-current-event-time"><code class="function">gtk_get_current_event_time()</code></a> instead.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td> a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>parent_menu_shell</code></em> :</span></td>
<td> the menu shell containing the triggering menu item, or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>parent_menu_item</code></em> :</span></td>
<td> the menu item whose activation triggered the popup, or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>func</code></em> :</span></td>
<td> a user supplied function used to position the menu, or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>data</code></em> :</span></td>
<td> user supplied data to be passed to <em class="parameter"><code>func</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>button</code></em> :</span></td>
<td> the mouse button which was pressed to initiate the event.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>activate_time</code></em> :</span></td>
<td> the time at which the activation event occurred.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3273831"></a><h3>
<a name="gtk-menu-set-accel-group"></a>gtk_menu_set_accel_group ()</h3>
<a class="indexterm" name="id3273844"></a><pre class="programlisting">void gtk_menu_set_accel_group (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
<a href="gtk-Keyboard-Accelerators.html#GtkAccelGroup">GtkAccelGroup</a> *accel_group);</pre>
<p>
Set the <a 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 that
this menu is being used in with <a href="GtkWindow.html#gtk-window-add-accel-group"><code class="function">gtk_window_add_accel_group()</code></a>, in order
for 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>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>accel_group</code></em> :</span></td>
<td>the <a 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="id3273952"></a><h3>
<a name="gtk-menu-get-accel-group"></a>gtk_menu_get_accel_group ()</h3>
<a class="indexterm" name="id3273965"></a><pre class="programlisting"><a href="gtk-Keyboard-Accelerators.html#GtkAccelGroup">GtkAccelGroup</a>* gtk_menu_get_accel_group (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);</pre>
<p>
Gets the <a href="gtk-Keyboard-Accelerators.html#GtkAccelGroup"><span class="type">GtkAccelGroup</span></a> which holds global accelerators for the menu.
See <a 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>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>the <a 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="id3274059"></a><h3>
<a name="gtk-menu-set-accel-path"></a>gtk_menu_set_accel_path ()</h3>
<a class="indexterm" name="id3274071"></a><pre class="programlisting">void gtk_menu_set_accel_path (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
const <a
href="../glib/glib-Basic-Types.html#gchar"
>gchar</a> *accel_path);</pre>
<p>
Sets an accelerator path for this menu from which accelerator paths
for its immediate children, its menu items, can be constructed.
The main purpose of this function is to spare the programmer the
inconvenience of having to call <a href="GtkMenuItem.html#gtk-menu-item-set-accel-path"><code class="function">gtk_menu_item_set_accel_path()</code></a> on
each menu item that should support runtime user changable accelerators.
Instead, by just calling <a 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 containing
menu 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 change
their accelerators at runtime. More details about accelerator paths
and their default setups can be found at <a 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>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td> a valid <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>accel_path</code></em> :</span></td>
<td> a valid accelerator path
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3274218"></a><h3>
<a name="gtk-menu-set-title"></a>gtk_menu_set_title ()</h3>
<a class="indexterm" name="id3274231"></a><pre class="programlisting">void gtk_menu_set_title (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
const <a
href="../glib/glib-Basic-Types.html#gchar"
>gchar</a> *title);</pre>
<p>
Sets the title string for the menu. The title is displayed when the menu
is shown as a tearoff menu.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td> a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>title</code></em> :</span></td>
<td> a string containing the title for the menu.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3274312"></a><h3>
<a name="gtk-menu-get-tearoff-state"></a>gtk_menu_get_tearoff_state ()</h3>
<a class="indexterm" name="id3274326"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> gtk_menu_get_tearoff_state (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);</pre>
<p>
Returns whether the menu is torn off. See
<a 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>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td> a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> <a
href="../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="id3274415"></a><h3>
<a name="gtk-menu-get-title"></a>gtk_menu_get_title ()</h3>
<a class="indexterm" name="id3274428"></a><pre class="programlisting">const <a
href="../glib/glib-Basic-Types.html#gchar"
>gchar</a>* gtk_menu_get_title (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);</pre>
<p>
Returns the title of the menu. See <a 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>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td> a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the title of the menu, or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a> if the menu has no
title set on it. This string is owned by the widget and should
not be modified or freed.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3274520"></a><h3>
<a name="gtk-menu-popdown"></a>gtk_menu_popdown ()</h3>
<a class="indexterm" name="id3274533"></a><pre class="programlisting">void gtk_menu_popdown (<a 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>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td>a <a 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="id3274587"></a><h3>
<a name="gtk-menu-reposition"></a>gtk_menu_reposition ()</h3>
<a class="indexterm" name="id3274601"></a><pre class="programlisting">void gtk_menu_reposition (<a 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>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td>a <a 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="id3274655"></a><h3>
<a name="gtk-menu-get-active"></a>gtk_menu_get_active ()</h3>
<a class="indexterm" name="id3274668"></a><pre class="programlisting"><a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* gtk_menu_get_active (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);</pre>
<p>
Returns the selected menu item from the menu. This is used by the
<a 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>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>the <a 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="id3274751"></a><h3>
<a name="gtk-menu-set-active"></a>gtk_menu_set_active ()</h3>
<a class="indexterm" name="id3274765"></a><pre class="programlisting">void gtk_menu_set_active (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
<a
href="../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 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>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>index_</code></em> :</span></td>
<td>the index of the menu item to select. Index values are from
0 to n-1.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3274851"></a><h3>
<a name="gtk-menu-set-tearoff-state"></a>gtk_menu_set_tearoff_state ()</h3>
<a class="indexterm" name="id3274865"></a><pre class="programlisting">void gtk_menu_set_tearoff_state (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
<a
href="../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>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>torn_off</code></em> :</span></td>
<td>If <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a>, menu is displayed as a tearoff menu.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3274954"></a><h3>
<a name="gtk-menu-attach-to-widget"></a>gtk_menu_attach_to_widget ()</h3>
<a class="indexterm" name="id3274968"></a><pre class="programlisting">void gtk_menu_attach_to_widget (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *attach_widget,
<a href="GtkMenu.html#GtkMenuDetachFunc">GtkMenuDetachFunc</a> detacher);</pre>
<p>
Attaches the menu to the widget and provides a callback function that will
be invoked when the menu calls <a href="GtkMenu.html#gtk-menu-detach"><code class="function">gtk_menu_detach()</code></a> during its destruction.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>attach_widget</code></em> :</span></td>
<td>the <a href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a> that the menu will be attached to.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>detacher</code></em> :</span></td>
<td>the user supplied callback function that will be called when
the menu calls <a href="GtkMenu.html#gtk-menu-detach"><code class="function">gtk_menu_detach()</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3275098"></a><h3>
<a name="gtk-menu-detach"></a>gtk_menu_detach ()</h3>
<a class="indexterm" name="id3275110"></a><pre class="programlisting">void gtk_menu_detach (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);</pre>
<p>
Detaches the menu from the widget to which it had been attached.
This function will call the callback function, <em class="parameter"><code>detacher</code></em>, provided
when the <a href="GtkMenu.html#gtk-menu-attach-to-widget"><code class="function">gtk_menu_attach_to_widget()</code></a> function was called.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td>a <a 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="id3275184"></a><h3>
<a name="gtk-menu-get-attach-widget"></a>gtk_menu_get_attach_widget ()</h3>
<a class="indexterm" name="id3275198"></a><pre class="programlisting"><a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* gtk_menu_get_attach_widget (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);</pre>
<p>
Returns the <a href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a> that the menu is attached to.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>the <a href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a> that the menu is attached to.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3275278"></a><h3>
<a name="gtk-menu-get-for-attach-widget"></a>gtk_menu_get_for_attach_widget ()</h3>
<a class="indexterm" name="id3275294"></a><pre class="programlisting"><a
href="../glib/glib-Doubly-Linked-Lists.html#GList"
>GList</a>* gtk_menu_get_for_attach_widget (<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *widget);</pre>
<p>
Returns a list of the menus which are attached to this widget.
This list is owned by GTK+ and must not be modified.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>widget</code></em> :</span></td>
<td> a <a href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the list of menus attached to his widget.
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.6
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3275369"></a><h3>
<a name="GtkMenuPositionFunc"></a>GtkMenuPositionFunc ()</h3>
<a class="indexterm" name="id3275383"></a><pre class="programlisting">void (*GtkMenuPositionFunc) (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> *x,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> *y,
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> *push_in,
<a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data);</pre>
<p>
A user function supplied when calling <a href="GtkMenu.html#gtk-menu-popup"><code class="function">gtk_menu_popup()</code></a> which controls the
positioning of the menu when it is displayed. The function sets the <em class="parameter"><code>x</code></em>
and <em class="parameter"><code>y</code></em> parameters to the coordinates where the menu is to be drawn.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>x</code></em> :</span></td>
<td>address of the <a
href="../glib/glib-Basic-Types.html#gint"
><span class="type">gint</span></a> representing the horizontal position where the
menu shall be drawn. This is an output parameter.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>y</code></em> :</span></td>
<td>address of the <a
href="../glib/glib-Basic-Types.html#gint"
><span class="type">gint</span></a> representing the vertical position where the
menu shall be drawn. This is an output parameter.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>push_in</code></em> :</span></td>
<td>whether the menu should be pushed in to be completely inside the
screen instead of just clamped to the size to the screen.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>user_data</code></em> :</span></td>
<td>the data supplied by the user in the <a href="GtkMenu.html#gtk-menu-popup"><code class="function">gtk_menu_popup()</code></a> <em class="parameter"><code>data</code></em>
parameter.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3275584"></a><h3>
<a name="GtkMenuDetachFunc"></a>GtkMenuDetachFunc ()</h3>
<a class="indexterm" name="id3275598"></a><pre class="programlisting">void (*GtkMenuDetachFunc) (<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *attach_widget,
<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);</pre>
<p>
A user function supplied when calling <a href="GtkMenu.html#gtk-menu-attach-to-widget"><code class="function">gtk_menu_attach_to_widget()</code></a> which
will be called when the menu is later detached from the widget.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>attach_widget</code></em> :</span></td>
<td>the <a href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a> that the menu is being detached from.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td>the <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a> being detached.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3275695"></a><h3>
<a name="gtk-menu-set-monitor"></a>gtk_menu_set_monitor ()</h3>
<a class="indexterm" name="id3275711"></a><pre class="programlisting">void gtk_menu_set_monitor (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> monitor_num);</pre>
<p>
Informs GTK+ on which monitor a menu should be popped up.
See <a
href="../gdk/GdkScreen.html#gdk-screen-get-monitor-geometry"
><code class="function">gdk_screen_get_monitor_geometry()</code></a>.
</p>
<p>
This function should be called from a <a href="GtkMenu.html#GtkMenuPositionFunc"><span class="type">GtkMenuPositionFunc</span></a> if the
menu should not appear on the same monitor as the pointer. This
information can't be reliably inferred from the coordinates returned
by a <a href="GtkMenu.html#GtkMenuPositionFunc"><span class="type">GtkMenuPositionFunc</span></a>, since, for very long menus, these coordinates
may extend beyond the monitor boundaries or even the screen boundaries.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td> a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>monitor_num</code></em> :</span></td>
<td> the number of the monitor on which the menu should
be popped up
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.4
</p>
</div>
</div>
<div class="refsect1" lang="en">
<a name="id3275834"></a><h2>Property Details</h2>
<div class="refsect2" lang="en">
<a name="id3275845"></a><h3>
<a name="GtkMenu--tearoff-state"></a>The "<code class="literal">tearoff-state</code>" property</h3>
<a class="indexterm" name="id3275862"></a><pre class="programlisting"> "tearoff-state" <a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> : Read / Write</pre>
<p>
A boolean that indicates whether the menu is torn-off.</p>
<p>
</p>
<p>Default value: FALSE</p>
<p>Since 2.6
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3275898"></a><h3>
<a name="GtkMenu--tearoff-title"></a>The "<code class="literal">tearoff-title</code>" property</h3>
<a class="indexterm" name="id3275914"></a><pre class="programlisting"> "tearoff-title" <a
href="../gobject/gobject-Standard-Parameter-and-Value-Types.html#gchararray"
>gchararray</a> : Read / Write</pre>
<p>A title that may be displayed by the window manager when this menu is torn-off.</p>
<p>Default value: ""</p>
</div>
</div>
<div class="refsect1" lang="en">
<a name="id3275943"></a><h2>Child Property Details</h2>
<div class="refsect2" lang="en">
<a name="id3275954"></a><h3>
<a name="GtkMenu--bottom-attach"></a>The "<code class="literal">bottom-attach</code>" child property</h3>
<a class="indexterm" name="id3275971"></a><pre class="programlisting"> "bottom-attach" <a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> : Read / Write</pre>
<p>The row number to attach the bottom of the child to.</p>
<p>Allowed values: >= -1</p>
<p>Default value: -1</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3276002"></a><h3>
<a name="GtkMenu--left-attach"></a>The "<code class="literal">left-attach</code>" child property</h3>
<a class="indexterm" name="id3276018"></a><pre class="programlisting"> "left-attach" <a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> : Read / Write</pre>
<p>The column number to attach the left side of the child to.</p>
<p>Allowed values: >= -1</p>
<p>Default value: -1</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3276049"></a><h3>
<a name="GtkMenu--right-attach"></a>The "<code class="literal">right-attach</code>" child property</h3>
<a class="indexterm" name="id3276065"></a><pre class="programlisting"> "right-attach" <a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> : Read / Write</pre>
<p>The column number to attach the right side of the child to.</p>
<p>Allowed values: >= -1</p>
<p>Default value: -1</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3276096"></a><h3>
<a name="GtkMenu--top-attach"></a>The "<code class="literal">top-attach</code>" child property</h3>
<a class="indexterm" name="id3276112"></a><pre class="programlisting"> "top-attach" <a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> : Read / Write</pre>
<p>The row number to attach the top of the child to.</p>
<p>Allowed values: >= -1</p>
<p>Default value: -1</p>
</div>
</div>
<div class="refsect1" lang="en">
<a name="id3276144"></a><h2>Style Property Details</h2>
<div class="refsect2" lang="en">
<a name="id3276155"></a><h3>
<a name="GtkMenu--double-arrows"></a>The "<code class="literal">double-arrows</code>" style property</h3>
<a class="indexterm" name="id3276171"></a><pre class="programlisting"> "double-arrows" <a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> : Read</pre>
<p>When scrolling, always show both arrows.</p>
<p>Default value: TRUE</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3276198"></a><h3>
<a name="GtkMenu--horizontal-offset"></a>The "<code class="literal">horizontal-offset</code>" style property</h3>
<a class="indexterm" name="id3276214"></a><pre class="programlisting"> "horizontal-offset" <a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> : Read</pre>
<p>When the menu is a submenu, position it this number of pixels offset horizontally.</p>
<p>Default value: -2</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3276241"></a><h3>
<a name="GtkMenu--horizontal-padding"></a>The "<code class="literal">horizontal-padding</code>" style property</h3>
<a class="indexterm" name="id3276258"></a><pre class="programlisting"> "horizontal-padding" <a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> : Read</pre>
<p>Extra space at the left and right edges of the menu.</p>
<p>Allowed values: >= 0</p>
<p>Default value: 0</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3276289"></a><h3>
<a name="GtkMenu--vertical-offset"></a>The "<code class="literal">vertical-offset</code>" style property</h3>
<a class="indexterm" name="id3276306"></a><pre class="programlisting"> "vertical-offset" <a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> : Read</pre>
<p>When the menu is a submenu, position it this number of pixels offset vertically.</p>
<p>Default value: 0</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3276333"></a><h3>
<a name="GtkMenu--vertical-padding"></a>The "<code class="literal">vertical-padding</code>" style property</h3>
<a class="indexterm" name="id3276350"></a><pre class="programlisting"> "vertical-padding" <a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> : Read</pre>
<p>Extra space at the top and bottom of the menu.</p>
<p>Allowed values: >= 0</p>
<p>Default value: 1</p>
</div>
</div>
<div class="refsect1" lang="en">
<a name="id3276382"></a><h2>Signal Details</h2>
<div class="refsect2" lang="en">
<a name="id3276392"></a><h3>
<a name="GtkMenu-move-scroll"></a>The "move-scroll" signal</h3>
<a class="indexterm" name="id3276402"></a><pre class="programlisting">void user_function (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
<a href="gtk-Standard-Enumerations.html#GtkScrollType">GtkScrollType</a> *arg1,
<a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data) : Run last / Action</pre>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
<td>the object which received the signal.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>arg1</code></em> :</span></td>
<td>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>user_data</code></em> :</span></td>
<td>user data set when the signal handler was connected.</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</body>
</html>