Gtk.MenuBar CreateMenus ()
		{
			AccelGroup group = new AccelGroup ();
			MenuBar bar = new MenuBar ();
			
			Menu file_menu = new Menu ();
			MenuItem file_menu_item = new MenuItem ("_File");
			file_menu_item.Submenu = file_menu;
			
			ImageMenuItem file_exit = new ImageMenuItem (Gtk.Stock.Quit, group);
			file_exit.Activated += new EventHandler (exit_cb);
			file_menu.Append (file_exit);
			bar.Append (file_menu_item);

			Menu help_menu = new Menu ();
			ImageMenuItem help_menu_item = new ImageMenuItem (Gtk.Stock.Help, group);
			help_menu_item.Submenu = help_menu;
			
			ImageMenuItem file_help = new ImageMenuItem (Gnome.Stock.About, group);
			file_help.Activated += new EventHandler (about_cb);
			help_menu.Append (file_help);
			bar.Append (help_menu_item);
			bar.ShowAll ();

			return bar;
		}
Example #2
0
        //------------------------------------------------------------------------------
        public MainMenu()
        {
            uim = new Gtk.UIManager();

            Gtk.ActionGroup actions = new Gtk.ActionGroup("MenuBarActions" + Guid.NewGuid());

            actions.Add(getActionEntries());
            uim.InsertActionGroup(actions, 0);

            // Put the XML definition of the controls (widgets) into the UIManager's buffer -and- create controls (widgets).
            uim.AddUiFromString(UI.ToString());

            instance = (Gtk.MenuBar)uim.GetWidget("/menubar");
            instance.ShowAll();
        }
Example #3
0
    void LoadPlugins()
    {
        // TEMPORARY: Hide "Action" menu for now (AutoSmoother will be hidden until it's more
        // fleshed out)
        menubar1.Remove(actionMenuItem);

#if (!DEBUG)
        menubar1.Remove(debugMenuItem);
#endif

        pluginCore.ReloadPlugins();

        foreach (Plugin plugin in pluginCore.GetPlugins())
        {
            Gtk.Menu pluginSubMenu;
            if (plugin.Category == "Window")
            {
                pluginSubMenu = editMenuItem.Submenu as Gtk.Menu;
            }
            else if (plugin.Category == "Action")
            {
                pluginSubMenu = actionMenuItem.Submenu as Gtk.Menu;
            }
            else if (plugin.Category == "Debug")
            {
                pluginSubMenu = debugMenuItem.Submenu as Gtk.Menu;
            }
            else
            {
                log.Error("Unknown category '" + plugin.Category + "'.");
                continue;
            }

            var item = new MenuItem(plugin.Name);
            item.Activated += ((a, b) =>
            {
                plugin.SpawnWindow();
            });
            pluginSubMenu.Append(item);
        }
        menubar1.ShowAll();
    }
Example #4
0
    void CreateMenuBar()
    {
        topMenu = new Gtk.MenuBar();
        Menu     fileMenu = new Menu();
        MenuItem file     = new MenuItem("File");

        file.Submenu = fileMenu;

        AccelGroup agr = new AccelGroup();

        AddAccelGroup(agr);

        ImageMenuItem exit = new ImageMenuItem(Stock.Quit, agr);

        exit.AddAccelerator("activate", agr, new AccelKey(Gdk.Key.q, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
        exit.Activated += onButtonPressEvent;
        fileMenu.Append(exit);

        topMenu.Append(file);

        ((VBox)fullViewVBox).PackStart(topMenu, false, false, 0);
        ((Gtk.Box.BoxChild)fullViewVBox [topMenu]).Position = 0;
        topMenu.ShowAll();
    }
Example #5
0
        //------------------------------------------------------------------------------
        public MainMenu()
        {
            uim = new Gtk.UIManager ();

            Gtk.ActionGroup actions = new Gtk.ActionGroup ("MenuBarActions" + Guid.NewGuid ());

            actions.Add (getActionEntries ());
            uim.InsertActionGroup (actions, 0);

            // Put the XML definition of the controls (widgets) into the UIManager's buffer -and- create controls (widgets).
            uim.AddUiFromString (UI.ToString ());

            instance = (Gtk.MenuBar)uim.GetWidget ("/menubar");
            instance.ShowAll ();
        }
Example #6
0
    void CreateMenuBar()
    {
        topMenu = new Gtk.MenuBar();
        Menu fileMenu = new Menu();
        MenuItem file = new MenuItem("File");
        file.Submenu = fileMenu;

        AccelGroup agr = new AccelGroup();
        AddAccelGroup(agr);

        ImageMenuItem exit = new ImageMenuItem(Stock.Quit, agr);
        exit.AddAccelerator("activate", agr, new AccelKey(Gdk.Key.q, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
        exit.Activated += onButtonPressEvent;
        fileMenu.Append(exit);

        topMenu.Append(file);

        ((VBox)fullViewVBox).PackStart (topMenu, false, false, 0);
            ((Gtk.Box.BoxChild) fullViewVBox [topMenu]).Position = 0;
            topMenu.ShowAll ();
    }