From 50c2fa8c09c7c0d2ae2dcfe689fb9bf60bee6d45 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Wed, 12 Jan 2005 19:42:14 +0000 Subject: [PATCH] Contributions from ultrakorne@paranoici.org svn path=/trunk/gtk-sharp/; revision=38819 --- doc/en/Gtk/ImageMenuItem.xml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/doc/en/Gtk/ImageMenuItem.xml b/doc/en/Gtk/ImageMenuItem.xml index c19bb3cea..49268fde6 100644 --- a/doc/en/Gtk/ImageMenuItem.xml +++ b/doc/en/Gtk/ImageMenuItem.xml @@ -15,6 +15,31 @@ is a which has an icon next to the text label. Note that the user can disable display of menu icons, so make sure to still fill in the text label. + + + //How to add MenuBar with a Quit stock MenuItem + ... + Window win; //if your class derive from Window then call this. istead of win. + MenuBar menuBar + ... + AccelGroup grup = new AccelGroup (); + win.AddAccelGroup(grup); + + menuFile = new Menu (); + ImageMenuItem quit_item = new ImageMenuItem(Stock.Quit, group); + quit_item.AddAccelerator("activate", grup, new AccelKey( + Gdk.Key.q, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); + + //OnMenuFileQuit is the Method runned when the event is trigged + quit_item.Activated += new EventHandler (OnMenuFileQuit); + menuFile.Append(quit_item); + MenuItem file_item = new MenuItem("_File"); + file_item.Submenu = menuFile; + + menuBar.Append(file_item); + + +