<refentry id="libgnomeui-gnome-popup-menu">
<refmeta>
<refentrytitle role="top_of_page" id="libgnomeui-gnome-popup-menu.top_of_page">gnome-popup-menu</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>LIBGNOMEUI Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>gnome-popup-menu</refname>
<refpurpose>Create and display popup and context menus.</refpurpose>
</refnamediv>

<refsynopsisdiv id="libgnomeui-gnome-popup-menu.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>

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

<link linkend="GtkWidget">GtkWidget</link> *         <link linkend="gnome-popup-menu-new">gnome_popup_menu_new</link>                (<link linkend="GnomeUIInfo">GnomeUIInfo</link> *uiinfo);
<link linkend="GtkWidget">GtkWidget</link> *         <link linkend="gnome-popup-menu-new-with-accelgroup">gnome_popup_menu_new_with_accelgroup</link>
                                                        (<link linkend="GnomeUIInfo">GnomeUIInfo</link> *uiinfo,
                                                         <link linkend="GtkAccelGroup">GtkAccelGroup</link> *accelgroup);
<link linkend="GtkAccelGroup">GtkAccelGroup</link> *     <link linkend="gnome-popup-menu-get-accel-group">gnome_popup_menu_get_accel_group</link>    (<link linkend="GtkMenu">GtkMenu</link> *menu);
<link linkend="void">void</link>                <link linkend="gnome-popup-menu-attach">gnome_popup_menu_attach</link>             (<link linkend="GtkWidget">GtkWidget</link> *popup,
                                                         <link linkend="GtkWidget">GtkWidget</link> *widget,
                                                         <link linkend="gpointer">gpointer</link> user_data);
<link linkend="void">void</link>                <link linkend="gnome-popup-menu-do-popup">gnome_popup_menu_do_popup</link>           (<link linkend="GtkWidget">GtkWidget</link> *popup,
                                                         <link linkend="GtkMenuPositionFunc">GtkMenuPositionFunc</link> pos_func,
                                                         <link linkend="gpointer">gpointer</link> pos_data,
                                                         <link linkend="GdkEventButton">GdkEventButton</link> *event,
                                                         <link linkend="gpointer">gpointer</link> user_data,
                                                         <link linkend="GtkWidget">GtkWidget</link> *for_widget);
<link linkend="int">int</link>                 <link linkend="gnome-popup-menu-do-popup-modal">gnome_popup_menu_do_popup_modal</link>     (<link linkend="GtkWidget">GtkWidget</link> *popup,
                                                         <link linkend="GtkMenuPositionFunc">GtkMenuPositionFunc</link> pos_func,
                                                         <link linkend="gpointer">gpointer</link> pos_data,
                                                         <link linkend="GdkEventButton">GdkEventButton</link> *event,
                                                         <link linkend="gpointer">gpointer</link> user_data,
                                                         <link linkend="GtkWidget">GtkWidget</link> *for_widget);
<link linkend="void">void</link>                <link linkend="gnome-popup-menu-append">gnome_popup_menu_append</link>             (<link linkend="GtkWidget">GtkWidget</link> *popup,
                                                         <link linkend="GnomeUIInfo">GnomeUIInfo</link> *uiinfo);
<link linkend="void">void</link>                <link linkend="gnome-gtk-widget-add-popup-items">gnome_gtk_widget_add_popup_items</link>    (<link linkend="GtkWidget">GtkWidget</link> *widget,
                                                         <link linkend="GnomeUIInfo">GnomeUIInfo</link> *uiinfo,
                                                         <link linkend="gpointer">gpointer</link> user_data);
</synopsis>
</refsynopsisdiv>









<refsect1 id="libgnomeui-gnome-popup-menu.description" role="desc">
<title role="desc.title">Description</title>
<para>
</para>
</refsect1>

<refsect1 id="libgnomeui-gnome-popup-menu.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="gnome-popup-menu-new" role="function" condition="deprecated:">
<title>gnome_popup_menu_new ()</title>
<indexterm zone="gnome-popup-menu-new" role="deprecated"><primary sortas="gnome_popup_menu_new">gnome_popup_menu_new</primary></indexterm><programlisting><link linkend="GtkWidget">GtkWidget</link> *         gnome_popup_menu_new                (<link linkend="GnomeUIInfo">GnomeUIInfo</link> *uiinfo);</programlisting>
<warning><para><literal>gnome_popup_menu_new</literal> is deprecated and should not be used in newly-written code.</para></warning>
<para>
This function behaves just like
<link linkend="gnome-popup-menu-new-with-accelgroup"><function>gnome_popup_menu_new_with_accelgroup()</function></link>, except that it creates an
accelgroup for you and attaches it to the menu object.  Use
<link linkend="gnome-popup-menu-get-accel-group"><function>gnome_popup_menu_get_accel_group()</function></link> to get the accelgroup that is
created.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>uiinfo</parameter>&#160;:</term>
<listitem><simpara> A <link linkend="GnomeUIInfo"><type>GnomeUIInfo</type></link> array describing the new menu.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> A menu widget.

</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gnome-popup-menu-new-with-accelgroup" role="function" condition="deprecated:">
<title>gnome_popup_menu_new_with_accelgroup ()</title>
<indexterm zone="gnome-popup-menu-new-with-accelgroup" role="deprecated"><primary sortas="gnome_popup_menu_new_with_accelgroup">gnome_popup_menu_new_with_accelgroup</primary></indexterm><programlisting><link linkend="GtkWidget">GtkWidget</link> *         gnome_popup_menu_new_with_accelgroup
                                                        (<link linkend="GnomeUIInfo">GnomeUIInfo</link> *uiinfo,
                                                         <link linkend="GtkAccelGroup">GtkAccelGroup</link> *accelgroup);</programlisting>
<warning><para><literal>gnome_popup_menu_new_with_accelgroup</literal> is deprecated and should not be used in newly-written code.</para></warning>
<para>
Creates a popup menu out of the specified <parameter>uiinfo</parameter> array.  Use
<link linkend="gnome-popup-menu-do-popup"><function>gnome_popup_menu_do_popup()</function></link> to pop the menu up, or attach it to a
window with <link linkend="gnome-popup-menu-attach"><function>gnome_popup_menu_attach()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>uiinfo</parameter>&#160;:</term>
<listitem><simpara> A <link linkend="GnomeUIInfo"><type>GnomeUIInfo</type></link> array describing the new menu.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>accelgroup</parameter>&#160;:</term>
<listitem><simpara> A <link linkend="GtkAccelGroup"><type>GtkAccelGroup</type></link> describing the accelerator key structure.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> A menu widget.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gnome-popup-menu-get-accel-group" role="function" condition="deprecated:">
<title>gnome_popup_menu_get_accel_group ()</title>
<indexterm zone="gnome-popup-menu-get-accel-group" role="deprecated"><primary sortas="gnome_popup_menu_get_accel_group">gnome_popup_menu_get_accel_group</primary></indexterm><programlisting><link linkend="GtkAccelGroup">GtkAccelGroup</link> *     gnome_popup_menu_get_accel_group    (<link linkend="GtkMenu">GtkMenu</link> *menu);</programlisting>
<warning><para><literal>gnome_popup_menu_get_accel_group</literal> is deprecated and should not be used in newly-written code.</para></warning>
<para>
This function is used to retrieve the accelgroup that was created by
<link linkend="gnome-popup-menu-new"><function>gnome_popup_menu_new()</function></link>. If you want to specify the accelgroup that the popup
menu accelerators use, then use <link linkend="gnome-popup-menu-new-with-accelgroup"><function>gnome_popup_menu_new_with_accelgroup()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&#160;:</term>
<listitem><simpara> A menu widget.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> The accelgroup associated with the specified <link linkend="GtkMenu"><type>GtkMenu</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gnome-popup-menu-attach" role="function" condition="deprecated:">
<title>gnome_popup_menu_attach ()</title>
<indexterm zone="gnome-popup-menu-attach" role="deprecated"><primary sortas="gnome_popup_menu_attach">gnome_popup_menu_attach</primary></indexterm><programlisting><link linkend="void">void</link>                gnome_popup_menu_attach             (<link linkend="GtkWidget">GtkWidget</link> *popup,
                                                         <link linkend="GtkWidget">GtkWidget</link> *widget,
                                                         <link linkend="gpointer">gpointer</link> user_data);</programlisting>
<warning><para><literal>gnome_popup_menu_attach</literal> is deprecated and should not be used in newly-written code.</para></warning>
<para>
Attaches the specified popup menu to the specified widget.  The
menu can then be activated by pressing mouse button 3 over the
widget.  When a menu item callback is invoked, the specified
user_data will be passed to it.
</para>
<para>
This function requires the widget to have its own window
(i.e. GTK_WIDGET_NO_WINDOW (widget) == FALSE), This function will
try to set the GDK_BUTTON_PRESS_MASK flag on the widget's event
mask if it does not have it yet; if this is the case, then the
widget must not be realized for it to work.
</para>
<para>
The popup menu can be attached to different widgets at the same
time.  A reference count is kept on the popup menu; when all the
widgets it is attached to are destroyed, the popup menu will be
destroyed as well.
</para>
<para>
Under the current implementation, setting a popup menu for a NO_WINDOW
widget and then reparenting that widget will cause Bad Things to happen.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>popup</parameter>&#160;:</term>
<listitem><simpara> A menu widget.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>widget</parameter>&#160;:</term>
<listitem><simpara> The widget to attach the popup menu to.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&#160;:</term>
<listitem><simpara> Application specific data passed to the callback.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gnome-popup-menu-do-popup" role="function" condition="deprecated:">
<title>gnome_popup_menu_do_popup ()</title>
<indexterm zone="gnome-popup-menu-do-popup" role="deprecated"><primary sortas="gnome_popup_menu_do_popup">gnome_popup_menu_do_popup</primary></indexterm><programlisting><link linkend="void">void</link>                gnome_popup_menu_do_popup           (<link linkend="GtkWidget">GtkWidget</link> *popup,
                                                         <link linkend="GtkMenuPositionFunc">GtkMenuPositionFunc</link> pos_func,
                                                         <link linkend="gpointer">gpointer</link> pos_data,
                                                         <link linkend="GdkEventButton">GdkEventButton</link> *event,
                                                         <link linkend="gpointer">gpointer</link> user_data,
                                                         <link linkend="GtkWidget">GtkWidget</link> *for_widget);</programlisting>
<warning><para><literal>gnome_popup_menu_do_popup</literal> is deprecated and should not be used in newly-written code.</para></warning>
<para>
You can use this function to pop up a menu.  When a menu item
callback is invoked, the specified user_data will be passed to it.
</para>
<para>
The pos_func and pos_data parameters are the same as for
<link linkend="gtk-menu-popup"><function>gtk_menu_popup()</function></link>, i.e. you can use them to specify a function to
position the menu explicitly.  If you want the default position
(near the mouse), pass NULL for these parameters.
</para>
<para>
The event parameter is needed to figure out the mouse button that
activated the menu and the time at which this happened.  If you
pass in NULL, then no button and the current time will be used as
defaults.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>popup</parameter>&#160;:</term>
<listitem><simpara> A menu widget.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>pos_func</parameter>&#160;:</term>
<listitem><simpara> A user supplied function to position the menu or <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>pos_data</parameter>&#160;:</term>
<listitem><simpara> User supplied data to pass to <parameter>pos_func</parameter>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>event</parameter>&#160;:</term>
<listitem><simpara> A <link linkend="GdkEventButton"><type>GdkEventButton</type></link> structure containing the event that triggered the
menu (or <link linkend="NULL--CAPS"><literal>NULL</literal></link>).
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&#160;:</term>
<listitem><simpara> Application specific data passed to the menu callback.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>for_widget</parameter>&#160;:</term>
<listitem><simpara> The widget for which the popup was triggered.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gnome-popup-menu-do-popup-modal" role="function" condition="deprecated:">
<title>gnome_popup_menu_do_popup_modal ()</title>
<indexterm zone="gnome-popup-menu-do-popup-modal" role="deprecated"><primary sortas="gnome_popup_menu_do_popup_modal">gnome_popup_menu_do_popup_modal</primary></indexterm><programlisting><link linkend="int">int</link>                 gnome_popup_menu_do_popup_modal     (<link linkend="GtkWidget">GtkWidget</link> *popup,
                                                         <link linkend="GtkMenuPositionFunc">GtkMenuPositionFunc</link> pos_func,
                                                         <link linkend="gpointer">gpointer</link> pos_data,
                                                         <link linkend="GdkEventButton">GdkEventButton</link> *event,
                                                         <link linkend="gpointer">gpointer</link> user_data,
                                                         <link linkend="GtkWidget">GtkWidget</link> *for_widget);</programlisting>
<warning><para><literal>gnome_popup_menu_do_popup_modal</literal> is deprecated and should not be used in newly-written code.</para></warning>
<para>
Same as <link linkend="gnome-popup-do-modal"><function>gnome_popup_do_modal()</function></link>, but runs the popup menu modally.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>popup</parameter>&#160;:</term>
<listitem><simpara> A menu widget.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>pos_func</parameter>&#160;:</term>
<listitem><simpara> A user supplied function to position the menu or <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>pos_data</parameter>&#160;:</term>
<listitem><simpara> User supplied data to pass to <parameter>pos_func</parameter>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>event</parameter>&#160;:</term>
<listitem><simpara> A <link linkend="GdkEventButton"><type>GdkEventButton</type></link> structure containing the event that triggered the
menu (or <link linkend="NULL--CAPS"><literal>NULL</literal></link>).
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&#160;:</term>
<listitem><simpara> Application specific data passed to the menu callback.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>for_widget</parameter>&#160;:</term>
<listitem><simpara> The widget for which the popup was triggered.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> The index of the selected item or -1 if no item selected.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gnome-popup-menu-append" role="function" condition="deprecated:">
<title>gnome_popup_menu_append ()</title>
<indexterm zone="gnome-popup-menu-append" role="deprecated"><primary sortas="gnome_popup_menu_append">gnome_popup_menu_append</primary></indexterm><programlisting><link linkend="void">void</link>                gnome_popup_menu_append             (<link linkend="GtkWidget">GtkWidget</link> *popup,
                                                         <link linkend="GnomeUIInfo">GnomeUIInfo</link> *uiinfo);</programlisting>
<warning><para><literal>gnome_popup_menu_append</literal> is deprecated and should not be used in newly-written code.</para></warning>
<para>
Appends the menu items in <parameter>uiinfo</parameter> the <parameter>popup</parameter> menu.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>popup</parameter>&#160;:</term>
<listitem><simpara> An existing popup menu.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>uiinfo</parameter>&#160;:</term>
<listitem><simpara> A <link linkend="GnomeUIInfo"><type>GnomeUIInfo</type></link> array describing new menu elements.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gnome-gtk-widget-add-popup-items" role="function" condition="deprecated:">
<title>gnome_gtk_widget_add_popup_items ()</title>
<indexterm zone="gnome-gtk-widget-add-popup-items" role="deprecated"><primary sortas="gnome_gtk_widget_add_popup_items">gnome_gtk_widget_add_popup_items</primary></indexterm><programlisting><link linkend="void">void</link>                gnome_gtk_widget_add_popup_items    (<link linkend="GtkWidget">GtkWidget</link> *widget,
                                                         <link linkend="GnomeUIInfo">GnomeUIInfo</link> *uiinfo,
                                                         <link linkend="gpointer">gpointer</link> user_data);</programlisting>
<warning><para><literal>gnome_gtk_widget_add_popup_items</literal> is deprecated and should not be used in newly-written code.</para></warning>
<para>
This creates a new popup menu for <parameter>widget</parameter> if none exists, and then adds the
items in <parameter>uiinfo</parameter> to the popup menu of <parameter>widget</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>widget</parameter>&#160;:</term>
<listitem><simpara> The widget to append popup menu items for.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>uiinfo</parameter>&#160;:</term>
<listitem><simpara> A <link linkend="GnomeUIInfo"><type>GnomeUIInfo</type></link> array describing new menu elements.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&#160;:</term>
<listitem><simpara> The user_data to pass to the callbacks for the menu items.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
