See Also: Menu Members
A Gtk.Menu is a Gtk.MenuShell that implements a drop down menu consisting of a list of Gtk.MenuItem objects which can be navigated and activated by the user to perform application functions.
It is commonly dropped down by activating a Gtk.MenuItem in a Gtk.MenuBar or in another Gtk.Menu, it can also be popped up by activating a Gtk.OptionMenu. Other composite widgets such as the Gtk.Notebook can pop up a Gtk.Menu as well.
C# Example
using System;
using Gtk;
public class MenuApp
{
public static void Main (string[] args)
{
Application.Init();
Window win = new Window ("Menu Sample App");
win.DeleteEvent += new DeleteEventHandler (delete_cb);
win.SetDefaultSize (200, 150);
VBox box = new VBox (false, 2);
MenuBar mb = new MenuBar ();
Menu file_menu = new Menu ();
MenuItem exit_item = new MenuItem("Exit");
exit_item.Activated += new EventHandler (exit_cb);
file_menu.Append (exit_item);
MenuItem file_item = new MenuItem("File");
file_item.Submenu = file_menu;
mb.Append (file_item);
box.PackStart(mb, false, false, 0);
Button btn = new Button ("Yep, that's a menu");
box.PackStart(btn, true, true, 0);
win.Add (box);
win.ShowAll ();
Application.Run ();
}
static void delete_cb (object o, DeleteEventArgs args)
{
Application.Quit ();
}
static void exit_cb (object o, EventArgs args)
{
Application.Quit ();
}
}