当前位置: 首页>>代码示例>>C#>>正文


C# Action.CreateSubMenuItem方法代码示例

本文整理汇总了C#中Gtk.Action.CreateSubMenuItem方法的典型用法代码示例。如果您正苦于以下问题:C# Action.CreateSubMenuItem方法的具体用法?C# Action.CreateSubMenuItem怎么用?C# Action.CreateSubMenuItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk.Action的用法示例。


在下文中一共展示了Action.CreateSubMenuItem方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddEffect

        public void AddEffect(string category, Gtk.Action action)
        {
            if (!Menus.ContainsKey (category)) {
                Gtk.Action menu_action = new Gtk.Action (category, Mono.Unix.Catalog.GetString (category), null, null);
                Menu category_menu = (Menu)effects_menu.AppendItem (menu_action.CreateSubMenuItem ()).Submenu;

                Menus.Add (category, category_menu);
            }

            Menu m = Menus[category];

            m.Append (action.CreateMenuItem ());
        }
开发者ID:joehillen,项目名称:Pinta,代码行数:13,代码来源:EffectsActions.cs

示例2: CreateMainMenu

        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);
        }
开发者ID:JoeyScarr,项目名称:Pinta,代码行数:52,代码来源:MainWindow.cs

示例3: CreateMainMenu

        private void CreateMainMenu(VBox shell)
        {
            // Main menu
            main_menu = new MenuBar () {
                Name = "main_menu"
            };

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

            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 ());

            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 ("Show Pad"), 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);
            shell.PackStart (main_menu, false, false, 0);
        }
开发者ID:linuxmhall,项目名称:Pinta,代码行数:31,代码来源:MainWindow.cs

示例4: CreateMainMenu

        public void CreateMainMenu(Gtk.Menu menu)
        {
            menu.Append (Undo.CreateAcceleratedMenuItem (Gdk.Key.Z, Gdk.ModifierType.ControlMask));

            ImageMenuItem redo = Redo.CreateAcceleratedMenuItem (Gdk.Key.Z, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask);
            redo.AddAccelerator ("activate", PintaCore.Actions.AccelGroup, new AccelKey (Gdk.Key.Y, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            menu.Append (redo);

            menu.AppendSeparator ();
            menu.Append (Cut.CreateAcceleratedMenuItem (Gdk.Key.X, Gdk.ModifierType.ControlMask));
            menu.Append (Copy.CreateAcceleratedMenuItem (Gdk.Key.C, Gdk.ModifierType.ControlMask));
            menu.Append (Paste.CreateAcceleratedMenuItem (Gdk.Key.V, Gdk.ModifierType.ControlMask));
            menu.Append (PasteIntoNewLayer.CreateAcceleratedMenuItem (Gdk.Key.V, Gdk.ModifierType.ShiftMask | Gdk.ModifierType.ControlMask));
            menu.Append (PasteIntoNewImage.CreateAcceleratedMenuItem (Gdk.Key.V, Gdk.ModifierType.Mod1Mask | Gdk.ModifierType.ControlMask));

            menu.AppendSeparator ();
            menu.Append (SelectAll.CreateAcceleratedMenuItem (Gdk.Key.A, Gdk.ModifierType.ControlMask));

            ImageMenuItem deslect = Deselect.CreateAcceleratedMenuItem (Gdk.Key.A, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask);
            deslect.AddAccelerator ("activate", PintaCore.Actions.AccelGroup, new AccelKey (Gdk.Key.D, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            menu.Append (deslect);

            menu.AppendSeparator ();
            menu.Append (EraseSelection.CreateAcceleratedMenuItem (Gdk.Key.Delete, Gdk.ModifierType.None));
            menu.Append (FillSelection.CreateAcceleratedMenuItem (Gdk.Key.BackSpace, Gdk.ModifierType.None));
            //menu.Append (InvertSelection.CreateAcceleratedMenuItem (Gdk.Key.I, Gdk.ModifierType.ControlMask));

            menu.AppendSeparator ();
            Gtk.Action menu_action = new Gtk.Action ("Palette", Mono.Unix.Catalog.GetString ("Palette"), null, null);
            Menu palette_menu = (Menu) menu.AppendItem (menu_action.CreateSubMenuItem ()).Submenu;
            palette_menu.Append (LoadPalette.CreateMenuItem ());
            palette_menu.Append (SavePalette.CreateMenuItem ());
            palette_menu.Append (ResetPalette.CreateMenuItem ());
            palette_menu.Append (ResizePalette.CreateMenuItem ());
        }
开发者ID:rolandixor,项目名称:Pinta,代码行数:35,代码来源:EditActions.cs

示例5: CreateMainMenu

        public void CreateMainMenu(Gtk.Menu menu)
        {
            MenuItem show_pad = (MenuItem)menu.Children[0];
            menu.Remove (show_pad);

            menu.Append (ToolBar.CreateMenuItem ());
            menu.Append (PixelGrid.CreateMenuItem ());
            menu.Append (Rulers.CreateMenuItem ());
            menu.AppendSeparator ();

            ImageMenuItem zoomin = ZoomIn.CreateAcceleratedMenuItem (Gdk.Key.plus, Gdk.ModifierType.ControlMask);
            zoomin.AddAccelerator ("activate", PintaCore.Actions.AccelGroup, new AccelKey (Gdk.Key.equal, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            zoomin.AddAccelerator ("activate", PintaCore.Actions.AccelGroup, new AccelKey (Gdk.Key.KP_Add, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            menu.Append (zoomin);

            ImageMenuItem zoomout = ZoomOut.CreateAcceleratedMenuItem (Gdk.Key.minus, Gdk.ModifierType.ControlMask);
            zoomout.AddAccelerator ("activate", PintaCore.Actions.AccelGroup, new AccelKey (Gdk.Key.underscore, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            zoomout.AddAccelerator ("activate", PintaCore.Actions.AccelGroup, new AccelKey (Gdk.Key.KP_Subtract, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            menu.Append (zoomout);

            ImageMenuItem actualsize = ActualSize.CreateAcceleratedMenuItem (Gdk.Key.Key_0, Gdk.ModifierType.ControlMask);
            actualsize.AddAccelerator ("activate", PintaCore.Actions.AccelGroup, new AccelKey (Gdk.Key.A, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask, AccelFlags.Visible));
            menu.Append (actualsize);
            menu.Append (ZoomToWindow.CreateAcceleratedMenuItem (Gdk.Key.B, Gdk.ModifierType.ControlMask));
            //menu.Append (ZoomToSelection.CreateAcceleratedMenuItem (Gdk.Key.B, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask));
            menu.Append (Fullscreen.CreateAcceleratedMenuItem (Gdk.Key.F11, Gdk.ModifierType.None));

            menu.AppendSeparator ();

            Gtk.Action unit_action = new Gtk.Action ("RulerUnits", Mono.Unix.Catalog.GetString ("Ruler Units"), null, null);
            Menu unit_menu = (Menu)menu.AppendItem (unit_action.CreateSubMenuItem ()).Submenu;
            unit_menu.Append (Pixels.CreateMenuItem ());
            unit_menu.Append (Inches.CreateMenuItem ());
            unit_menu.Append (Centimeters.CreateMenuItem ());

            menu.AppendSeparator ();
            menu.Append (show_pad);
        }
开发者ID:manish,项目名称:Pinta,代码行数:38,代码来源:ViewActions.cs


注:本文中的Gtk.Action.CreateSubMenuItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。