## gnome-popup-menu gnome-popup-menu — Create and display popup and context menus. |

## Synopsis

    #include <libgnomeui/libgnomeui.h>

    GtkWidget *         gnome_popup_menu_new                (GnomeUIInfo *uiinfo);
    GtkWidget *         gnome_popup_menu_new_with_accelgroup
                                                            (GnomeUIInfo *uiinfo,
                                                             GtkAccelGroup *accelgroup);
    GtkAccelGroup *     gnome_popup_menu_get_accel_group    (GtkMenu *menu);
    void                gnome_popup_menu_attach             (GtkWidget *popup,
                                                             GtkWidget *widget,
                                                             gpointer user_data);
    void                gnome_popup_menu_do_popup           (GtkWidget *popup,
                                                             GtkMenuPositionFunc pos_func,
                                                             gpointer pos_data,
                                                             GdkEventButton *event,
                                                             gpointer user_data,
                                                             GtkWidget *for_widget);
    int                 gnome_popup_menu_do_popup_modal     (GtkWidget *popup,
                                                             GtkMenuPositionFunc pos_func,
                                                             gpointer pos_data,
                                                             GdkEventButton *event,
                                                             gpointer user_data,
                                                             GtkWidget *for_widget);
    void                gnome_popup_menu_append             (GtkWidget *popup,
                                                             GnomeUIInfo *uiinfo);
    void                gnome_gtk_widget_add_popup_items    (GtkWidget *widget,
                                                             GnomeUIInfo *uiinfo,
                                                             gpointer user_data);

## Description

## Details

### gnome_popup_menu_new ()

    GtkWidget *         gnome_popup_menu_new                (GnomeUIInfo *uiinfo);

### Warning

`gnome_popup_menu_new` is deprecated and should not be used in newly-written code.

This function behaves just like `gnome_popup_menu_new_with_accelgroup()`, except that it creates an accelgroup for you and attaches it to the menu object. Use `gnome_popup_menu_get_accel_group()` to get the accelgroup that is created.

`uiinfo` : | A GnomeUIInfo array describing the new menu.
Returns : | A menu widget.

### gnome_popup_menu_new_with_accelgroup ()

    GtkWidget *         gnome_popup_menu_new_with_accelgroup
                                                            (GnomeUIInfo *uiinfo,
                                                             GtkAccelGroup *accelgroup);

### Warning

`gnome_popup_menu_new_with_accelgroup` is deprecated and should not be used in newly-written code.

Creates a popup menu out of the specified `uiinfo` array. Use `gnome_popup_menu_do_popup()` to pop the menu up, or attach it to a window with `gnome_popup_menu_attach()`.

`uiinfo` : | A GnomeUIInfo array describing the new menu.
`accelgroup` : | A GtkAccelGroup describing the accelerator key structure.
Returns : | A menu widget.

### gnome_popup_menu_get_accel_group ()

    GtkAccelGroup *     gnome_popup_menu_get_accel_group    (GtkMenu *menu);

### Warning

`gnome_popup_menu_get_accel_group` is deprecated and should not be used in newly-written code.

This function is used to retrieve the accelgroup that was created by `gnome_popup_menu_new()`. If you want to specify the accelgroup that the popup menu accelerators use, then use `gnome_popup_menu_new_with_accelgroup()`.

`menu` : | A menu widget.
Returns : | The accelgroup associated with the specified GtkMenu.

### gnome_popup_menu_attach ()

    void                gnome_popup_menu_attach             (GtkWidget *popup,
                                                             GtkWidget *widget,
                                                             gpointer user_data);

### Warning

`gnome_popup_menu_attach` is deprecated and should not be used in newly-written code.

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.

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.

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.

Under the current implementation, setting a popup menu for a NO_WINDOW widget and then reparenting that widget will cause Bad Things to happen.

`popup` : | A menu widget.
`widget` : | The widget to attach the popup menu to.
`user_data` : | Application specific data passed to the callback.

### gnome_popup_menu_do_popup ()

    void                gnome_popup_menu_do_popup           (GtkWidget *popup,
                                                             GtkMenuPositionFunc pos_func,
                                                             gpointer pos_data,
                                                             GdkEventButton *event,
                                                             gpointer user_data,
                                                             GtkWidget *for_widget);

### Warning

`gnome_popup_menu_do_popup` is deprecated and should not be used in newly-written code.

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.

The pos_func and pos_data parameters are the same as for `gtk_menu_popup()`, 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.

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.

`popup` : | A menu widget.
`pos_func` : | A user supplied function to position the menu or `NULL`.
`pos_data` : | User supplied data to pass to `pos_func`.
`event` : | A GdkEventButton structure containing the event that triggered the menu (or `NULL`).
`user_data` : | Application specific data passed to the menu callback.
`for_widget` : | The widget for which the popup was triggered.

### gnome_popup_menu_do_popup_modal ()

    int                 gnome_popup_menu_do_popup_modal     (GtkWidget *popup,
                                                             GtkMenuPositionFunc pos_func,
                                                             gpointer pos_data,
                                                             GdkEventButton *event,
                                                             gpointer user_data,
                                                             GtkWidget *for_widget);

### Warning

`gnome_popup_menu_do_popup_modal` is deprecated and should not be used in newly-written code.

Same as `gnome_popup_do_modal()`, but runs the popup menu modally.

`popup` : | A menu widget.
`pos_func` : | A user supplied function to position the menu or `NULL`.
`pos_data` : | User supplied data to pass to `pos_func`.
`event` : | A GdkEventButton structure containing the event that triggered the menu (or `NULL`).
`user_data` : | Application specific data passed to the menu callback.
`for_widget` : | The widget for which the popup was triggered.
Returns : | The index of the selected item or -1 if no item selected.

### gnome_popup_menu_append ()

    void                gnome_popup_menu_append             (GtkWidget *popup,
                                                             GnomeUIInfo *uiinfo);

### Warning

`gnome_popup_menu_append` is deprecated and should not be used in newly-written code.

Appends the menu items in `uiinfo` the `popup` menu.

`popup` : | An existing popup menu.
`uiinfo` : | A GnomeUIInfo array describing new menu elements.

### gnome_gtk_widget_add_popup_items ()

    void                gnome_gtk_widget_add_popup_items    (GtkWidget *widget,
                                                             GnomeUIInfo *uiinfo,
                                                             gpointer user_data);

### Warning

`gnome_gtk_widget_add_popup_items` is deprecated and should not be used in newly-written code.

This creates a new popup menu for `widget` if none exists, and then adds the items in `uiinfo` to the popup menu of `widget`.

`widget` : | The widget to append popup menu items for.
`uiinfo` : | A GnomeUIInfo array describing new menu elements.
`user_data` : | The user_data to pass to the callbacks for the menu items.