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


C# Menu.Add方法代码示例

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


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

示例1: EquipmentReceptionView

        public EquipmentReceptionView()
        {
            this.Build();

            ytreeEquipment.ColumnsConfig = Gamma.GtkWidgets.ColumnsConfigFactory.Create<ReceptionEquipmentItemNode> ()
                .AddColumn ("Номенклатура").AddTextRenderer (node => node.Name)
                .AddColumn ("Серийный номер").AddTextRenderer (node => node.Serial)
                .AddColumn ("Кол-во")
                .AddToggleRenderer (node => node.Returned, false)
                .AddNumericRenderer (node => node.Amount, false)
                .AddColumn("Номер заявки на сервис")
                .AddTextRenderer(
                    node => node.ServiceClaim != null
                    ? node.ServiceClaim.Id.ToString()
                    : "")
                .AddColumn("")
                .Finish ();

            ytreeEquipment.Selection.Changed += YtreeEquipment_Selection_Changed;
            ytreeEquipment.ItemsDataSource = ReceptionEquipmentList;

            //Создаем меню в кнопке выбора СН
            var menu = new Menu();
            menuitemRegisterSerial = new MenuItem("Зарегистрировать новый СН");
            menuitemRegisterSerial.Activated += MenuitemRegisterSerial_Activated;
            menu.Add(menuitemRegisterSerial);
            menuitemSelectFromClient = new MenuItem("Выбрать по клиенту");
            menuitemSelectFromClient.Activated += MenuitemSelectFromClient_Activated;
            menu.Add(menuitemSelectFromClient);
            var menuitemSelectFromUnused = new MenuItem("Незадействованные СН");
            menuitemSelectFromUnused.Activated += MenuitemSelectFromUnused_Activated;
            menu.Add(menuitemSelectFromUnused);
            menu.ShowAll();
            buttonSelectSerial.Menu = menu;
        }
开发者ID:QualitySolution,项目名称:Vodovoz,代码行数:35,代码来源:EquipmentReceptionView.cs

示例2: VideoContextMenu

        // create the context menu
        public VideoContextMenu()
            : base()
        {
            MenuItem aspect_ratio = new MenuItem ("Aspect Ratio");
            ImageMenuItem fullscreen = new ImageMenuItem (Stock.Fullscreen, null);

            Menu aspect_menu = new Menu ();
            aspect_auto = new RadioMenuItem ("Auto");
            aspect_4x3 = new RadioMenuItem (aspect_auto, "4:3");
            aspect_16x9 = new RadioMenuItem (aspect_auto, "16:9");
            aspect_16x10 = new RadioMenuItem (aspect_auto, "16:10");

            aspect_menu.Add (aspect_auto);
            aspect_menu.Add (aspect_4x3);
            aspect_menu.Add (aspect_16x9);
            aspect_menu.Add (aspect_16x10);

            aspect_ratio.Submenu = aspect_menu;

            this.Add (aspect_ratio);

            showVisualisations ();

            this.Add (new SeparatorMenuItem ());
            this.Add (fullscreen);

            fullscreen.Activated += fullscreen_activated;

            aspect_auto.ButtonReleaseEvent += aspect_auto_toggled;
            aspect_4x3.ButtonReleaseEvent += aspect_4x3_toggled;
            aspect_16x9.ButtonReleaseEvent += aspect_16x9_toggled;
            aspect_16x10.ButtonReleaseEvent += aspect_16x10_toggled;

            toggle_aspect_value ();
        }
开发者ID:gsterjov,项目名称:fusemc,代码行数:36,代码来源:VideoContextMenu.cs

示例3: MainWindow

        public MainWindow()
        {
            Build ();

            popupMenu = new Menu ();

            ImageMenuItem explore = new ImageMenuItem ("Explore");
            explore.Image = new Image (Stock.Open, IconSize.Menu);
            explore.Activated += Open;
            popupMenu.Add (explore);

            ImageMenuItem quit = new ImageMenuItem ("Exit");
            quit.Image = new Image (Stock.Quit, IconSize.Menu);
            quit.Activated += (object sender, EventArgs e) => {
                Application.Quit ();
            };
            popupMenu.Add (quit);

            statusIcon = new StatusIcon ();
            statusIcon.Pixbuf = c.Icon.Bitmap.ToPixbuf ();
            statusIcon.Activate += Open;
            statusIcon.PopupMenu += (object o, PopupMenuArgs args) => {
                popupMenu.ShowAll ();
                popupMenu.Popup ();
            };
            statusIcon.Tooltip = c.Icon.Tooltip;
            statusIcon.Visible = true;
        }
开发者ID:TimePath,项目名称:major,代码行数:28,代码来源:MainWindow.cs

示例4: Initalize

        public void Initalize(MainWindow window, MenuItem treerebuild, PropertiesView propertiesView)
        {
            this.window = window;
            this.propertiesView = propertiesView;

            menu = new Menu ();

            treenewitem = new MenuItem ("New Item...");
            treenewitem.Activated += window.OnNewItemActionActivated;
            menu.Add (treenewitem);

            treeadditem = new MenuItem ("Add Item...");
            treeadditem.Activated += window.OnAddItemActionActivated;
            menu.Add (treeadditem);

            treedelete = new MenuItem ("Delete");
            treedelete.Activated += window.OnDeleteActionActivated;
            menu.Add (treedelete);

            seperator = new SeparatorMenuItem ();
            menu.Add (seperator);

            treeopenfile = new MenuItem ("Open File");
            treeopenfile.Activated += delegate {
                List<TreeIter> iters;
                List<Gdk.Pixbuf> icons;
                GetSelectedTreePath(out iters, out icons);

                if(icons[0] != ICON_BASE)
                    Process.Start(window._controller.GetFullPath(GetPathFromIter(iters[0])));
                else
                    Process.Start(openedProject);
            };
            menu.Add (treeopenfile);

            treeopenfilelocation = new MenuItem ("Open File Location");
            treeopenfilelocation.Activated += delegate {
                List<TreeIter> iters;
                List<Gdk.Pixbuf> icons;
                GetSelectedTreePath(out iters, out icons);

                if(icons[0] != ICON_BASE)
                    Process.Start(System.IO.Path.GetDirectoryName(window._controller.GetFullPath(GetPathFromIter(iters[0]))));
                else
                    Process.Start(System.IO.Path.GetDirectoryName(window._controller.GetFullPath("")));
            };
            menu.Add (treeopenfilelocation);

            seperator2 = new SeparatorMenuItem ();
            menu.Add (seperator2);

            menu.Add (treerebuild);
        }
开发者ID:BrainSlugs83,项目名称:MonoGame,代码行数:53,代码来源:ProjectView.cs

示例5: CreateDirectoryMenu

        private void CreateDirectoryMenu(string directoryPath, string mediaType)
        {
            Menu cmMediaDirectory 			= new Menu();
            cmMediaDirectory.WidthRequest 	= 150;

            cmMediaDirectory.Add(_parent.oMenuItems.PlayDirectory(directoryPath, mediaType));
            cmMediaDirectory.Add(_parent.oMenuItems.EnqueDirectory(directoryPath, mediaType));
            cmMediaDirectory.Add(_parent.oMenuItems.Seperator());
            cmMediaDirectory.Add(_parent.oMenuItems.CollapseAll());

            cmMediaDirectory.ShowAll();
            cmMediaDirectory.Popup();
        }
开发者ID:Bram77,项目名称:xbmcontrol-evo,代码行数:13,代码来源:ContextMenu.cs

示例6: PlayerMenu

 public PlayerMenu()
 {
     playerMenu = new Menu ();
     addToPlaylistMenu = new MenuItem ("");
     playerMenu.Add (addToPlaylistMenu);
     exportToVideoFile = new MenuItem ("");
     exportToVideoFile.Add (exportToVideoFile);
 }
开发者ID:LongoMatch,项目名称:longomatch,代码行数:8,代码来源:PlayerMenu.cs

示例7: GetPopupMenu

 public static Gtk.Menu GetPopupMenu(Order[] selected)
 {
     Menu popupMenu = new Gtk.Menu();
     MenuItemId<Order[]> menuItemYandex = new MenuItemId<Order[]>("Открыть на Yandex картах(координаты)");
     menuItemYandex.Activated += MenuItemYandex_Activated;
     menuItemYandex.ID = selected;
     popupMenu.Add(menuItemYandex);
     MenuItemId<Order[]> menuItemYandexAddress = new MenuItemId<Order[]>("Открыть на Yandex картах(адрес)");
     menuItemYandexAddress.Activated += MenuItemYandexAddress_Activated;
     menuItemYandexAddress.ID = selected;
     popupMenu.Add(menuItemYandexAddress);
     MenuItemId<Order[]> menuItemOSM = new MenuItemId<Order[]>("Открыть на карте OSM");
     menuItemOSM.Activated += MenuItemOSM_Activated;
     menuItemOSM.ID = selected;
     popupMenu.Add(menuItemOSM);
     return popupMenu;
 }
开发者ID:QualitySolution,项目名称:Vodovoz,代码行数:17,代码来源:OrderPopupMenu.cs

示例8: OnTrayIconPopup

        // Create the popup menu, on right click.
        static void OnTrayIconPopup(object o, EventArgs args)
        {
            Menu popupMenu = new Menu();
            ImageMenuItem menuItemQuit = new ImageMenuItem ("Quit");
            Gtk.Image appimg = new Gtk.Image(Stock.Quit, IconSize.Menu);
            menuItemQuit.Image = appimg;

            var machines = machineService.GetAllMachines ()
                .GroupBy (x => x.GroupName);
            foreach (var item in machines) {
                if (item.Key == null)
                    continue;

                MenuItem parentItem = new MenuItem (item.Key);
                Menu subMenu = new Menu ();
                foreach (Machine machine in item) {
            //					ImageMenuItem menuItem = new ImageMenuItem (machine.FileName);
            //					menuItem.Image = new Gtk.Image (Stock.Connect, IconSize.Menu);
                    MenuItem menuItem = new MenuItem (machine.RemoteType + " - " + machine.FileName);
                    menuItem.Activated += (object sender, EventArgs e) => {
                        if (machine.RemoteType == RemoteType.RDP) {
                            machineService.LaunchRDP(machine, settings);
                        } else if (machine.RemoteType == RemoteType.SSH) {
                            machineService.LaunchSSH(machine, settings);
                        } else if (machine.RemoteType == RemoteType.VNC) {
                            machineService.LaunchVNC(machine, settings);
                        }
                    };
                    subMenu.Add (menuItem);
                }
                parentItem.Submenu = subMenu;
                popupMenu.Add (parentItem);
            }

            popupMenu.Add(menuItemQuit);

            menuItemQuit.Activated += delegate { Application.Quit(); };
            popupMenu.ShowAll();
            popupMenu.Popup();
        }
开发者ID:meanbunny,项目名称:remote-access,代码行数:41,代码来源:Program.cs

示例9: CreateMenu

		Menu CreateMenu (bool importantOnly)
		{
			if (TagModel != null) {
				Menu menu = new Menu ();
				
				bool itemsAdded = false;
				
				foreach (StringTagDescription[] tags in TagModel.GetTagsGrouped ()) {
					if (itemsAdded) {
						SeparatorMenuItem sep = new SeparatorMenuItem ();
						menu.Add (sep);
					}
					foreach (StringTagDescription tag in tags) {
						if (tag.Important != importantOnly)
							continue;
						MenuItem item = new MenuItem (tag.Description);
						string tagString = tag.Name;
						item.ButtonPressEvent += delegate {
							InsertTag (tagString);
						};
						menu.Add (item);
						itemsAdded = true;
					}
				}
				if (importantOnly) {
					Menu subMenu = CreateMenu (false);
					if (subMenu.Children.Length > 0) {
						SeparatorMenuItem sep = new SeparatorMenuItem ();
						menu.Add (sep);
						MenuItem item = new MenuItem (GettextCatalog.GetString ("More"));
						item.Submenu = subMenu;
						menu.Add (item);
					}
				}
				menu.ShowAll ();
				return menu;
			}
			return null;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:39,代码来源:StringTagSelectorButton.cs

示例10: OnImageClick

        // handler for mouse click
        private void OnImageClick(object o, ButtonPressEventArgs args)
        {
            if (args.Event.Button == 3) //right click
               		{
                Menu popupMenu = new Menu (); // creates the menu
              		ImageMenuItem menuPopup1 = new ImageMenuItem ("Quit");
              		Image appimg = new Image (Stock.Quit, IconSize.Menu);
              		menuPopup1.Image = appimg; // sets the menu item's image
              		popupMenu.Add (menuPopup1); // adds the menu item to the menu

              		menuPopup1.Activated += new EventHandler (this.OnPopupClick); // event when the user clicks the icon
                popupMenu.ShowAll (); // shows everything
                // pops up the actual menu when the user right clicks
              		popupMenu.Popup (null, null, null, IntPtr.Zero, args.Event.Button, args.Event.Time);
               		}
               		else
               		{
               			Menu mainPopupMenu = new Menu ();

               			ImageMenuItem menuPopupReload = new ImageMenuItem ("Reload");
               			ImageMenuItem menuPopupAbout = new ImageMenuItem ("About");

               			Image reloadimg = new Image (Stock.Refresh, IconSize.Menu);
               			Image aboutimg = new Image (Stock.About, IconSize.Menu);

               			menuPopupReload.Image = reloadimg;
               			menuPopupAbout.Image = aboutimg;

               			mainPopupMenu.Add (menuPopupReload);
               			mainPopupMenu.Add (menuPopupAbout);

               			menuPopupReload.Activated += new EventHandler (this.OnPopupReloadClick);
               			menuPopupAbout.Activated += new EventHandler (this.OnPopupAboutClick);
               			mainPopupMenu.ShowAll ();
               			mainPopupMenu.Popup (null, null, null, IntPtr.Zero, args.Event.Button, args.Event.Time);
               		}
        }
开发者ID:klessou,项目名称:monognomeart,代码行数:38,代码来源:Tray.cs

示例11: MediaContextMenu

        // create the context menu
        public MediaContextMenu(Media media)
            : base()
        {
            this.media = media;

            ImageMenuItem play = new ImageMenuItem (Stock.MediaPlay, null);
            ImageMenuItem edit = new ImageMenuItem (Stock.Edit, null);
            MenuItem lyrics = new MenuItem ("View Lyrics");
            MenuItem info = new MenuItem ("View Artist Info");
            MenuItem add_to_playlist = new MenuItem ("Add To Playlist");

            play.Activated += play_activated;
            edit.Activated += edit_activated;
            lyrics.Activated += lyrics_activated;
            info.Activated += info_activated;

            // the "Add To Playlist" menu
            Menu playlist_menu = new Menu ();
            add_to_playlist.Submenu = playlist_menu;

            foreach (object[] row in Global.Core.Library.PlaylistTree.PlaylistStore)
            {
                Playlist playlist = (Playlist) row[0];
                MenuItem playlist_item = new MenuItem (playlist.Name);
                playlist_menu.Add (playlist_item);

                playlist_item.Activated += delegate (object o, EventArgs args) {
                    Global.Core.Library.MediaTree.MediaStore.AddMedia (media.Path, playlist);
                };

            }

            if (Global.Core.Library.PlaylistTree.PlaylistStore.IterNChildren () == 0)
                add_to_playlist.Sensitive = false;

            this.Add (play);
            this.Add (edit);
            this.Add (lyrics);
            this.Add (info);
            this.Add (new SeparatorMenuItem ());
            this.Add (add_to_playlist);
        }
开发者ID:gsterjov,项目名称:fusemc,代码行数:43,代码来源:MediaContextMenu.cs

示例12: OnTrayIconPopup

        // Create the popup menu, on right click.
        static void OnTrayIconPopup(object o, EventArgs args)
        {
            Menu popupMenu = new Menu();

            ImageMenuItem menuItemQuit = new Gtk.ImageMenuItem("Quit");
            Gtk.Image appimg = new Gtk.Image(Stock.Quit, IconSize.Menu);
            menuItemQuit.Image = appimg;
            popupMenu.Add(menuItemQuit);

            // Quit the application when quit has been clicked.
            menuItemQuit.Activated += delegate
            {
                Application.Quit();
            };

            popupMenu.ShowAll();
            popupMenu.Popup();
            popupMenu.TakeFocus = true;
            popupMenu.Title = "Graal RC";
        }
开发者ID:Guthius,项目名称:gs2emu-googlecode,代码行数:21,代码来源:Program.cs

示例13: CreateFileMenu

        private void CreateFileMenu(string filePath)
        {
            Menu cmMediaFile 			= new Menu();
            cmMediaFile.WidthRequest 	= 150;

            cmMediaFile.Add(_parent.oMenuItems.PlayFile(filePath));
            cmMediaFile.Add(_parent.oMenuItems.EnqueFile(filePath));
            cmMediaFile.Add(_parent.oMenuItems.Seperator());
            cmMediaFile.Add(_parent.oMenuItems.ShowSongInfo("sharebrowser"));
            //cmMediaFile.Add(_parent.oMenuItems.SaveSelectedFile());
            cmMediaFile.Add(_parent.oMenuItems.Seperator());
            cmMediaFile.Add(_parent.oMenuItems.CollapseAll());

            cmMediaFile.ShowAll();
            cmMediaFile.Popup();
        }
开发者ID:Bram77,项目名称:xbmcontrol-evo,代码行数:16,代码来源:ContextMenu.cs

示例14: CreateMediaMenu

        private void CreateMediaMenu(string caller, string identifier)
        {
            Menu cmMedia			= new Menu();
            cmMedia.WidthRequest 	= 200;

            cmMedia.Add(_parent.oMenuItems.Play(caller, identifier));
            cmMedia.Add(_parent.oMenuItems.Enque(caller, identifier));
            cmMedia.Add(_parent.oMenuItems.RefreshShares());

            if (caller != "album")
            {
                cmMedia.Add(_parent.oMenuItems.Seperator());
                cmMedia.Add(_parent.oMenuItems.CollapseAll());
            }

            if (caller == "file")
            {
                cmMedia.Add(_parent.oMenuItems.Seperator());
                cmMedia.Add(_parent.oMenuItems.ShowSongInfo("sharebrowser"));
            }

            cmMedia.ShowAll();
            cmMedia.Popup();
        }
开发者ID:Bram77,项目名称:xbmcontrol-evo,代码行数:24,代码来源:ContextMenu.cs

示例15: header_click

        private void header_click(ButtonPressEventArgs args, Category cat)
        {
            if (args.Event.Button == 3) {
             	Menu popupMenu = new Menu();

                MenuItem create_label = new MenuItem(Mono.Unix.Catalog.GetString("Create a new label"));
                create_label.Activated += delegate { add_new_label(); };
                popupMenu.Add(create_label);

                MenuItem rename_item = new MenuItem(Mono.Unix.Catalog.GetString("Rename category"));
                rename_item.Activated += delegate { rename_category(false); };
                popupMenu.Add(rename_item);

                if (!category.initial) {
                    MenuItem delete_item = new MenuItem(Mono.Unix.Catalog.GetString("Delete category"));
                    delete_item.Activated += delegate { remove_category_callback(cat.metalabel.db_id); };
                    popupMenu.Add(delete_item);
                }

                popupMenu.Add(new Gtk.SeparatorMenuItem());

                MenuItem create_item = new MenuItem(Mono.Unix.Catalog.GetString("Create a new category"));
                create_item.Activated += delegate { add_new_category_to_ui_callback(); };
                popupMenu.Add(create_item);

                popupMenu.ShowAll();
              			popupMenu.Popup(null, null, null, args.Event.Button, args.Event.Time);
            }
        }
开发者ID:GNOME,项目名称:nemo,代码行数:29,代码来源:CategoryDrawer.cs


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