AddAppMenuGroup() public static method

public static AddAppMenuGroup ( ) : Pinta.IgeMacMenuGroup
return Pinta.IgeMacMenuGroup
Exemplo n.º 1
0
        private void CreateMainMenu(WindowShell shell)
        {
            var main_menu = window_shell.CreateMainMenu("main_menu");

            main_menu.Append(new Gtk.Action("file", Catalog.GetString("_File")).CreateMenuItem());
            main_menu.Append(new Gtk.Action("edit", Catalog.GetString("_Edit")).CreateMenuItem());

            MenuItem view_menu = (MenuItem) new Gtk.Action("view", Catalog.GetString("_View")).CreateMenuItem();

            main_menu.Append(view_menu);

            main_menu.Append(new Gtk.Action("image", Catalog.GetString("_Image")).CreateMenuItem());
            main_menu.Append(new Gtk.Action("layers", Catalog.GetString("_Layers")).CreateMenuItem());
            main_menu.Append(new Gtk.Action("adjustments", Catalog.GetString("_Adjustments")).CreateMenuItem());
            main_menu.Append(new Gtk.Action("effects", Catalog.GetString("Effe_cts")).CreateMenuItem());
            main_menu.Append(new Gtk.Action("addins", Catalog.GetString("A_dd-ins")).CreateMenuItem());

            MenuItem window_menu = (MenuItem) new Gtk.Action("window", Catalog.GetString("_Window")).CreateMenuItem();

            window_menu.Submenu = new Menu();
            main_menu.Append(window_menu);

            Gtk.Action pads = new Gtk.Action("pads", Mono.Unix.Catalog.GetString("Tool Windows"), null, null);
            view_menu.Submenu = new Menu();
            show_pad          = (Menu)((Menu)(view_menu.Submenu)).AppendItem(pads.CreateSubMenuItem()).Submenu;

            main_menu.Append(new Gtk.Action("help", Catalog.GetString("_Help")).CreateMenuItem());

            PintaCore.Actions.CreateMainMenu(main_menu);

            if (PintaCore.System.OperatingSystem == OS.Mac)
            {
                try {
                    //enable the global key handler for keyboard shortcuts
                    IgeMacMenu.GlobalKeyHandlerEnabled = true;

                    //Tell the IGE library to use your GTK menu as the Mac main menu
                    IgeMacMenu.MenuBar = main_menu;

                    //tell IGE which menu item should be used for the app menu's quit item
                    IgeMacMenu.QuitMenuItem = (MenuItem)PintaCore.Actions.File.Exit.CreateMenuItem();

                    //add a new group to the app menu, and add some items to it
                    var      appGroup  = IgeMacMenu.AddAppMenuGroup();
                    MenuItem aboutItem = (MenuItem)PintaCore.Actions.Help.About.CreateMenuItem();
                    appGroup.AddMenuItem(aboutItem, Catalog.GetString("About"));

                    main_menu.Hide();
                } catch {
                    // If things don't work out, just use a normal menu.
                }
            }

            PintaCore.Chrome.InitializeMainMenu(main_menu);
        }