GtkMenu
*******

A menu widget

Overview
========

A <gtk-menu> is a <gtk-menu-shell> that implements a drop down menu consisting of a list of <gtk-menu-item> objects which can be navigated and activated by the user to perform application functions.

A <gtk-menu> is most commonly dropped down by activating a <gtk-menu-item> in a <gtk-menu-bar> or popped up by activating a <gtk-menu-item> in another <gtk-menu>.

A <gtk-menu> can also be popped up by activating a <gtk-option-menu>. Other composite widgets such as the <gtk-notebook> can pop up a <gtk-menu> as well.

Applications can display a <gtk-menu> as a popup menu by calling the gtk-menu-popup function. The example below shows how an application can pop up a menu when the 3rd mouse button is pressed.

         /* connect our handler which will popup the menu */
         g_signal_connect_swapped (window, "button_press_event",
     	G_CALLBACK (my_popup_handler), menu);

     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;
     }

Usage
=====

     [file defuns-gtkmenu.xml.texi not included]