<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
]>
<!--ENTITY index-Objects-Grouped SYSTEM "objects_grouped.sgml"-->
<refentry id="GtkMenu">
<refmeta>
<refentrytitle role="top_of_page" id="GtkMenu.top_of_page">GtkMenu</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>GtkMenu</refname>
<refpurpose>A menu widget</refpurpose>
</refnamediv>

<refsynopsisdiv id="GtkMenu.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>

#include &lt;gtk/gtk.h&gt;

                    <link linkend="GtkMenu-struct">GtkMenu</link>;
<link linkend="GtkWidget">GtkWidget</link>*          <link linkend="gtk-menu-new">gtk_menu_new</link>                        (void);
<link linkend="void">void</link>                <link linkend="gtk-menu-set-screen">gtk_menu_set_screen</link>                 (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         <link linkend="GdkScreen">GdkScreen</link> *screen);
#define             <link linkend="gtk-menu-append">gtk_menu_append</link>                     (menu,child)
#define             <link linkend="gtk-menu-prepend">gtk_menu_prepend</link>                    (menu,child)
#define             <link linkend="gtk-menu-insert">gtk_menu_insert</link>                     (menu,child,pos)
<link linkend="void">void</link>                <link linkend="gtk-menu-reorder-child">gtk_menu_reorder_child</link>              (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         <link linkend="GtkWidget">GtkWidget</link> *child,
                                                         <link linkend="gint">gint</link> position);
<link linkend="void">void</link>                <link linkend="gtk-menu-attach">gtk_menu_attach</link>                     (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         <link linkend="GtkWidget">GtkWidget</link> *child,
                                                         <link linkend="guint">guint</link> left_attach,
                                                         <link linkend="guint">guint</link> right_attach,
                                                         <link linkend="guint">guint</link> top_attach,
                                                         <link linkend="guint">guint</link> bottom_attach);
<link linkend="void">void</link>                <link linkend="gtk-menu-popup">gtk_menu_popup</link>                      (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         <link linkend="GtkWidget">GtkWidget</link> *parent_menu_shell,
                                                         <link linkend="GtkWidget">GtkWidget</link> *parent_menu_item,
                                                         <link linkend="GtkMenuPositionFunc">GtkMenuPositionFunc</link> func,
                                                         <link linkend="gpointer">gpointer</link> data,
                                                         <link linkend="guint">guint</link> button,
                                                         <link linkend="guint32">guint32</link> activate_time);
<link linkend="void">void</link>                <link linkend="gtk-menu-set-accel-group">gtk_menu_set_accel_group</link>            (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         <link linkend="GtkAccelGroup">GtkAccelGroup</link> *accel_group);
<link linkend="GtkAccelGroup">GtkAccelGroup</link>*      <link linkend="gtk-menu-get-accel-group">gtk_menu_get_accel_group</link>            (<link linkend="GtkMenu">GtkMenu</link> *menu);
<link linkend="void">void</link>                <link linkend="gtk-menu-set-accel-path">gtk_menu_set_accel_path</link>             (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         const <link linkend="gchar">gchar</link> *accel_path);
const <link linkend="gchar">gchar</link>*        <link linkend="gtk-menu-get-accel-path">gtk_menu_get_accel_path</link>             (<link linkend="GtkMenu">GtkMenu</link> *menu);
<link linkend="void">void</link>                <link linkend="gtk-menu-set-title">gtk_menu_set_title</link>                  (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         const <link linkend="gchar">gchar</link> *title);
const <link linkend="gchar">gchar</link> *       <link linkend="gtk-menu-get-title">gtk_menu_get_title</link>                  (<link linkend="GtkMenu">GtkMenu</link> *menu);
<link linkend="void">void</link>                <link linkend="gtk-menu-set-monitor">gtk_menu_set_monitor</link>                (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         <link linkend="gint">gint</link> monitor_num);
<link linkend="gint">gint</link>                <link linkend="gtk-menu-get-monitor">gtk_menu_get_monitor</link>                (<link linkend="GtkMenu">GtkMenu</link> *menu);
<link linkend="gboolean">gboolean</link>            <link linkend="gtk-menu-get-tearoff-state">gtk_menu_get_tearoff_state</link>          (<link linkend="GtkMenu">GtkMenu</link> *menu);
<link linkend="void">void</link>                <link linkend="gtk-menu-set-reserve-toggle-size">gtk_menu_set_reserve_toggle_size</link>    (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         <link linkend="gboolean">gboolean</link> reserve_toggle_size);
<link linkend="gboolean">gboolean</link>            <link linkend="gtk-menu-get-reserve-toggle-size">gtk_menu_get_reserve_toggle_size</link>    (<link linkend="GtkMenu">GtkMenu</link> *menu);

<link linkend="void">void</link>                <link linkend="gtk-menu-popdown">gtk_menu_popdown</link>                    (<link linkend="GtkMenu">GtkMenu</link> *menu);
<link linkend="void">void</link>                <link linkend="gtk-menu-reposition">gtk_menu_reposition</link>                 (<link linkend="GtkMenu">GtkMenu</link> *menu);
<link linkend="GtkWidget">GtkWidget</link>*          <link linkend="gtk-menu-get-active">gtk_menu_get_active</link>                 (<link linkend="GtkMenu">GtkMenu</link> *menu);
<link linkend="void">void</link>                <link linkend="gtk-menu-set-active">gtk_menu_set_active</link>                 (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         <link linkend="guint">guint</link> index_);
<link linkend="void">void</link>                <link linkend="gtk-menu-set-tearoff-state">gtk_menu_set_tearoff_state</link>          (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         <link linkend="gboolean">gboolean</link> torn_off);
<link linkend="void">void</link>                <link linkend="gtk-menu-attach-to-widget">gtk_menu_attach_to_widget</link>           (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         <link linkend="GtkWidget">GtkWidget</link> *attach_widget,
                                                         <link linkend="GtkMenuDetachFunc">GtkMenuDetachFunc</link> detacher);
<link linkend="void">void</link>                <link linkend="gtk-menu-detach">gtk_menu_detach</link>                     (<link linkend="GtkMenu">GtkMenu</link> *menu);
<link linkend="GtkWidget">GtkWidget</link>*          <link linkend="gtk-menu-get-attach-widget">gtk_menu_get_attach_widget</link>          (<link linkend="GtkMenu">GtkMenu</link> *menu);
<link linkend="GList">GList</link>*              <link linkend="gtk-menu-get-for-attach-widget">gtk_menu_get_for_attach_widget</link>      (<link linkend="GtkWidget">GtkWidget</link> *widget);
<link linkend="void">void</link>                (<link linkend="GtkMenuPositionFunc">*GtkMenuPositionFunc</link>)              (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         <link linkend="gint">gint</link> *x,
                                                         <link linkend="gint">gint</link> *y,
                                                         <link linkend="gboolean">gboolean</link> *push_in,
                                                         <link linkend="gpointer">gpointer</link> user_data);
<link linkend="void">void</link>                (<link linkend="GtkMenuDetachFunc">*GtkMenuDetachFunc</link>)                (<link linkend="GtkWidget">GtkWidget</link> *attach_widget,
                                                         <link linkend="GtkMenu">GtkMenu</link> *menu);
</synopsis>
</refsynopsisdiv>

<refsect1 id="GtkMenu.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<synopsis>
  <link linkend="GObject">GObject</link>
   +----<link linkend="GInitiallyUnowned">GInitiallyUnowned</link>
         +----<link linkend="GtkObject">GtkObject</link>
               +----<link linkend="GtkWidget">GtkWidget</link>
                     +----<link linkend="GtkContainer">GtkContainer</link>
                           +----<link linkend="GtkMenuShell">GtkMenuShell</link>
                                 +----GtkMenu
                                       +----<link linkend="GtkRecentChooserMenu">GtkRecentChooserMenu</link>
</synopsis>
</refsect1>



<refsect1 id="GtkMenu.implemented-interfaces" role="impl_interfaces">
<title role="impl_interfaces.title">Implemented Interfaces</title>
<para>
GtkMenu implements
 <link linkend="AtkImplementorIface">AtkImplementorIface</link> and  <link linkend="GtkBuildable">GtkBuildable</link>.</para>
</refsect1>


<refsect1 id="GtkMenu.properties" role="properties">
<title role="properties.title">Properties</title>
<synopsis>
  &quot;<link linkend="GtkMenu--accel-group">accel-group</link>&quot;              <link linkend="GtkAccelGroup">GtkAccelGroup</link>*        : Read / Write
  &quot;<link linkend="GtkMenu--accel-path">accel-path</link>&quot;               <link linkend="gchar">gchar</link>*                : Read / Write
  &quot;<link linkend="GtkMenu--active">active</link>&quot;                   <link linkend="gint">gint</link>                  : Read / Write
  &quot;<link linkend="GtkMenu--attach-widget">attach-widget</link>&quot;            <link linkend="GtkWidget">GtkWidget</link>*            : Read / Write
  &quot;<link linkend="GtkMenu--monitor">monitor</link>&quot;                  <link linkend="gint">gint</link>                  : Read / Write
  &quot;<link linkend="GtkMenu--reserve-toggle-size">reserve-toggle-size</link>&quot;      <link linkend="gboolean">gboolean</link>              : Read / Write
  &quot;<link linkend="GtkMenu--tearoff-state">tearoff-state</link>&quot;            <link linkend="gboolean">gboolean</link>              : Read / Write
  &quot;<link linkend="GtkMenu--tearoff-title">tearoff-title</link>&quot;            <link linkend="gchar">gchar</link>*                : Read / Write
</synopsis>
</refsect1>
<refsect1 id="GtkMenu.child-properties" role="child_properties">
<title role="child_properties.title">Child Properties</title>
<synopsis>
  &quot;<link linkend="GtkMenu--c-bottom-attach">bottom-attach</link>&quot;            <link linkend="gint">gint</link>                  : Read / Write
  &quot;<link linkend="GtkMenu--c-left-attach">left-attach</link>&quot;              <link linkend="gint">gint</link>                  : Read / Write
  &quot;<link linkend="GtkMenu--c-right-attach">right-attach</link>&quot;             <link linkend="gint">gint</link>                  : Read / Write
  &quot;<link linkend="GtkMenu--c-top-attach">top-attach</link>&quot;               <link linkend="gint">gint</link>                  : Read / Write
</synopsis>
</refsect1>
<refsect1 id="GtkMenu.style-properties" role="style_properties">
<title role="style_properties.title">Style Properties</title>
<synopsis>
  &quot;<link linkend="GtkMenu--s-arrow-placement">arrow-placement</link>&quot;          <link linkend="GtkArrowPlacement">GtkArrowPlacement</link>     : Read
  &quot;<link linkend="GtkMenu--s-arrow-scaling">arrow-scaling</link>&quot;            <link linkend="gfloat">gfloat</link>                : Read
  &quot;<link linkend="GtkMenu--s-double-arrows">double-arrows</link>&quot;            <link linkend="gboolean">gboolean</link>              : Read
  &quot;<link linkend="GtkMenu--s-horizontal-offset">horizontal-offset</link>&quot;        <link linkend="gint">gint</link>                  : Read
  &quot;<link linkend="GtkMenu--s-horizontal-padding">horizontal-padding</link>&quot;       <link linkend="gint">gint</link>                  : Read
  &quot;<link linkend="GtkMenu--s-vertical-offset">vertical-offset</link>&quot;          <link linkend="gint">gint</link>                  : Read
  &quot;<link linkend="GtkMenu--s-vertical-padding">vertical-padding</link>&quot;         <link linkend="gint">gint</link>                  : Read
</synopsis>
</refsect1>

<refsect1 id="GtkMenu.signals" role="signal_proto">
<title role="signal_proto.title">Signals</title>
<synopsis>
  &quot;<link linkend="GtkMenu-move-scroll">move-scroll</link>&quot;                                    : Run Last / Action
</synopsis>
</refsect1>


<refsect1 id="GtkMenu.description" role="desc">
<title role="desc.title">Description</title>
<para>
A <link linkend="GtkMenu"><type>GtkMenu</type></link> is a <link linkend="GtkMenuShell"><type>GtkMenuShell</type></link> that implements a drop down menu consisting of
a list of <link linkend="GtkMenuItem"><type>GtkMenuItem</type></link> objects which can be navigated and activated by the
user to perform application functions.
</para>
<para>
A <link linkend="GtkMenu"><type>GtkMenu</type></link> is most commonly dropped down by activating a <link linkend="GtkMenuItem"><type>GtkMenuItem</type></link> in a
<link linkend="GtkMenuBar"><type>GtkMenuBar</type></link> or popped up by activating a <link linkend="GtkMenuItem"><type>GtkMenuItem</type></link> in another <link linkend="GtkMenu"><type>GtkMenu</type></link>.
</para>
<para>
A <link linkend="GtkMenu"><type>GtkMenu</type></link> can also be popped up by activating a <link linkend="GtkOptionMenu"><type>GtkOptionMenu</type></link>.
Other composite widgets such as the <link linkend="GtkNotebook"><type>GtkNotebook</type></link> can pop up a <link linkend="GtkMenu"><type>GtkMenu</type></link>
as well.
</para>
<para>
Applications can display a <link linkend="GtkMenu"><type>GtkMenu</type></link> as a popup menu by calling the
<link linkend="gtk-menu-popup"><function>gtk_menu_popup()</function></link> function.  The example below shows how an application
can pop up a menu when the 3rd mouse button is pressed.
</para>
<example>
<title>Connecting the popup signal handler.</title>
<programlisting>
    /* connect our handler which will popup the menu */
    g_signal_connect_swapped (window, "button_press_event",
	G_CALLBACK (my_popup_handler), menu);
</programlisting>
</example>
<example>
<title>Signal handler which displays a popup menu.</title>
<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
   * g_signal_connect_swapped() 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;
}
</programlisting>
</example>
</refsect1>

<refsect1 id="GtkMenu.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="GtkMenu-struct" role="struct">
<title>GtkMenu</title>
<indexterm zone="GtkMenu-struct"><primary sortas="Menu">GtkMenu</primary></indexterm><programlisting>typedef struct _GtkMenu GtkMenu;</programlisting>
<para>
The <link linkend="GtkMenu"><type>GtkMenu</type></link> struct contains private data only, and
should be accessed using the functions below.
</para></refsect2>
<refsect2 id="gtk-menu-new" role="function">
<title>gtk_menu_new ()</title>
<indexterm zone="gtk-menu-new"><primary sortas="menu_new">gtk_menu_new</primary></indexterm><programlisting><link linkend="GtkWidget">GtkWidget</link>*          gtk_menu_new                        (void);</programlisting>
<para>
Creates a new <link linkend="GtkMenu"><type>GtkMenu</type></link>.
</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>a new <link linkend="GtkMenu"><type>GtkMenu</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-menu-set-screen" role="function" condition="since:2.2">
<title>gtk_menu_set_screen ()</title>
<indexterm zone="gtk-menu-set-screen" role="2.2"><primary sortas="menu_set_screen">gtk_menu_set_screen</primary></indexterm><programlisting><link linkend="void">void</link>                gtk_menu_set_screen                 (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         <link linkend="GdkScreen">GdkScreen</link> *screen);</programlisting>
<para>
Sets the <link linkend="GdkScreen"><type>GdkScreen</type></link> on which the menu will be displayed.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GtkMenu"><type>GtkMenu</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>screen</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GdkScreen"><type>GdkScreen</type></link>, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if the screen should be
         determined by the widget the menu is attached to.
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.2</para></refsect2>
<refsect2 id="gtk-menu-append" role="macro" condition="deprecated:Use gtk_menu_shell_append() instead.">
<title>gtk_menu_append()</title>
<indexterm zone="gtk-menu-append" role="deprecated"><primary sortas="menu_append">gtk_menu_append</primary></indexterm><programlisting>#define gtk_menu_append(menu,child)	gtk_menu_shell_append  ((GtkMenuShell *)(menu),(child))
</programlisting>
<warning><para><literal>gtk_menu_append</literal> is deprecated and should not be used in newly-written code. Use <link linkend="gtk-menu-shell-append"><function>gtk_menu_shell_append()</function></link> instead.</para></warning>
<para>
Adds a new <link linkend="GtkMenuItem"><type>GtkMenuItem</type></link> to the end of the menu's item list.
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GtkMenu"><type>GtkMenu</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>child</parameter>&#160;:</term>
<listitem><simpara>The <link linkend="GtkMenuItem"><type>GtkMenuItem</type></link> to add.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-menu-prepend" role="macro" condition="deprecated:Use gtk_menu_shell_prepend() instead.">
<title>gtk_menu_prepend()</title>
<indexterm zone="gtk-menu-prepend" role="deprecated"><primary sortas="menu_prepend">gtk_menu_prepend</primary></indexterm><programlisting>#define gtk_menu_prepend(menu,child)    gtk_menu_shell_prepend ((GtkMenuShell *)(menu),(child))
</programlisting>
<warning><para><literal>gtk_menu_prepend</literal> is deprecated and should not be used in newly-written code. Use <link linkend="gtk-menu-shell-prepend"><function>gtk_menu_shell_prepend()</function></link> instead.</para></warning>
<para>
Adds a new <link linkend="GtkMenuItem"><type>GtkMenuItem</type></link> to the beginning of the menu's item list.
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GtkMenu"><type>GtkMenu</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>child</parameter>&#160;:</term>
<listitem><simpara>The <link linkend="GtkMenuItem"><type>GtkMenuItem</type></link> to add.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-menu-insert" role="macro" condition="deprecated:Use gtk_menu_shell_insert() instead.">
<title>gtk_menu_insert()</title>
<indexterm zone="gtk-menu-insert" role="deprecated"><primary sortas="menu_insert">gtk_menu_insert</primary></indexterm><programlisting>#define gtk_menu_insert(menu,child,pos)	gtk_menu_shell_insert ((GtkMenuShell *)(menu),(child),(pos))
</programlisting>
<warning><para><literal>gtk_menu_insert</literal> is deprecated and should not be used in newly-written code. Use <link linkend="gtk-menu-shell-insert"><function>gtk_menu_shell_insert()</function></link> instead.</para></warning>
<para>
Adds a new <link linkend="GtkMenuItem"><type>GtkMenuItem</type></link> to the menu's item list at the position
indicated by <parameter>position</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GtkMenu"><type>GtkMenu</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>child</parameter>&#160;:</term>
<listitem><simpara>The <link linkend="GtkMenuItem"><type>GtkMenuItem</type></link> to add.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>pos</parameter>&#160;:</term>
<listitem><simpara>The position in the item list where <parameter>child</parameter> is added.
      Positions are numbered from 0 to n-1.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-menu-reorder-child" role="function">
<title>gtk_menu_reorder_child ()</title>
<indexterm zone="gtk-menu-reorder-child"><primary sortas="menu_reorder_child">gtk_menu_reorder_child</primary></indexterm><programlisting><link linkend="void">void</link>                gtk_menu_reorder_child              (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         <link linkend="GtkWidget">GtkWidget</link> *child,
                                                         <link linkend="gint">gint</link> position);</programlisting>
<para>
Moves a <link linkend="GtkMenuItem"><type>GtkMenuItem</type></link> to a new position within the <link linkend="GtkMenu"><type>GtkMenu</type></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GtkMenu"><type>GtkMenu</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>child</parameter>&#160;:</term>
<listitem><simpara>the <link linkend="GtkMenuItem"><type>GtkMenuItem</type></link> to move.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>position</parameter>&#160;:</term>
<listitem><simpara>the new position to place <parameter>child</parameter>.  Positions are numbered from 
0 to n-1.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-menu-attach" role="function" condition="since:2.4">
<title>gtk_menu_attach ()</title>
<indexterm zone="gtk-menu-attach" role="2.4"><primary sortas="menu_attach">gtk_menu_attach</primary></indexterm><programlisting><link linkend="void">void</link>                gtk_menu_attach                     (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         <link linkend="GtkWidget">GtkWidget</link> *child,
                                                         <link linkend="guint">guint</link> left_attach,
                                                         <link linkend="guint">guint</link> right_attach,
                                                         <link linkend="guint">guint</link> top_attach,
                                                         <link linkend="guint">guint</link> bottom_attach);</programlisting>
<para>
Adds a new <link linkend="GtkMenuItem"><type>GtkMenuItem</type></link> to a (table) menu. The number of 'cells' that
an item will occupy is specified by <parameter>left_attach</parameter>, <parameter>right_attach</parameter>,
<parameter>top_attach</parameter> and <parameter>bottom_attach</parameter>. These each represent the leftmost,
rightmost, uppermost and lower column and row numbers of the table.
(Columns and rows are indexed from zero).
</para>
<para>
Note that this function is not related to <link linkend="gtk-menu-detach"><function>gtk_menu_detach()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GtkMenu"><type>GtkMenu</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>child</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GtkMenuItem"><type>GtkMenuItem</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>left_attach</parameter>&#160;:</term>
<listitem><simpara> The column number to attach the left side of the item to.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>right_attach</parameter>&#160;:</term>
<listitem><simpara> The column number to attach the right side of the item to.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>top_attach</parameter>&#160;:</term>
<listitem><simpara> The row number to attach the top of the item to.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>bottom_attach</parameter>&#160;:</term>
<listitem><simpara> The row number to attach the bottom of the item to.
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="gtk-menu-popup" role="function">
<title>gtk_menu_popup ()</title>
<indexterm zone="gtk-menu-popup"><primary sortas="menu_popup">gtk_menu_popup</primary></indexterm><programlisting><link linkend="void">void</link>                gtk_menu_popup                      (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         <link linkend="GtkWidget">GtkWidget</link> *parent_menu_shell,
                                                         <link linkend="GtkWidget">GtkWidget</link> *parent_menu_item,
                                                         <link linkend="GtkMenuPositionFunc">GtkMenuPositionFunc</link> func,
                                                         <link linkend="gpointer">gpointer</link> data,
                                                         <link linkend="guint">guint</link> button,
                                                         <link linkend="guint32">guint32</link> activate_time);</programlisting>
<para>
Displays a menu and makes it available for selection.  Applications can use
this function to display context-sensitive menus, and will typically supply
<link linkend="NULL--CAPS"><literal>NULL</literal></link> for the <parameter>parent_menu_shell</parameter>, <parameter>parent_menu_item</parameter>, <parameter>func</parameter> and <parameter>data</parameter> 
parameters. The default menu positioning function will position the menu
at the current mouse cursor position.
</para>
<para>
The <parameter>button</parameter> 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,
<parameter>button</parameter> should be 0.
</para>
<para>
The <parameter>activate_time</parameter> parameter is used to conflict-resolve initiation of
concurrent requests for mouse/keyboard grab requests. To function
properly, this needs to be the time stamp of the user event (such as
a mouse click or key press) that caused the initiation of the popup.
Only if no such event is available, <link linkend="gtk-get-current-event-time"><function>gtk_get_current_event_time()</function></link> can
be used instead.</para>
<variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GtkMenu"><type>GtkMenu</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>parent_menu_shell</parameter>&#160;:</term>
<listitem><simpara> the menu shell containing the triggering menu item, or <link linkend="NULL--CAPS"><literal>NULL</literal></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>parent_menu_item</parameter>&#160;:</term>
<listitem><simpara> the menu item whose activation triggered the popup, or <link linkend="NULL--CAPS"><literal>NULL</literal></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>func</parameter>&#160;:</term>
<listitem><simpara> a user supplied function used to position the menu, or <link linkend="NULL--CAPS"><literal>NULL</literal></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>data</parameter>&#160;:</term>
<listitem><simpara> user supplied data to be passed to <parameter>func</parameter>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>button</parameter>&#160;:</term>
<listitem><simpara> the mouse button which was pressed to initiate the event.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>activate_time</parameter>&#160;:</term>
<listitem><simpara> the time at which the activation event occurred.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-menu-set-accel-group" role="function">
<title>gtk_menu_set_accel_group ()</title>
<indexterm zone="gtk-menu-set-accel-group"><primary sortas="menu_set_accel_group">gtk_menu_set_accel_group</primary></indexterm><programlisting><link linkend="void">void</link>                gtk_menu_set_accel_group            (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         <link linkend="GtkAccelGroup">GtkAccelGroup</link> *accel_group);</programlisting>
<para>
Set the <link linkend="GtkAccelGroup"><type>GtkAccelGroup</type></link> 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 <link linkend="gtk-window-add-accel-group"><function>gtk_window_add_accel_group()</function></link>, in order
for those windows to support all the accelerators contained in this group.
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GtkMenu"><type>GtkMenu</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>accel_group</parameter>&#160;:</term>
<listitem><simpara>the <link linkend="GtkAccelGroup"><type>GtkAccelGroup</type></link> to be associated with the menu.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-menu-get-accel-group" role="function">
<title>gtk_menu_get_accel_group ()</title>
<indexterm zone="gtk-menu-get-accel-group"><primary sortas="menu_get_accel_group">gtk_menu_get_accel_group</primary></indexterm><programlisting><link linkend="GtkAccelGroup">GtkAccelGroup</link>*      gtk_menu_get_accel_group            (<link linkend="GtkMenu">GtkMenu</link> *menu);</programlisting>
<para>
Gets the <link linkend="GtkAccelGroup"><type>GtkAccelGroup</type></link> which holds global accelerators for the menu.
See <link linkend="gtk-menu-set-accel-group"><function>gtk_menu_set_accel_group()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GtkMenu"><type>GtkMenu</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>the <link linkend="GtkAccelGroup"><type>GtkAccelGroup</type></link> associated with the menu.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-menu-set-accel-path" role="function">
<title>gtk_menu_set_accel_path ()</title>
<indexterm zone="gtk-menu-set-accel-path"><primary sortas="menu_set_accel_path">gtk_menu_set_accel_path</primary></indexterm><programlisting><link linkend="void">void</link>                gtk_menu_set_accel_path             (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         const <link linkend="gchar">gchar</link> *accel_path);</programlisting>
<para>
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 <link linkend="gtk-menu-item-set-accel-path"><function>gtk_menu_item_set_accel_path()</function></link> on
each menu item that should support runtime user changable accelerators.
Instead, by just calling <link linkend="gtk-menu-set-accel-path"><function>gtk_menu_set_accel_path()</function></link> 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 
<literal>gtk_menu_set_accel_path (menu, "&lt;Gnumeric-Sheet&gt;/File");</literal>
has been called, assign its items the accel paths:
<literal>"&lt;Gnumeric-Sheet&gt;/File/New"</literal> and <literal>"&lt;Gnumeric-Sheet&gt;/File/Exit"</literal>.
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 <link linkend="gtk-accel-map-add-entry"><function>gtk_accel_map_add_entry()</function></link>.
</para>
<para>
Note that <parameter>accel_path</parameter> string will be stored in a <link linkend="GQuark"><type>GQuark</type></link>. Therefore, if you
pass a static string, you can save some memory by interning it first with 
<link linkend="g-intern-static-string"><function>g_intern_static_string()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara>       a valid <link linkend="GtkMenu"><type>GtkMenu</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>accel_path</parameter>&#160;:</term>
<listitem><simpara> a valid accelerator path
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-menu-get-accel-path" role="function" condition="since:2.14">
<title>gtk_menu_get_accel_path ()</title>
<indexterm zone="gtk-menu-get-accel-path" role="2.14"><primary sortas="menu_get_accel_path">gtk_menu_get_accel_path</primary></indexterm><programlisting>const <link linkend="gchar">gchar</link>*        gtk_menu_get_accel_path             (<link linkend="GtkMenu">GtkMenu</link> *menu);</programlisting>
<para>
Retrieves the accelerator path set on the menu.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara> a valid <link linkend="GtkMenu"><type>GtkMenu</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the accelerator path set on the menu.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.14</para></refsect2>
<refsect2 id="gtk-menu-set-title" role="function">
<title>gtk_menu_set_title ()</title>
<indexterm zone="gtk-menu-set-title"><primary sortas="menu_set_title">gtk_menu_set_title</primary></indexterm><programlisting><link linkend="void">void</link>                gtk_menu_set_title                  (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         const <link linkend="gchar">gchar</link> *title);</programlisting>
<para>
Sets the title string for the menu.  The title is displayed when the menu
is shown as a tearoff menu.  If <parameter>title</parameter> is <link linkend="NULL--CAPS"><literal>NULL</literal></link>, the menu will see if it is
attached to a parent menu item, and if so it will try to use the same text as
that menu item's label.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GtkMenu"><type>GtkMenu</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>title</parameter>&#160;:</term>
<listitem><simpara> a string containing the title for the menu.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-menu-get-title" role="function">
<title>gtk_menu_get_title ()</title>
<indexterm zone="gtk-menu-get-title"><primary sortas="menu_get_title">gtk_menu_get_title</primary></indexterm><programlisting>const <link linkend="gchar">gchar</link> *       gtk_menu_get_title                  (<link linkend="GtkMenu">GtkMenu</link> *menu);</programlisting>
<para>
Returns the title of the menu. See <link linkend="gtk-menu-set-title"><function>gtk_menu_set_title()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GtkMenu"><type>GtkMenu</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the title of the menu, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if the menu has no
title set on it. This string is owned by the widget and should
not be modified or freed.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-menu-set-monitor" role="function" condition="since:2.4">
<title>gtk_menu_set_monitor ()</title>
<indexterm zone="gtk-menu-set-monitor" role="2.4"><primary sortas="menu_set_monitor">gtk_menu_set_monitor</primary></indexterm><programlisting><link linkend="void">void</link>                gtk_menu_set_monitor                (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         <link linkend="gint">gint</link> monitor_num);</programlisting>
<para>
Informs GTK+ on which monitor a menu should be popped up. 
See <link linkend="gdk-screen-get-monitor-geometry"><function>gdk_screen_get_monitor_geometry()</function></link>.
</para>
<para>
This function should be called from a <link linkend="GtkMenuPositionFunc"><type>GtkMenuPositionFunc</type></link> 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 <link linkend="GtkMenuPositionFunc"><type>GtkMenuPositionFunc</type></link>, since, for very long menus, these coordinates 
may extend beyond the monitor boundaries or even the screen boundaries.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GtkMenu"><type>GtkMenu</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>monitor_num</parameter>&#160;:</term>
<listitem><simpara> the number of the monitor on which the menu should
   be popped up
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="gtk-menu-get-monitor" role="function" condition="since:2.14">
<title>gtk_menu_get_monitor ()</title>
<indexterm zone="gtk-menu-get-monitor" role="2.14"><primary sortas="menu_get_monitor">gtk_menu_get_monitor</primary></indexterm><programlisting><link linkend="gint">gint</link>                gtk_menu_get_monitor                (<link linkend="GtkMenu">GtkMenu</link> *menu);</programlisting>
<para>
Retrieves the number of the monitor on which to show the menu.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GtkMenu"><type>GtkMenu</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the number of the monitor on which the menu should
   be popped up or -1, if no monitor has been set

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.14</para></refsect2>
<refsect2 id="gtk-menu-get-tearoff-state" role="function">
<title>gtk_menu_get_tearoff_state ()</title>
<indexterm zone="gtk-menu-get-tearoff-state"><primary sortas="menu_get_tearoff_state">gtk_menu_get_tearoff_state</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            gtk_menu_get_tearoff_state          (<link linkend="GtkMenu">GtkMenu</link> *menu);</programlisting>
<para>
Returns whether the menu is torn off. See
<link linkend="gtk-menu-set-tearoff-state"><function>gtk_menu_set_tearoff_state()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GtkMenu"><type>GtkMenu</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the menu is currently torn off.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-menu-set-reserve-toggle-size" role="function" condition="since:2.18">
<title>gtk_menu_set_reserve_toggle_size ()</title>
<indexterm zone="gtk-menu-set-reserve-toggle-size" role="2.18"><primary sortas="menu_set_reserve_toggle_size">gtk_menu_set_reserve_toggle_size</primary></indexterm><programlisting><link linkend="void">void</link>                gtk_menu_set_reserve_toggle_size    (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         <link linkend="gboolean">gboolean</link> reserve_toggle_size);</programlisting>
<para>
Sets whether the menu should reserve space for drawing toggles 
or icons, regardless of their actual presence.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GtkMenu"><type>GtkMenu</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>reserve_toggle_size</parameter>&#160;:</term>
<listitem><simpara> whether to reserve size for toggles
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.18</para></refsect2>
<refsect2 id="gtk-menu-get-reserve-toggle-size" role="function" condition="since:2.18">
<title>gtk_menu_get_reserve_toggle_size ()</title>
<indexterm zone="gtk-menu-get-reserve-toggle-size" role="2.18"><primary sortas="menu_get_reserve_toggle_size">gtk_menu_get_reserve_toggle_size</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            gtk_menu_get_reserve_toggle_size    (<link linkend="GtkMenu">GtkMenu</link> *menu);</programlisting>
<para>
Returns whether the menu reserves space for toggles and
icons, regardless of their actual presence.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GtkMenu"><type>GtkMenu</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> Whether the menu reserves toggle space

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.18</para></refsect2>
<refsect2 id="gtk-menu-popdown" role="function">
<title>gtk_menu_popdown ()</title>
<indexterm zone="gtk-menu-popdown"><primary sortas="menu_popdown">gtk_menu_popdown</primary></indexterm><programlisting><link linkend="void">void</link>                gtk_menu_popdown                    (<link linkend="GtkMenu">GtkMenu</link> *menu);</programlisting>
<para>
Removes the menu from the screen.
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GtkMenu"><type>GtkMenu</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-menu-reposition" role="function">
<title>gtk_menu_reposition ()</title>
<indexterm zone="gtk-menu-reposition"><primary sortas="menu_reposition">gtk_menu_reposition</primary></indexterm><programlisting><link linkend="void">void</link>                gtk_menu_reposition                 (<link linkend="GtkMenu">GtkMenu</link> *menu);</programlisting>
<para>
Repositions the menu according to its position function.
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GtkMenu"><type>GtkMenu</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-menu-get-active" role="function">
<title>gtk_menu_get_active ()</title>
<indexterm zone="gtk-menu-get-active"><primary sortas="menu_get_active">gtk_menu_get_active</primary></indexterm><programlisting><link linkend="GtkWidget">GtkWidget</link>*          gtk_menu_get_active                 (<link linkend="GtkMenu">GtkMenu</link> *menu);</programlisting>
<para>
Returns the selected menu item from the menu.  This is used by the
<link linkend="GtkOptionMenu"><type>GtkOptionMenu</type></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GtkMenu"><type>GtkMenu</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>the <link linkend="GtkMenuItem"><type>GtkMenuItem</type></link> that was last selected in the menu.  If a 
selection has not yet been made, the first menu item is selected.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-menu-set-active" role="function">
<title>gtk_menu_set_active ()</title>
<indexterm zone="gtk-menu-set-active"><primary sortas="menu_set_active">gtk_menu_set_active</primary></indexterm><programlisting><link linkend="void">void</link>                gtk_menu_set_active                 (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         <link linkend="guint">guint</link> index_);</programlisting>
<para>
Selects the specified menu item within the menu.  This is used by the
<link linkend="GtkOptionMenu"><type>GtkOptionMenu</type></link> and should not be used by anyone else.
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GtkMenu"><type>GtkMenu</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>index_</parameter>&#160;:</term>
<listitem><simpara>the index of the menu item to select.  Index values are from
0 to n-1.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-menu-set-tearoff-state" role="function">
<title>gtk_menu_set_tearoff_state ()</title>
<indexterm zone="gtk-menu-set-tearoff-state"><primary sortas="menu_set_tearoff_state">gtk_menu_set_tearoff_state</primary></indexterm><programlisting><link linkend="void">void</link>                gtk_menu_set_tearoff_state          (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         <link linkend="gboolean">gboolean</link> torn_off);</programlisting>
<para>
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.
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GtkMenu"><type>GtkMenu</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>torn_off</parameter>&#160;:</term>
<listitem><simpara>If <link linkend="TRUE--CAPS"><literal>TRUE</literal></link>, menu is displayed as a tearoff menu.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-menu-attach-to-widget" role="function">
<title>gtk_menu_attach_to_widget ()</title>
<indexterm zone="gtk-menu-attach-to-widget"><primary sortas="menu_attach_to_widget">gtk_menu_attach_to_widget</primary></indexterm><programlisting><link linkend="void">void</link>                gtk_menu_attach_to_widget           (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         <link linkend="GtkWidget">GtkWidget</link> *attach_widget,
                                                         <link linkend="GtkMenuDetachFunc">GtkMenuDetachFunc</link> detacher);</programlisting>
<para>
Attaches the menu to the widget and provides a callback function that will
be invoked when the menu calls <link linkend="gtk-menu-detach"><function>gtk_menu_detach()</function></link> during its destruction.
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GtkMenu"><type>GtkMenu</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>attach_widget</parameter>&#160;:</term>
<listitem><simpara>the <link linkend="GtkWidget"><type>GtkWidget</type></link> that the menu will be attached to.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>detacher</parameter>&#160;:</term>
<listitem><simpara>the user supplied callback function that will be called when 
the menu calls <link linkend="gtk-menu-detach"><function>gtk_menu_detach()</function></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-menu-detach" role="function">
<title>gtk_menu_detach ()</title>
<indexterm zone="gtk-menu-detach"><primary sortas="menu_detach">gtk_menu_detach</primary></indexterm><programlisting><link linkend="void">void</link>                gtk_menu_detach                     (<link linkend="GtkMenu">GtkMenu</link> *menu);</programlisting>
<para>
Detaches the menu from the widget to which it had been attached.
This function will call the callback function, <parameter>detacher</parameter>, provided
when the <link linkend="gtk-menu-attach-to-widget"><function>gtk_menu_attach_to_widget()</function></link> function was called.
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GtkMenu"><type>GtkMenu</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-menu-get-attach-widget" role="function">
<title>gtk_menu_get_attach_widget ()</title>
<indexterm zone="gtk-menu-get-attach-widget"><primary sortas="menu_get_attach_widget">gtk_menu_get_attach_widget</primary></indexterm><programlisting><link linkend="GtkWidget">GtkWidget</link>*          gtk_menu_get_attach_widget          (<link linkend="GtkMenu">GtkMenu</link> *menu);</programlisting>
<para>
Returns the <link linkend="GtkWidget"><type>GtkWidget</type></link> that the menu is attached to.
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GtkMenu"><type>GtkMenu</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>the <link linkend="GtkWidget"><type>GtkWidget</type></link> that the menu is attached to.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-menu-get-for-attach-widget" role="function" condition="since:2.6">
<title>gtk_menu_get_for_attach_widget ()</title>
<indexterm zone="gtk-menu-get-for-attach-widget" role="2.6"><primary sortas="menu_get_for_attach_widget">gtk_menu_get_for_attach_widget</primary></indexterm><programlisting><link linkend="GList">GList</link>*              gtk_menu_get_for_attach_widget      (<link linkend="GtkWidget">GtkWidget</link> *widget);</programlisting>
<para>
Returns a list of the menus which are attached to this widget.
This list is owned by GTK+ and must not be modified.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>widget</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GtkWidget"><type>GtkWidget</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the list of menus attached to his widget.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.6</para></refsect2>
<refsect2 id="GtkMenuPositionFunc" role="function">
<title>GtkMenuPositionFunc ()</title>
<indexterm zone="GtkMenuPositionFunc"><primary sortas="MenuPositionFunc">GtkMenuPositionFunc</primary></indexterm><programlisting><link linkend="void">void</link>                (*GtkMenuPositionFunc)              (<link linkend="GtkMenu">GtkMenu</link> *menu,
                                                         <link linkend="gint">gint</link> *x,
                                                         <link linkend="gint">gint</link> *y,
                                                         <link linkend="gboolean">gboolean</link> *push_in,
                                                         <link linkend="gpointer">gpointer</link> user_data);</programlisting>
<para>
A user function supplied when calling <link linkend="gtk-menu-popup"><function>gtk_menu_popup()</function></link> which controls the
positioning of the menu when it is displayed.  The function sets the <parameter>x</parameter>
and <parameter>y</parameter> parameters to the coordinates where the menu is to be drawn.
To make the menu appear on a different monitor than the mouse pointer,
<link linkend="gtk-menu-set-monitor"><function>gtk_menu_set_monitor()</function></link> must be called.
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GtkMenu"><type>GtkMenu</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>x</parameter>&#160;:</term>
<listitem><simpara>address of the <link linkend="gint"><type>gint</type></link> representing the horizontal position where the
menu shall be drawn.  This is an output parameter.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y</parameter>&#160;:</term>
<listitem><simpara>address of the <link linkend="gint"><type>gint</type></link> representing the vertical position where the
menu shall be drawn.  This is an output parameter.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>push_in</parameter>&#160;:</term>
<listitem><simpara>This parameter controls how menus placed outside the monitor are handled.
        If this is set to <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> and part of the menu is outside the monitor then
        GTK+ pushes the window into the visible area, effectively modifying the
        popup position.
        Note that moving and possibly resizing the menu around will alter the
        scroll position to keep the menu items "in place", i.e. at the same monitor
        position they would have been without resizing.
        In practice, this behavior is only useful for combobox popups or option
        menus and cannot be used to simply confine a menu to monitor boundaries.
        In that case, changing the scroll offset is not desirable.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&#160;:</term>
<listitem><simpara>the data supplied by the user in the <link linkend="gtk-menu-popup"><function>gtk_menu_popup()</function></link> <parameter>data</parameter>
parameter.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="GtkMenuDetachFunc" role="function">
<title>GtkMenuDetachFunc ()</title>
<indexterm zone="GtkMenuDetachFunc"><primary sortas="MenuDetachFunc">GtkMenuDetachFunc</primary></indexterm><programlisting><link linkend="void">void</link>                (*GtkMenuDetachFunc)                (<link linkend="GtkWidget">GtkWidget</link> *attach_widget,
                                                         <link linkend="GtkMenu">GtkMenu</link> *menu);</programlisting>
<para>
A user function supplied when calling <link linkend="gtk-menu-attach-to-widget"><function>gtk_menu_attach_to_widget()</function></link> which
will be called when the menu is later detached from the widget.
</para><variablelist role="params">
<varlistentry><term><parameter>attach_widget</parameter>&#160;:</term>
<listitem><simpara>the <link linkend="GtkWidget"><type>GtkWidget</type></link> that the menu is being detached from.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara>the <link linkend="GtkMenu"><type>GtkMenu</type></link> being detached.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>
<refsect1 id="GtkMenu.property-details" role="property_details">
<title role="property_details.title">Property Details</title>
<refsect2 id="GtkMenu--accel-group" role="property"><title>The <literal>&quot;accel-group&quot;</literal> property</title>
<indexterm zone="GtkMenu--accel-group" role="2.14"><primary sortas="Menu:accel-group">GtkMenu:accel-group</primary></indexterm><programlisting>  &quot;accel-group&quot;              <link linkend="GtkAccelGroup">GtkAccelGroup</link>*        : Read / Write</programlisting>
<para>
The accel group holding accelerators for the menu.</para>
<para>
</para><para>Since 2.14</para>
</refsect2>
<refsect2 id="GtkMenu--accel-path" role="property"><title>The <literal>&quot;accel-path&quot;</literal> property</title>
<indexterm zone="GtkMenu--accel-path" role="2.14"><primary sortas="Menu:accel-path">GtkMenu:accel-path</primary></indexterm><programlisting>  &quot;accel-path&quot;               <link linkend="gchar">gchar</link>*                : Read / Write</programlisting>
<para>
An accel path used to conveniently construct accel paths of child items.</para>
<para>
</para><para>Default value: NULL</para>
<para>Since 2.14</para>
</refsect2>
<refsect2 id="GtkMenu--active" role="property"><title>The <literal>&quot;active&quot;</literal> property</title>
<indexterm zone="GtkMenu--active" role="2.14"><primary sortas="Menu:active">GtkMenu:active</primary></indexterm><programlisting>  &quot;active&quot;                   <link linkend="gint">gint</link>                  : Read / Write</programlisting>
<para>
The index of the currently selected menu item, or -1 if no
menu item is selected.</para>
<para>
</para><para>Allowed values: &gt;= G_MAXULONG</para>
<para>Default value: -1</para>
<para>Since 2.14</para>
</refsect2>
<refsect2 id="GtkMenu--attach-widget" role="property"><title>The <literal>&quot;attach-widget&quot;</literal> property</title>
<indexterm zone="GtkMenu--attach-widget" role="2.14"><primary sortas="Menu:attach-widget">GtkMenu:attach-widget</primary></indexterm><programlisting>  &quot;attach-widget&quot;            <link linkend="GtkWidget">GtkWidget</link>*            : Read / Write</programlisting>
<para>
The widget the menu is attached to. Setting this property attaches
the menu without a <link linkend="GtkMenuDetachFunc"><type>GtkMenuDetachFunc</type></link>. If you need to use a detacher,
use <link linkend="gtk-menu-attach-to-widget"><function>gtk_menu_attach_to_widget()</function></link> directly.</para>
<para>
</para><para>Since 2.14</para>
</refsect2>
<refsect2 id="GtkMenu--monitor" role="property"><title>The <literal>&quot;monitor&quot;</literal> property</title>
<indexterm zone="GtkMenu--monitor" role="2.14"><primary sortas="Menu:monitor">GtkMenu:monitor</primary></indexterm><programlisting>  &quot;monitor&quot;                  <link linkend="gint">gint</link>                  : Read / Write</programlisting>
<para>
The monitor the menu will be popped up on.</para>
<para>
</para><para>Allowed values: &gt;= G_MAXULONG</para>
<para>Default value: -1</para>
<para>Since 2.14</para>
</refsect2>
<refsect2 id="GtkMenu--reserve-toggle-size" role="property"><title>The <literal>&quot;reserve-toggle-size&quot;</literal> property</title>
<indexterm zone="GtkMenu--reserve-toggle-size" role="2.18"><primary sortas="Menu:reserve-toggle-size">GtkMenu:reserve-toggle-size</primary></indexterm><programlisting>  &quot;reserve-toggle-size&quot;      <link linkend="gboolean">gboolean</link>              : Read / Write</programlisting>
<para>
A boolean that indicates whether the menu reserves space for
toggles and icons, regardless of their actual presence.
</para>
<para>
This property should only be changed from its default value
for special-purposes such as tabular menus. Regular menus that
are connected to a menu bar or context menus should reserve
toggle space for consistency.</para>
<para>
</para><para>Default value: TRUE</para>
<para>Since 2.18</para>
</refsect2>
<refsect2 id="GtkMenu--tearoff-state" role="property"><title>The <literal>&quot;tearoff-state&quot;</literal> property</title>
<indexterm zone="GtkMenu--tearoff-state" role="2.6"><primary sortas="Menu:tearoff-state">GtkMenu:tearoff-state</primary></indexterm><programlisting>  &quot;tearoff-state&quot;            <link linkend="gboolean">gboolean</link>              : Read / Write</programlisting>
<para>
A boolean that indicates whether the menu is torn-off.</para>
<para>
</para><para>Default value: FALSE</para>
<para>Since 2.6</para>
</refsect2>
<refsect2 id="GtkMenu--tearoff-title" role="property"><title>The <literal>&quot;tearoff-title&quot;</literal> property</title>
<indexterm zone="GtkMenu--tearoff-title"><primary sortas="Menu:tearoff-title">GtkMenu:tearoff-title</primary></indexterm><programlisting>  &quot;tearoff-title&quot;            <link linkend="gchar">gchar</link>*                : Read / Write</programlisting>
<para>A title that may be displayed by the window manager when this menu is torn-off.</para><para>Default value: NULL</para>
</refsect2>
</refsect1>
<refsect1 id="GtkMenu.child-property-details" role="child_property_details">
<title role="child_property_details.title">Child Property Details</title>
<refsect2 id="GtkMenu--c-bottom-attach" role="property"><title>The <literal>&quot;bottom-attach&quot;</literal> child property</title>
<indexterm zone="GtkMenu--c-bottom-attach"><primary sortas="Menu:bottom-attach">GtkMenu:bottom-attach</primary></indexterm><programlisting>  &quot;bottom-attach&quot;            <link linkend="gint">gint</link>                  : Read / Write</programlisting>
<para>The row number to attach the bottom of the child to.</para><para>Allowed values: &gt;= G_MAXULONG</para>
<para>Default value: -1</para>
</refsect2>
<refsect2 id="GtkMenu--c-left-attach" role="property"><title>The <literal>&quot;left-attach&quot;</literal> child property</title>
<indexterm zone="GtkMenu--c-left-attach"><primary sortas="Menu:left-attach">GtkMenu:left-attach</primary></indexterm><programlisting>  &quot;left-attach&quot;              <link linkend="gint">gint</link>                  : Read / Write</programlisting>
<para>The column number to attach the left side of the child to.</para><para>Allowed values: &gt;= G_MAXULONG</para>
<para>Default value: -1</para>
</refsect2>
<refsect2 id="GtkMenu--c-right-attach" role="property"><title>The <literal>&quot;right-attach&quot;</literal> child property</title>
<indexterm zone="GtkMenu--c-right-attach"><primary sortas="Menu:right-attach">GtkMenu:right-attach</primary></indexterm><programlisting>  &quot;right-attach&quot;             <link linkend="gint">gint</link>                  : Read / Write</programlisting>
<para>The column number to attach the right side of the child to.</para><para>Allowed values: &gt;= G_MAXULONG</para>
<para>Default value: -1</para>
</refsect2>
<refsect2 id="GtkMenu--c-top-attach" role="property"><title>The <literal>&quot;top-attach&quot;</literal> child property</title>
<indexterm zone="GtkMenu--c-top-attach"><primary sortas="Menu:top-attach">GtkMenu:top-attach</primary></indexterm><programlisting>  &quot;top-attach&quot;               <link linkend="gint">gint</link>                  : Read / Write</programlisting>
<para>The row number to attach the top of the child to.</para><para>Allowed values: &gt;= G_MAXULONG</para>
<para>Default value: -1</para>
</refsect2>
</refsect1>
<refsect1 id="GtkMenu.style-property-details" role="style_properties_details">
<title role="style_properties_details.title">Style Property Details</title>
<refsect2 id="GtkMenu--s-arrow-placement" role="property"><title>The <literal>&quot;arrow-placement&quot;</literal> style property</title>
<indexterm zone="GtkMenu--s-arrow-placement" role="2.16"><primary sortas="Menu:arrow-placement">GtkMenu:arrow-placement</primary></indexterm><programlisting>  &quot;arrow-placement&quot;          <link linkend="GtkArrowPlacement">GtkArrowPlacement</link>     : Read</programlisting>
<para>
Indicates where scroll arrows should be placed.</para>
<para>
</para><para>Default value: GTK_ARROWS_BOTH</para>
<para>Since 2.16</para>
</refsect2>
<refsect2 id="GtkMenu--s-arrow-scaling" role="property"><title>The <literal>&quot;arrow-scaling&quot;</literal> style property</title>
<indexterm zone="GtkMenu--s-arrow-scaling"><primary sortas="Menu:arrow-scaling">GtkMenu:arrow-scaling</primary></indexterm><programlisting>  &quot;arrow-scaling&quot;            <link linkend="gfloat">gfloat</link>                : Read</programlisting>
<para>Arbitrary constant to scale down the size of the scroll arrow.</para><para>Allowed values: [0,1]</para>
<para>Default value: 0.7</para>
</refsect2>
<refsect2 id="GtkMenu--s-double-arrows" role="property"><title>The <literal>&quot;double-arrows&quot;</literal> style property</title>
<indexterm zone="GtkMenu--s-double-arrows"><primary sortas="Menu:double-arrows">GtkMenu:double-arrows</primary></indexterm><programlisting>  &quot;double-arrows&quot;            <link linkend="gboolean">gboolean</link>              : Read</programlisting>
<para>When scrolling, always show both arrows.</para><para>Default value: TRUE</para>
</refsect2>
<refsect2 id="GtkMenu--s-horizontal-offset" role="property"><title>The <literal>&quot;horizontal-offset&quot;</literal> style property</title>
<indexterm zone="GtkMenu--s-horizontal-offset"><primary sortas="Menu:horizontal-offset">GtkMenu:horizontal-offset</primary></indexterm><programlisting>  &quot;horizontal-offset&quot;        <link linkend="gint">gint</link>                  : Read</programlisting>
<para>When the menu is a submenu, position it this number of pixels offset horizontally.</para><para>Default value: -2</para>
</refsect2>
<refsect2 id="GtkMenu--s-horizontal-padding" role="property"><title>The <literal>&quot;horizontal-padding&quot;</literal> style property</title>
<indexterm zone="GtkMenu--s-horizontal-padding"><primary sortas="Menu:horizontal-padding">GtkMenu:horizontal-padding</primary></indexterm><programlisting>  &quot;horizontal-padding&quot;       <link linkend="gint">gint</link>                  : Read</programlisting>
<para>Extra space at the left and right edges of the menu.</para><para>Allowed values: &gt;= 0</para>
<para>Default value: 0</para>
</refsect2>
<refsect2 id="GtkMenu--s-vertical-offset" role="property"><title>The <literal>&quot;vertical-offset&quot;</literal> style property</title>
<indexterm zone="GtkMenu--s-vertical-offset"><primary sortas="Menu:vertical-offset">GtkMenu:vertical-offset</primary></indexterm><programlisting>  &quot;vertical-offset&quot;          <link linkend="gint">gint</link>                  : Read</programlisting>
<para>When the menu is a submenu, position it this number of pixels offset vertically.</para><para>Default value: 0</para>
</refsect2>
<refsect2 id="GtkMenu--s-vertical-padding" role="property"><title>The <literal>&quot;vertical-padding&quot;</literal> style property</title>
<indexterm zone="GtkMenu--s-vertical-padding"><primary sortas="Menu:vertical-padding">GtkMenu:vertical-padding</primary></indexterm><programlisting>  &quot;vertical-padding&quot;         <link linkend="gint">gint</link>                  : Read</programlisting>
<para>Extra space at the top and bottom of the menu.</para><para>Allowed values: &gt;= 0</para>
<para>Default value: 1</para>
</refsect2>
</refsect1>

<refsect1 id="GtkMenu.signal-details" role="signals">
<title role="signals.title">Signal Details</title>
<refsect2 id="GtkMenu-move-scroll" role="signal"><title>The <literal>&quot;move-scroll&quot;</literal> signal</title>
<indexterm zone="GtkMenu-move-scroll"><primary sortas="Menu::move-scroll">GtkMenu::move-scroll</primary></indexterm><programlisting><link linkend="void">void</link>                user_function                      (<link linkend="GtkMenu">GtkMenu</link>      *menu,
                                                        <link linkend="GtkScrollType">GtkScrollType</link> arg1,
                                                        <link linkend="gpointer">gpointer</link>      user_data)      : Run Last / Action</programlisting>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara>the object which received the signal.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>arg1</parameter>&#160;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&#160;:</term>
<listitem><simpara>user data set when the signal handler was connected.</simpara></listitem></varlistentry>
</variablelist></refsect2>
</refsect1>



</refentry>
