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


C# Action.CreateMenuItem方法代码示例

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


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

示例1: RegisterAdjustment

		/// <summary>
		/// Register a new adjustment with Pinta, causing it to be added to the Adjustments menu.
		/// </summary>
		/// <param name="adjustment">The adjustment to register</param>
		/// <returns>The action created for this adjustment</returns>
		public Gtk.Action RegisterAdjustment (BaseEffect adjustment)
		{
			// Add icon to IconFactory
			Gtk.IconFactory fact = new Gtk.IconFactory ();
			fact.Add (adjustment.Icon, new Gtk.IconSet (PintaCore.Resources.GetIcon (adjustment.Icon)));
			fact.AddDefault ();

			// Create a gtk action for each adjustment
			Gtk.Action act = new Gtk.Action (adjustment.GetType ().Name, adjustment.Name + (adjustment.IsConfigurable ? Catalog.GetString ("...") : ""), string.Empty, adjustment.Icon);
			act.Activated += delegate (object sender, EventArgs e) { PintaCore.LivePreview.Start (adjustment); };
			
			PintaCore.Actions.Adjustments.Actions.Add (act);

			// Create a menu item for each adjustment
			MenuItem menu_item;
			
			// If no key is specified, don't use an accelerated menu item
			if (adjustment.AdjustmentMenuKey == (Gdk.Key)0)
				menu_item = (MenuItem)act.CreateMenuItem ();
			else
				menu_item = act.CreateAcceleratedMenuItem (adjustment.AdjustmentMenuKey, adjustment.AdjustmentMenuKeyModifiers);

			((Menu)((ImageMenuItem)PintaCore.Chrome.MainMenu.Children[5]).Submenu).AppendMenuItemSorted (menu_item);

			adjustments.Add (adjustment, act);
			adjustment_menuitems.Add (adjustment, menu_item);

			return act;
		}
开发者ID:msiyer,项目名称:Pinta,代码行数:34,代码来源:EffectsManager.cs

示例2: BuildAddToMenu

 public Menu BuildAddToMenu(System.EventHandler handler)
 {
     Menu bookmarkMenu = new Menu();
     string[] bookmarks = m_App.CacheStore.GetBookmarkLists();
     foreach(string bookmark in bookmarks)
     {
         Action action = new Action(bookmark, bookmark);
         action.Activated += handler;
         bookmarkMenu.Append(action.CreateMenuItem());
     }
     return bookmarkMenu;
 }
开发者ID:cbuehler,项目名称:opencachemanager,代码行数:12,代码来源:BookmarkManager.cs

示例3: BuildLocationlMenu

        public Menu BuildLocationlMenu()
        {
            Menu etMenu = new Menu();

            Gtk.Action home_action = new Gtk.Action("Home", Catalog.GetString("Home"));
            etMenu.Append(home_action.CreateMenuItem());
            home_action.Activated += HandleHome_actionActivated;
            int iCount = 0;
            foreach (Location loc in m_locations.Values)
            {
                Gtk.Action action = new Gtk.Action(loc.Name, loc.Name);
                etMenu.Append(action.CreateMenuItem());
                action.Activated += HandleActionActivated;
                iCount ++;

            }
            etMenu.Append(new MenuItem());
            gpsdAction = new ToggleAction("UseGPSD", Catalog.GetString("GPSD Position"),null, null);
            //gpsdAction.Active = UIMonitor.getInstance().Configuration.UseGPSD;
            gpsdAction.Toggled += HandleGpsdActionToggled;
            etMenu.Append(gpsdAction.CreateMenuItem());
            etMenu.ShowAll();
            return etMenu;
        }
开发者ID:cbuehler,项目名称:opencachemanager,代码行数:24,代码来源:LocationList.cs

示例4: AppendAction

 public static Gtk.Action AppendAction(this Menu menu, string actionName, string actionLabel, string actionTooltip, string actionIcon)
 {
     Gtk.Action action = new Gtk.Action (actionName, actionLabel, actionTooltip, actionIcon);
     menu.AppendItem ((MenuItem)action.CreateMenuItem ());
     return action;
 }
开发者ID:pzsysa,项目名称:gtk-sharp-forms,代码行数:6,代码来源:GtkExtensions.cs

示例5: BuildProfileTransferMenu

 public Menu BuildProfileTransferMenu()
 {
     Menu etMenu = new Menu();
     foreach (GPSProfile loc in m_profiles.Values)
     {
         Gtk.Action action = new Gtk.Action(loc.Name, loc.Name);
         etMenu.Append(action.CreateMenuItem());
         action.Activated += HandleTransferActionActivated;
     }
     etMenu.ShowAll();
     return etMenu;
 }
开发者ID:TweetyHH,项目名称:Open-Cache-Manager,代码行数:12,代码来源:GPSProfileList.cs

示例6: BuildProfileReceiveMenu

 public Menu BuildProfileReceiveMenu()
 {
     Menu etMenu = new Menu();
     foreach (GPSProfile loc in m_profiles.Values)
     {
         if (String.IsNullOrEmpty(loc.FieldNotesFile))
             continue;
         Gtk.Action action = new Gtk.Action(loc.Name, loc.Name);
         etMenu.Append(action.CreateMenuItem());
         action.Activated += HandleReceiveActionActivated;
     }
     return etMenu;
 }
开发者ID:TweetyHH,项目名称:Open-Cache-Manager,代码行数:13,代码来源:GPSProfileList.cs

示例7: BuildProfileEditMenu

        public Menu BuildProfileEditMenu()
        {
            Menu etMenu = new Menu();
            int iCount = 0;
            foreach (GPSProfile loc in m_profiles.Values)
            {
                Gtk.Action action = new Gtk.Action(loc.Name, loc.Name);
                etMenu.Append(action.CreateMenuItem());
                action.Activated += HandleActionActivated;
                iCount ++;

            }
            return etMenu;
        }
开发者ID:TweetyHH,项目名称:Open-Cache-Manager,代码行数:14,代码来源:GPSProfileList.cs

示例8: BuildEToolMenu

        public Menu BuildEToolMenu()
        {
            Menu etMenu = new Menu();
            int iCount = 0;
            foreach (ExternalTool tool in m_tools.Values)
            {
                Gtk.Action action = new Gtk.Action(tool.Name, tool.Name);
                etMenu.Append(action.CreateMenuItem());
                action.Activated += HandleActionActivated;
                iCount ++;

            }
            return etMenu;
        }
开发者ID:cbuehler,项目名称:opencachemanager,代码行数:14,代码来源:EToolList.cs

示例9: CreatePopup

        private void CreatePopup(Gtk.ButtonPressEventArgs args)
        {
            Menu popup = new Menu ();
            MenuItem setCenterItem = new MenuItem (Catalog.GetString("_Set As Map Centre"));
            MenuItem showOnline = new MenuItem (Catalog.GetString("_View Cache Online"));
            MenuItem mark = new MenuItem(Catalog.GetString("_Mark"));
            Menu markSub = new Menu();
            MenuItem markFound = new MenuItem(Catalog.GetString("Mark _Found"));
            MenuItem markFTF = new MenuItem(Catalog.GetString("Mark First To Find"));
            MenuItem markDNF = new MenuItem(Catalog.GetString("Mark Did Not Find"));
            MenuItem markUnfound = new MenuItem(Catalog.GetString("Mark _Unfound"));
            MenuItem markDisabled = new MenuItem(Catalog.GetString("Mark _Disabled"));
            MenuItem markArchived = new MenuItem(Catalog.GetString("Mark _Archived"));
            MenuItem markAvailable = new MenuItem(Catalog.GetString("Mark A_vailable"));
            MenuItem correctCoordinates = new MenuItem(Catalog.GetString("_Corrected Coordinates..."));
            MenuItem addWaypoint = new MenuItem(Catalog.GetString("Add Child _Waypoint..."));
            MenuItem deleteItem = new MenuItem (Catalog.GetString("Delete..."));
            MenuItem bookmark = new MenuItem(Catalog.GetString("_Add to Bookmark List"));
            MenuItem rmvCache = new MenuItem(Catalog.GetString("_Remove From Bookmark List"));
            MenuItem qlandkarte = new MenuItem(Catalog.GetString("View in _QLandkarte GT..."));
            MenuItem logCache = new MenuItem(Catalog.GetString("_Log Find"));
            MenuItem externalTools = new MenuItem(Catalog.GetString("_External Tools"));

            EToolList eTools = m_monitor.ExternalTools;
            Menu eToolMenu = new Menu();
            foreach(ExternalTool tool in eTools.ToolArray)
            {
                if (tool.Command.Contains("%selected%"))
                {
                    Gtk.Action eCmd = new Gtk.Action(tool.Name, tool.Name);
                    eCmd.Activated += HandleECmdActivated;
                    eToolMenu.Add(eCmd.CreateMenuItem());
                }
            }
            externalTools.Submenu = eToolMenu;

            TreePath path;
            TreeIter itr;
            treeview1.GetPathAtPos((int) args.Event.X,(int) args.Event.Y, out path);
            treeview1.Model.GetIter(out itr, path);
            Geocache cache = (Geocache)treeview1.Model.GetValue (itr, 0);

            if (cache != null)
            {
                logCache.Sensitive = true;
                if (!cache.Available)
                {
                    markAvailable.Sensitive = true;
                    markDisabled.Sensitive = false;
                }
                else
                {
                    markAvailable.Sensitive = false;
                    markDisabled.Sensitive = true;
                }

                if (!cache.Archived)
                    markArchived.Sensitive = true;
                else
                    markArchived.Sensitive = false;

                if (cache.Symbol.Contains("Found"))
                {
                    if (cache.FTF)
                    {
                        markFTF.Sensitive = false;
                        markFound.Sensitive = true;
                    }
                    else
                    {
                        markFTF.Sensitive = true;
                        markFound.Sensitive = false;
                    }
                    markUnfound.Sensitive = true;
                    markDNF.Sensitive = true;

                }
                else
                {
                    markFound.Sensitive = true;
                    markFTF.Sensitive = true;
                    if (cache.DNF)
                    {
                        markDNF.Sensitive = false;
                        markUnfound.Sensitive = true;
                    }
                    else
                    {
                        markDNF.Sensitive = true;
                        markUnfound.Sensitive = false;
                    }
                }
            }
            else
            {
                logCache.Sensitive = false;
            }

            CacheStore store = Engine.getInstance().Store;
            List<string> bookmarklists = store.GetBookmarkLists();
//.........这里部分代码省略.........
开发者ID:TweetyHH,项目名称:Open-Cache-Manager,代码行数:101,代码来源:CacheList.cs

示例10: CreateMenu

        // Creates the menu that is popped up when the
        // user clicks the statusicon
        public void CreateMenu()
        {
            Menu = new Menu ();

                    // The menu item showing the status and size of the SparkleShare folder
                    StatusMenuItem = new MenuItem (StateText) {
                        Sensitive = false
                    };

                Menu.Add (StatusMenuItem);
                Menu.Add (new SeparatorMenuItem ());

                    // A menu item that provides a link to the SparkleShare folder
                    Gtk.Action folder_action = new Gtk.Action ("", "SparkleShare") {
                        IconName    = "folder-sparkleshare",
                        IsImportant = true
                    };

                    folder_action.Activated += delegate {

                        Process process = new Process ();
                        process.StartInfo.FileName = "xdg-open";
                        process.StartInfo.Arguments = SparklePaths.SparklePath;
                        process.Start ();

                    };

                Menu.Add (folder_action.CreateMenuItem ());

                if (SparkleUI.Repositories.Count > 0) {

                    // Creates a menu item for each repository with a link to their logs
                    foreach (SparkleRepo repo in SparkleUI.Repositories) {

                        folder_action = new Gtk.Action ("", repo.Name) {
                            IconName    = "folder",
                            IsImportant = true
                        };

                        folder_action.Activated += OpenLogDelegate (repo.LocalPath);

                        MenuItem menu_item = (MenuItem) folder_action.CreateMenuItem ();

                        if (repo.Description != null)
                            menu_item.TooltipText = repo.Description;

                        Menu.Add (menu_item);

                    }

                } else {

                    MenuItem no_folders_item = new MenuItem (_("No Shared Folders Yet")) {
                        Sensitive   = false
                    };

                    Menu.Add (no_folders_item);

                }

                // Opens the wizard to add a new remote folder
                MenuItem add_item = new MenuItem (_("Sync Remote Folder…"));

                    add_item.Activated += delegate {

                        SparkleIntro intro = new SparkleIntro ();

                        // Only show the server form in the wizard
                        intro.ShowServerForm (true);

                    };

                Menu.Add (add_item);
                Menu.Add (new SeparatorMenuItem ());

                // A checkbutton to toggle whether or not to show notifications
                CheckMenuItem notify_item =	new CheckMenuItem (_("Show Notifications"));

                    // Whether notifications are shown depends existence of this file
                    string notify_setting_file_path = SparkleHelpers.CombineMore (SparklePaths.SparkleConfigPath,
                        "sparkleshare.notify");

                    if (File.Exists (notify_setting_file_path))
                        notify_item.Active = true;

                    notify_item.Toggled += delegate {

                        if (File.Exists (notify_setting_file_path))
                            File.Delete (notify_setting_file_path);
                        else
                            File.Create (notify_setting_file_path);

                    };

                Menu.Add (notify_item);
                Menu.Add (new SeparatorMenuItem ());

                // A menu item that takes the use to sparkleshare.org
//.........这里部分代码省略.........
开发者ID:Sascha833,项目名称:TestProjekt,代码行数:101,代码来源:SparkleStatusIcon.cs

示例11: UploadExtension

 public UploadExtension()
 {
     menu_action = new Gtk.Action ("uploadaddin", "Upload", "Lets you upload images to the internet", Stock.Network);
     menu_action.Activated += delegate (object sender, EventArgs e) {showUploadDialog (); };
     menu_item = menu_action.CreateMenuItem ();
 }
开发者ID:PintaProject,项目名称:PintaUploadAddin,代码行数:6,代码来源:UploadExtension.cs

示例12: BuildMenuItem

 void BuildMenuItem(QuickFilter filter, Menu qfMenu)
 {
     Gtk.Action action = new Gtk.Action(filter.Name, filter.Name);
     qfMenu.Append(action.CreateMenuItem());
     action.Activated += HandleActionActivated;
 }
开发者ID:cbuehler,项目名称:opencachemanager,代码行数:6,代码来源:QuickFilters.cs

示例13: CreateMenu

        // Creates the menu that is popped up when the
        // user clicks the status icon
        public void CreateMenu()
        {
            Menu = new Menu ();

                // The menu item showing the status and size of the SparkleShare folder
                MenuItem status_menu_item = new MenuItem (StateText) {
                    Sensitive = false
                };

                // A menu item that provides a link to the SparkleShare folder
                Gtk.Action folder_action = new Gtk.Action ("", "SparkleShare") {
                    IconName    = "folder-sparkleshare",
                    IsImportant = true
                };

                folder_action.Activated += delegate {
                    SparkleShare.Controller.OpenSparkleShareFolder ();
                };

            Menu.Add (status_menu_item);
            Menu.Add (new SeparatorMenuItem ());
            Menu.Add (folder_action.CreateMenuItem ());

                if (SparkleShare.Controller.Folders.Count > 0) {

                    // Creates a menu item for each repository with a link to their logs
                    foreach (string path in SparkleShare.Controller.Folders) {

                        folder_action = new Gtk.Action ("", Path.GetFileName (path)) {
                            IconName    = "folder",
                            IsImportant = true
                        };

            //						if (repo.HasUnsyncedChanges)
            //							folder_action.IconName = "dialog-error";

                        folder_action.Activated += OpenEventLogDelegate (path);

                        MenuItem menu_item = (MenuItem) folder_action.CreateMenuItem ();

                        Menu.Add (menu_item);

                    }

                } else {

                    MenuItem no_folders_item = new MenuItem (_("No Remote Folders Yet")) {
                        Sensitive   = false
                    };

                    Menu.Add (no_folders_item);

                }

                // Opens the wizard to add a new remote folder
                MenuItem sync_item = new MenuItem (_("Sync Remote Folder…"));

                if (SparkleShare.Controller.FirstRun)
                    sync_item.Sensitive = false;

                sync_item.Activated += delegate {
                    Application.Invoke (delegate {

                        SparkleIntro intro = new SparkleIntro ();
                        intro.ShowServerForm (true);

                    });
                };

            Menu.Add (sync_item);
            Menu.Add (new SeparatorMenuItem ());

                // A checkbutton to toggle whether or not to show notifications
                CheckMenuItem notify_item =	new CheckMenuItem (_("Show Notifications"));

                if (SparkleShare.Controller.NotificationsEnabled)
                    notify_item.Active = true;

                notify_item.Toggled += delegate {
                    SparkleShare.Controller.ToggleNotifications ();
                };

            Menu.Add (notify_item);
            Menu.Add (new SeparatorMenuItem ());

                // A menu item that takes the user to http://www.sparkleshare.org/
                MenuItem about_item = new MenuItem (_("About"));

                about_item.Activated += delegate {

                    SparkleDialog dialog = new SparkleDialog ();
                    dialog.ShowAll ();

                };

            Menu.Add (about_item);
            Menu.Add (new SeparatorMenuItem ());

//.........这里部分代码省略.........
开发者ID:kristi,项目名称:SparkleShare,代码行数:101,代码来源:SparkleStatusIcon.cs

示例14: InitActions

        private void InitActions()
        {
            // show about
            AboutAction.Activated += (sender, e) =>
                new AboutWindow(this, About.Authors, About.Lines, About.Size).Show();

            // show supported extensions
            SupportedFormatsAction.Activated += (sender, e) =>
                new SupportedFormatsWindow(this).Show();

            // create new pack
            MenuItem newMenuItem = this.UIManager.GetWidget(@"/mainMenuBar/FileAction/NewAction") as MenuItem;
            Menu newSubMenu = new Menu();
            newMenuItem.Submenu = newSubMenu;

            Packer.SupportedExtensions.ToList().ForEach(ext =>
            {
                Gtk.Action action = new Gtk.Action(String.Format("New{0}Action", ext), ext);
                action.Activated+= (sender, e) =>
                {
                    if (fileSystem != null)
                        fileSystem.Close();
                    fileSystem = null;

                    if (Packer.Create(ext, out fileSystem))
                    {
                        fileSystem.New();
                        ChangePackActionSensitive(true);
                    }
                };
                MenuItem menuItem = action.CreateMenuItem() as MenuItem;
                menuItem.AddAccelerator(
                    "activate",
                    this.UIManager.AccelGroup,
                    new AccelKey((Gdk.Key) Gdk.Key.Parse(typeof(Gdk.Key), ext[0].ToString().ToLower()),
                             Gdk.ModifierType.ControlMask, AccelFlags.Visible));

                newSubMenu.Append(menuItem);
            });

            // open pack action
            OpenAction.Activated += (sender, e) => HandleOpenAction();

            // save current pack
            SaveAction.Activated += (sender, e) => HandleSaveAction();

            // close pack and exit
            CloseAction.Activated += (sender, e) =>
            {
                if (fileSystem != null)
                    fileSystem.Close();
                fileSystem = null;
                ChangePackActionSensitive(false);
                currentFolder = TreeIter.Zero;
                folderStore.Clear();
                packStore.Clear();
            };

            // exit app
            ExitAction.Activated += (sender, e) => Program.Stop();

            // add files to current pack
            AddFilesAction.Activated += (sender, e) => HandleAddFilesAction();

            // add folder to current pack
            AddFolderAction.Activated += (sender, e) => HandleAddFolderAction();

            // remove items from current pack
            RemoveAction.Activated += (sender, e) => HandleRemoveAction();

            // extract items from current pack
            ExtractAction.Activated += (sender, e) => HandleExtractAction();

            // extract all items from current pack
            ExtractAllAction.Activated += (sender, e) => HandleExtractAllAction();
        }
开发者ID:whztt07,项目名称:DGLE,代码行数:76,代码来源:MainWindow.cs

示例15: BuildQuickFilterMenu

        public Menu BuildQuickFilterMenu()
        {
            Menu qfMenu = new Menu();
            int iCount = 0;
            foreach (QuickFilter filter in m_filters.Values)
            {
                Gtk.Action action = new Gtk.Action(filter.Name, filter.Name);
                qfMenu.Append(action.CreateMenuItem());
                action.Activated += HandleActionActivated;
                iCount ++;

            }
            return qfMenu;
        }
开发者ID:TweetyHH,项目名称:Open-Cache-Manager,代码行数:14,代码来源:QuickFilters.cs


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