• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Gtk.Menu类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Menu类属于Gtk命名空间,在下文中一共展示了Menu类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ConnectionMenu

 public ConnectionMenu(TreeView connectionList)
 {
     this.connectionList = connectionList;
     Glade.XML xmlMnuConnections = new Glade.XML(null, "FileFind.Meshwork.GtkClient.meshwork.glade", "mnuConnections", null);
     mnuConnections = (xmlMnuConnections.GetWidget("mnuConnections") as Gtk.Menu);
     xmlMnuConnections.Autoconnect (this);
 }
开发者ID:codebutler,项目名称:meshwork,代码行数:7,代码来源:ConnectionMenu.cs


示例2: OnPressed

        protected override void OnPressed()
        {
            //base.OnPressed ();
            Gtk.Menu menu = new Gtk.Menu ();

            if (menu.Children.Length > 0) {
                Gtk.SeparatorMenuItem sep = new Gtk.SeparatorMenuItem ();
                sep.Show ();
                menu.Insert (sep, -1);
            }

            Gtk.RadioMenuItem grp = new Gtk.RadioMenuItem ("");

            foreach (ComboItem ci in items) {
                Gtk.RadioMenuItem mi = new Gtk.RadioMenuItem (grp, ci.Label.Replace ("_","__"));
                if (ci.Item == items.CurrentItem || ci.Item.Equals (items.CurrentItem))
                    mi.Active = true;

                ComboItemSet isetLocal = items;
                ComboItem ciLocal = ci;
                mi.Activated += delegate {
                    SelectItem (isetLocal, ciLocal);
                };
                mi.ShowAll ();
                menu.Insert (mi, -1);
            }
            menu.Popup (null, null, PositionFunc, 0, Gtk.Global.CurrentEventTime);
        }
开发者ID:moscrif,项目名称:ide,代码行数:28,代码来源:DropDownRadioButton.cs


示例3: TransfersMenu

        public TransfersMenu(TreeView transfersList, IFileTransfer transfer)
        {
            Glade.XML glade = new Glade.XML(null, "FileFind.Meshwork.GtkClient.meshwork.glade", "TransfersMenu", null);
            glade.Autoconnect(this);
            this.menu = (Gtk.Menu) glade.GetWidget("TransfersMenu");

            this.transfersList = transfersList;
            this.transfer = transfer;

            if (transfer != null) {
                mnuCancelAndRemoveTransfer.Visible = true;
                mnuShowTransferDetails.Sensitive = true;
                mnuClearFinishedFailedTransfers.Sensitive = true;
                if (transfer.Status == FileTransferStatus.Paused) {
                    mnuPauseTransfer.Visible = false;
                    mnuResumeTransfer.Visible = true;
                    mnuResumeTransfer.Sensitive = true;
                    mnuCancelTransfer.Sensitive = true;
                } else if (transfer.Status == FileTransferStatus.Canceled || transfer.Status == FileTransferStatus.Completed) {
                    mnuPauseTransfer.Sensitive = false;
                    mnuResumeTransfer.Visible = false;
                    mnuCancelTransfer.Sensitive = false;
                }
            } else {
                mnuCancelAndRemoveTransfer.Visible = false;
                mnuShowTransferDetails.Sensitive = false;
                mnuPauseTransfer.Sensitive = false;
                mnuResumeTransfer.Visible = false;
                mnuCancelTransfer.Sensitive = false;
            }
        }
开发者ID:codebutler,项目名称:meshwork,代码行数:31,代码来源:TransfersMenu.cs


示例4: CreateMenus

		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;
		}
开发者ID:directhex,项目名称:xamarin-gnome-sharp2,代码行数:26,代码来源:GnomeHelloWorld.cs


示例5: TrackListHeaderMenuController

        public TrackListHeaderMenuController(BaseTrackListViewController trackListViewController)
        {
            var visibleColumns = trackListViewController.GetColumnTrackProperties().ToHashSet();

            Menu headerMenu = new Menu();

            foreach (TrackProperty trackProperty in Enum.GetValues(typeof(TrackProperty)))
            {
                var trackPropertyMenuItem = new CheckMenuItem(Extensions.GetEnumDescription(trackProperty));
                if (visibleColumns.Contains(trackProperty))
                    trackPropertyMenuItem.Active = true;
                TrackProperty property = trackProperty;
                trackPropertyMenuItem.Toggled += (sender, args) =>
                    {
                        if (trackPropertyMenuItem.Active)
                            trackListViewController.InsertColumn(property, ClickedProperty);
                        else
                            trackListViewController.RemoveColumn(property);
                    };
                headerMenu.Append(trackPropertyMenuItem);
            }

            View = headerMenu;
            View.ShowAll();
        }
开发者ID:gclark916,项目名称:Howler,代码行数:25,代码来源:TrackListHeaderMenuController.cs


示例6: ParseTreeWindow

 public ParseTreeWindow(RuntimeThread runtimeThread) : base("Parse Tree")
 {
     runtimeThread.Runtime.ParseTrace.ParsedEvent += OnParsed;
     
     SetDefaultSize(250, 300);
     SkipPagerHint = true;
     SkipTaskbarHint = true;
     
     scroller = new ScrolledWindow();
     scroller.BorderWidth = 5;
     scroller.ShadowType = ShadowType.In;
     Add(scroller);
     
     store = new TreeStore(typeof(string), typeof(object));
     
     view = new TreeView(store);
     column = view.AppendColumn(null, new CellRendererText(), "text", VALUE_TEXT);
     view.HeadersVisible = false;
     view.RowActivated += OnTreeRowActivated;
     view.ButtonPressEvent += OnTreeButtonPress;
     scroller.Add(view);
     
     MenuBuilder menuBuilder = new MenuBuilder();
     menu = menuBuilder.StartMenu();
     menuBuilder.Add("Show source", OnMenuShowSource);
     menuBuilder.Add("Show object", OnMenuShowObject);
     menu.ShowAll();
 }
开发者ID:KevinKelley,项目名称:katahdin,代码行数:28,代码来源:ParseTreeWindow.cs


示例7: HandleTrayIconPopupMenu

        static void HandleTrayIconPopupMenu(object o, PopupMenuArgs args)
        {
            Menu popupMenu = new Menu ();
            ImageMenuItem menuItemQuit = new ImageMenuItem ("Quit");

            ImageMenuItem menuItemEnabled;
            if(Preferences.Enabled)
            {
                menuItemEnabled = new ImageMenuItem ("Disable");
                menuItemEnabled.Image = new Gtk.Image (Gtk.Stock.Yes, IconSize.Menu);
            }
            else
            {
                // hopefully prevent any major mem leaks

                menuItemEnabled = new ImageMenuItem ("Enable");
                menuItemEnabled.Image = new Gtk.Image(Gtk.Stock.Yes, IconSize.Menu);
            }

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

            menuItemQuit.Activated += delegate(object sender, EventArgs e) {
                Application.Quit();
            };
            menuItemEnabled.Activated += HandleMenuItemEnabledActivated;

            popupMenu.ShowAll();
            popupMenu.Popup();
        }
开发者ID:skyronic,项目名称:Screenlapse,代码行数:31,代码来源:Main.cs


示例8: Main21

		public static void Main21 (string[] args)
		{
			Application.Init();
			Window win = new Window ("Menu Sample App");
			win.DeleteEvent += new DeleteEventHandler (delete_cb);
			win.DefaultWidth = 200;
			win.DefaultHeight = 150;

			VBox box = new VBox (false, 2);

			MenuBar mb = new MenuBar ();
			Menu file_menu = new Menu ();
			MenuItem exit_item = new MenuItem("Exit");
			exit_item.Activated += new EventHandler (exit_cb);
			file_menu.Append (exit_item);
			MenuItem file_item = new MenuItem("File");
			file_item.Submenu = file_menu;
			mb.Append (file_item);
			box.PackStart(mb, false, false, 0);

			Button btn = new Button ("Yep, that's a menu");
			box.PackStart(btn, true, true, 0);
			
			win.Add (box);
			win.ShowAll ();

			Application.Run ();
		}
开发者ID:akrisiun,项目名称:gtk-sharp,代码行数:28,代码来源:Menu.cs


示例9: 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


示例10: CreateMenu

		private Menu CreateMenu (int depth, bool tearoff)
		{
			if (depth < 1)
				return null;

			Menu menu = new Menu ();
			RadioMenuItem[] group = null;

			if (tearoff) {
				TearoffMenuItem menuitem = new TearoffMenuItem ();
				menu.Append (menuitem);
			}

			for (int i = 0, j = 1; i < 5; i++, j++) {
				RadioMenuItem menuitem = new RadioMenuItem (group, String.Format ("item {0} - {1}", depth, j));
				group = menuitem.Group;

				menu.Append (menuitem);
				if (i == 3)
					menuitem.Sensitive = false;

				menuitem.Submenu = CreateMenu ((depth - 1), true);
			}

			return menu;
		}
开发者ID:liberostelios,项目名称:gtk-sharp,代码行数:26,代码来源:DemoMenus.cs


示例11: 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


示例12: GlobalKeybinder

        /// <summary>
        /// Create a global keybinder for the given Gtk.AccelGroup.
        /// </summary>
        /// </param>
        public GlobalKeybinder(Gtk.AccelGroup accel_group)
        {
            this.accel_group = accel_group;

            fake_menu = new Gtk.Menu ();
            fake_menu.AccelGroup = accel_group;
        }
开发者ID:mono-soc-2012,项目名称:Tasque,代码行数:11,代码来源:TaskWindow.cs


示例13: 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


示例14: TIcon

        public TIcon(CInterfaceGateway in_krnGateway, Gtk.Window mwindow)
        {
            krnGateway = in_krnGateway;
            mainwindow = mwindow;

             	menu = new Gtk.Menu ();
               		EventBox eb = new EventBox ();
            eb.ButtonPressEvent += new ButtonPressEventHandler (TIconClicked);
            eb.Add (new Gtk.Image (new Gdk.Pixbuf (null, "lPhant.png")));

            MenuItem it_show = new MenuItem ("Show");
            it_show.Activated += new EventHandler (TIconShow);

            MenuItem it_options = new MenuItem ("Options");
            it_options.Activated += new EventHandler (TIconOptions);

            ImageMenuItem it_quit = new ImageMenuItem("Quit");
            it_quit.Activated += new EventHandler (TIconQuit);

            menu.Append (it_show);
            menu.Append (it_options);
            menu.Append (it_quit);

               	   t = new TrayIcon ("eLePhantGTK");
               	   t.Add (eb);
               	   t.ShowAll ();
        }
开发者ID:sonicwang1989,项目名称:lphant,代码行数:27,代码来源:TIcon.cs


示例15: GrammarWindow

 public GrammarWindow(RuntimeThread runtimeThread) : base("Grammar")
 {
     runtimeThread.Runtime.Grammar.Trace.PatternDefinedEvent += OnGrammarPatternDefined;
     runtimeThread.Runtime.Grammar.Trace.PatternChangedEvent += OnGrammarPatternChanged;
     
     SetDefaultSize(250, 300);
     SkipPagerHint = true;
     SkipTaskbarHint = true;
     
     scroller = new ScrolledWindow();
     scroller.BorderWidth = 5;
     scroller.ShadowType = ShadowType.In;
     Add(scroller);
     
     store = new TreeStore(typeof(string), typeof(Source));
     
     // FIXME - only want to sort top level
     
     //TreeModelSort storeSort = new TreeModelSort(store);
     //storeSort.SetSortColumnId(0, SortType.Ascending);
     
     view = new TreeView(store);
     
     view.AppendColumn(null, new CellRendererText(), "text", VALUE_TEXT);
     view.HeadersVisible = false;
     view.RowActivated += OnTreeRowActivated;
     view.ButtonPressEvent += OnTreeButtonPress;
     scroller.Add(view);
     
     MenuBuilder menuBuilder = new MenuBuilder();
     menu = menuBuilder.StartMenu();
     menuBuilder.Add("Show source", OnMenuShowSource);
     menuBuilder.Add("Show object", OnMenuShowObject);
     menu.ShowAll();
 }
开发者ID:KevinKelley,项目名称:katahdin,代码行数:35,代码来源:GrammarWindow.cs


示例16: MenuBarController

        public MenuBarController()
        {
            MenuBar mb = new MenuBar();

            Menu filemenu = new Menu();
            MenuItem file = new MenuItem("File");
            file.Submenu = filemenu;

            ImageMenuItem importDirectoryMenuItem = new ImageMenuItem("Import Directory");
            importDirectoryMenuItem.Activated += ImportDirectoryMenuItemOnActivated;
            filemenu.Append(importDirectoryMenuItem);

            ImageMenuItem open = new ImageMenuItem(Stock.Open);
            filemenu.Append(open);

            SeparatorMenuItem sep = new SeparatorMenuItem();
            filemenu.Append(sep);

            ImageMenuItem exit = new ImageMenuItem(Stock.Quit);

            exit.Activated += (sender, args) => Application.Quit();
            filemenu.Append(exit);

            mb.Append(file);
            View = mb;
        }
开发者ID:gclark916,项目名称:Howler,代码行数:26,代码来源:MenuBarController.cs


示例17: DockNotebook

		public DockNotebook ()
		{
			pagesCol = new ReadOnlyCollection<IDockNotebookTab> (pages);
			AddEvents ((Int32)(EventMask.AllEventsMask));

			tabStrip = new TabStrip (this);

			PackStart (tabStrip, false, false, 0);

			contentBox = new EventBox ();
			PackStart (contentBox, true, true, 0);

			ShowAll ();

			tabStrip.DropDownButton.Sensitive = false;

			tabStrip.DropDownButton.MenuCreator = delegate {
				Gtk.Menu menu = new Menu ();
				foreach (var tab in pages) {
					var mi = new Gtk.ImageMenuItem ("");
					menu.Insert (mi, -1);
					var label = (Gtk.AccelLabel) mi.Child;
					if (tab.Markup != null)
						label.Markup = tab.Markup;
					else
						label.Text = tab.Text;
					var locTab = tab;
					mi.Activated += delegate {
						CurrentTab = locTab;
					};
				}
				menu.ShowAll ();
				return menu;
			};
		}
开发者ID:alexrp,项目名称:monodevelop,代码行数:35,代码来源:DockNotebook.cs


示例18: CreateMainMenu

        public void CreateMainMenu(Gtk.Menu menu)
        {
            addins_menu = menu;

            menu.Append (AddinManager.CreateMenuItem ());
            menu.AppendSeparator ();
        }
开发者ID:JoeyScarr,项目名称:Pinta,代码行数:7,代码来源:AddinActions.cs


示例19: Initialize

		public void Initialize (DockFrame workspace, Menu padMenu)
		{
			var layers = new LayersListWidget ();
			DockItem layers_item = workspace.AddItem ("Layers");
			DockItemToolbar layers_tb = layers_item.GetToolbar (PositionType.Bottom);

			layers_item.Label = Catalog.GetString ("Layers");
			layers_item.Content = layers;
			layers_item.Icon = PintaCore.Resources.GetIcon ("Menu.Layers.MergeLayerDown.png");
            layers_item.DefaultWidth = 100;

			layers_tb.Add (PintaCore.Actions.Layers.AddNewLayer.CreateDockToolBarItem ());
			layers_tb.Add (PintaCore.Actions.Layers.DeleteLayer.CreateDockToolBarItem ());
			layers_tb.Add (PintaCore.Actions.Layers.DuplicateLayer.CreateDockToolBarItem ());
			layers_tb.Add (PintaCore.Actions.Layers.MergeLayerDown.CreateDockToolBarItem ());
			layers_tb.Add (PintaCore.Actions.Layers.MoveLayerUp.CreateDockToolBarItem ());
			layers_tb.Add (PintaCore.Actions.Layers.MoveLayerDown.CreateDockToolBarItem ());

			Gtk.ToggleAction show_layers = padMenu.AppendToggleAction ("Layers", Catalog.GetString ("Layers"), null, "Menu.Layers.MergeLayerDown.png");
			show_layers.Activated += delegate { layers_item.Visible = show_layers.Active; };
			layers_item.VisibleChanged += delegate { show_layers.Active = layers_item.Visible; };

			show_layers.Active = layers_item.Visible;

			PintaCore.Workspace.ActiveDocumentChanged += delegate { layers.Reset (); };
		}
开发者ID:msiyer,项目名称:Pinta,代码行数:26,代码来源:LayersPad.cs


示例20: AddImageItem

 public ImageMenuItem AddImageItem(string stock_id, Menu subMenu)
 {
     ImageMenuItem item = new ImageMenuItem(stock_id, null);
     item.Submenu = subMenu;
     Append(item);
     return(item);
 }
开发者ID:BackupTheBerlios,项目名称:niry-sharp-svn,代码行数:7,代码来源:PopupMenu.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Gtk.MenuBar类代码示例发布时间:2022-05-26
下一篇:
C# Gtk.ListStore类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap