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


C# Gtk.Menu类代码示例

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


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

示例1: GlobalKeybinder

		public GlobalKeybinder (Gtk.AccelGroup accel_group) 
		{
			this.accel_group = accel_group;

			fake_menu = new Gtk.Menu ();
			fake_menu.AccelGroup = accel_group;
		}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:7,代码来源:GtkUtils.cs

示例2: SetupUi

		protected void SetupUi()
		{
			var box = new Gtk.VBox();

			var menu = new Gtk.MenuBar();
			var fileMenu = new Gtk.Menu();
			var file = new Gtk.MenuItem("File");
			file.Submenu = fileMenu;
			menu.Append(file);

			var save = new Gtk.MenuItem("Save");
			save.Activated += OnSaveMenuActivated;
			var load = new Gtk.MenuItem("Load");
			load.Activated += OnLoadMenuActivated;

			var exit = new Gtk.MenuItem("Exit");
			exit.Activated += (sender, e) => Gtk.Application.Quit();

			fileMenu.Append(save);
			fileMenu.Append(load);
			fileMenu.Append(exit);


			box.PackStart(menu, false, false, 0);

			nb = new Gtk.Notebook();
			nb.ShowTabs = false;
			nb.AppendPage(SetupOverviewPage(), new Gtk.Label("Overview"));
			nb.AppendPage(SetupNewNotePage(), new Gtk.Label("New"));
			box.PackStart(nb, true, true, 2);

			Add(box);
		}
开发者ID:cgt,项目名称:Notes,代码行数:33,代码来源:MainWindow.cs

示例3: GetSubmenu

        public static Gtk.Menu GetSubmenu(Tag [] tags)
        {
            Tag single_tag = null;
            if (tags != null && tags.Length == 1)
                single_tag = tags[0];

            if (LogicWidget.Root == null || LogicWidget.Root.SubTerms.Count == 0) {
                return null;
            } else {
                var m = new Gtk.Menu ();

                Gtk.MenuItem all_item = GtkUtil.MakeMenuItem (m, Catalog.GetString ("All"), new EventHandler (App.Instance.Organizer.HandleRequireTag));
                GtkUtil.MakeMenuSeparator (m);

                int sensitive_items = 0;
                foreach (Term term in LogicWidget.Root.SubTerms) {
                    var term_parts = new List<string> ();

                    bool contains_tag = AppendTerm (term_parts, term, single_tag);

                    string name = "_" + String.Join (", ", term_parts.ToArray ());

                    Gtk.MenuItem item = GtkUtil.MakeMenuItem (m, name, new EventHandler (App.Instance.Organizer.HandleAddTagToTerm));
                    item.Sensitive = !contains_tag;

                    if (!contains_tag)
                        sensitive_items++;
                }

                if (sensitive_items == 0)
                    all_item.Sensitive = false;

                return m;
            }
        }
开发者ID:Yetangitu,项目名称:f-spot,代码行数:35,代码来源:TermMenuItem.cs

示例4: BuildMenu

        private void BuildMenu()
        {
            var menuBar = new Gtk.MenuBar();
            var miFile = new Gtk.MenuItem( "File" );
            var mFile = new Gtk.Menu();
            var miHelp = new Gtk.MenuItem( "Help" );
            var mHelp = new Gtk.Menu();
            var miView = new Gtk.MenuItem( "View" );
            var mView = new Gtk.Menu();

            miFile.Submenu = mFile;
            mFile.Append( this.actQuit.CreateMenuItem() );
            miHelp.Submenu = mHelp;
            mHelp.Append( this.actAbout.CreateMenuItem() );
            miView.Submenu = mView;
            mView.Append( this.actViewBoxes.CreateMenuItem() );
            mView.Append( this.actViewFrames.CreateMenuItem() );
            mView.Append( this.actViewNotebook.CreateMenuItem() );
            mView.Append( this.actViewDrawing.CreateMenuItem() );

            menuBar.Append( miFile );
            menuBar.Append( miView );
            menuBar.Append( miHelp );
            this.vbMain.PackStart( menuBar, false, false, 5 );
        }
开发者ID:Baltasarq,项目名称:GTKSharpDemo,代码行数:25,代码来源:MainWindowView.cs

示例5: GetSubmenu

		public Gtk.Menu GetSubmenu (object parent)
		{
			Gtk.Menu submenu = new Gtk.Menu ();

			foreach (MenuNode node in ChildNodes)
				submenu.Insert (node.GetMenuItem (parent), -1);

			return submenu;				
		}
开发者ID:guadalinex-archive,项目名称:guadalinex-v6,代码行数:9,代码来源:MenuNode.cs

示例6: GetMenuItem

		public override Gtk.MenuItem GetMenuItem ()
		{
			Gtk.MenuItem it = new Gtk.MenuItem (label);
			Gtk.Menu submenu = new Gtk.Menu ();
			foreach (MenuNode node in ChildNodes)
				submenu.Insert (node.GetMenuItem (), -1);
			it.Submenu = submenu;
			return it;
		}
开发者ID:wanglehui,项目名称:mono-addins,代码行数:9,代码来源:SubmenuNode.cs

示例7: Wrap

		public override void Wrap (object obj, bool initialized)
		{
			Gtk.OptionMenu omenu = (Gtk.OptionMenu)obj;
			if (omenu.Menu == null) {
				Gtk.Menu menu = new Gtk.Menu ();
				menu.Show ();
				omenu.Menu = menu;
			}

			base.Wrap (obj, initialized);
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:11,代码来源:OptionMenu.cs

示例8: MenuToolButton

		public MenuToolButton (Gtk.Menu menu, string icon): base (icon)
		{
			this.menu = menu;
			Child.ButtonPressEvent += new Gtk.ButtonPressEventHandler (OnButtonPress);
			
			if (string.IsNullOrEmpty (icon)) {
				this.Expand = false;
				this.Homogeneous = false;
				this.IconWidget = new Gtk.Arrow (Gtk.ArrowType.Down, Gtk.ShadowType.None);
			}
		}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:11,代码来源:MenuToolButton.cs

示例9: OnNoteOpened

		public override void OnNoteOpened ()
		{
			menu = new Gtk.Menu ();
			menu.Hidden += OnMenuHidden;
			menu.ShowAll ();
			menu_item = new Gtk.ImageMenuItem (
			        Catalog.GetString ("What links here?"));
			menu_item.Image = new Gtk.Image (Gtk.Stock.JumpTo, Gtk.IconSize.Menu);
			menu_item.Submenu = menu;
			menu_item.Activated += OnMenuItemActivated;
			menu_item.Show ();
			AddPluginMenuItem (menu_item);
		}
开发者ID:MichaelAquilina,项目名称:tomboy,代码行数:13,代码来源:BacklinksNoteAddin.cs

示例10: GetMenuItem

		public override Gtk.MenuItem GetMenuItem ()
		{
			lock (this) {
				if (item == null || changed) {
					changed = false;
					item = new Gtk.MenuItem (_label != null ? Catalog.GetString (_label) : Id);
					Gtk.Menu submenu = new Gtk.Menu ();

					foreach (MenuNode node in ChildNodes)
						submenu.Insert (node.GetMenuItem (), -1);
					item.Submenu = submenu;
				}
			}
			return item;
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:15,代码来源:MenuNode.cs

示例11: Run

		protected override void Run (RefactoringOptions options)
		{
			Gtk.Menu menu = new Gtk.Menu ();
			
			bool resolveDirect;
			List<string> namespaces = GetResolveableNamespaces (options, out resolveDirect);
			
			foreach (string ns in namespaces) {
				// remove used namespaces for conflict resolving.
				if (options.Document.CompilationUnit.IsNamespaceUsedAt (ns, options.ResolveResult.ResolvedExpression.Region.Start))
					continue;
				Gtk.MenuItem menuItem = new Gtk.MenuItem (string.Format (GettextCatalog.GetString ("Add using '{0}'"), ns));
				CurrentRefactoryOperationsHandler.ResolveNameOperation resolveNameOperation = new CurrentRefactoryOperationsHandler.ResolveNameOperation (options.Dom, options.Document, options.ResolveResult, ns);
				menuItem.Activated += delegate {
					resolveNameOperation.AddImport ();
				};
				menu.Add (menuItem);
			}
			if (resolveDirect) {
				foreach (string ns in namespaces) {
					Gtk.MenuItem menuItem = new Gtk.MenuItem (string.Format (GettextCatalog.GetString ("Add '{0}'"), ns));
					CurrentRefactoryOperationsHandler.ResolveNameOperation resolveNameOperation = new CurrentRefactoryOperationsHandler.ResolveNameOperation (options.Dom, options.Document, options.ResolveResult, ns);
					menuItem.Activated += delegate {
						resolveNameOperation.ResolveName ();
					};
					menu.Add (menuItem);
				}
			}
			
			if (menu.Children != null && menu.Children.Length > 0) {
				menu.ShowAll ();
				
				ICompletionWidget widget = options.Document.GetContent<ICompletionWidget> ();
				CodeCompletionContext codeCompletionContext = widget.CreateCodeCompletionContext (options.GetTextEditorData ().Caret.Offset);

				menu.Popup (null, null, delegate (Gtk.Menu menu2, out int x, out int y, out bool pushIn) {
					x = codeCompletionContext.TriggerXCoord; 
					y = codeCompletionContext.TriggerYCoord; 
					pushIn = false;
				}, 0, Gtk.Global.CurrentEventTime);
				menu.SelectFirst (true);
			}
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:43,代码来源:QuickFixHandler.cs

示例12: PopupQuickFixMenu

		public void PopupQuickFixMenu ()
		{
			Gtk.Menu menu = new Gtk.Menu ();
			
			Dictionary<Gtk.MenuItem, ContextAction> fixTable = new Dictionary<Gtk.MenuItem, ContextAction> ();
			int mnemonic = 1;
			foreach (ContextAction fix in fixes) {
				var escapedLabel = fix.GetMenuText (document, loc).Replace ("_", "__");
				var label = (mnemonic <= 10)
						? "_" + (mnemonic++ % 10).ToString () + " " + escapedLabel
						: "  " + escapedLabel;
				Gtk.MenuItem menuItem = new Gtk.MenuItem (label);
				fixTable [menuItem] = fix;
				menuItem.Activated += delegate(object sender, EventArgs e) {
					// ensure that the Ast is recent.
					document.UpdateParseDocument ();
					var runFix = fixTable [(Gtk.MenuItem)sender];
					runFix.Run (document, loc);
					
					document.Editor.Document.CommitUpdateAll ();
					menu.Destroy ();
				};
				menu.Add (menuItem);
			}
			menu.ShowAll ();
			int dx, dy;
			this.ParentWindow.GetOrigin (out dx, out dy);
			dx += ((TextEditorContainer.EditorContainerChild)(this.document.Editor.Parent.Parent as TextEditorContainer) [this]).X;
			dy += ((TextEditorContainer.EditorContainerChild)(this.document.Editor.Parent.Parent as TextEditorContainer) [this]).Y - (int)document.Editor.VAdjustment.Value;
					
			menu.Popup (null, null, delegate (Gtk.Menu menu2, out int x, out int y, out bool pushIn) {
				x = dx; 
				y = dy + Allocation.Height; 
				pushIn = false;
				menuPushed = true;
				QueueDraw ();
			}, 0, Gtk.Global.CurrentEventTime);
			menu.SelectFirst (true);
			menu.Destroyed += delegate {
				menuPushed = false;
				QueueDraw ();
			};
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:43,代码来源:ContextActionWidget.cs

示例13: OnPopupMenu

        protected override bool OnPopupMenu()
        {
            Gtk.Menu mnu=new Gtk.Menu();

            Gtk.ImageMenuItem play=new Gtk.ImageMenuItem(Gtk.Stock.MediaPlay,null);
            play.Activated+=delegate(object sender,EventArgs a) {
                _view.PlayAlbum((CS_AlbumInfo) this.Model[Selection.FirstIndex]);
            };

            Gtk.ImageMenuItem edit=new Gtk.ImageMenuItem(Gtk.Stock.Edit,null);
            edit.Activated+=delegate(object sender,EventArgs a) {
                _view.EditSheet(((CS_AlbumInfo) this.Model[Selection.FirstIndex]).getSheet ());
            };

            Gtk.ImageMenuItem show_file=new Gtk.ImageMenuItem("Show in filesystem");
            show_file.Image=new Gtk.Image(Gtk.Stock.Directory,Gtk.IconSize.Menu);
            show_file.Activated+=delegate(object sender, EventArgs a) {
                _view.OpenContainingFolder((CS_AlbumInfo) this.Model[Selection.FirstIndex]);
            };

            mnu.Append (play);
            mnu.Append (new Gtk.SeparatorMenuItem());
            mnu.Append (edit);
            mnu.Append (show_file);

            CueSheet s=((CS_AlbumInfo) this.Model[Selection.FirstIndex]).getSheet ();
            if (Mp3Split.DllPresent()) {
                if (Mp3Split.IsSupported(s.musicFileName ())) {
                    Gtk.ImageMenuItem split=new Gtk.ImageMenuItem("Split & Write to location");
                    split.Image=new Gtk.Image(Gtk.Stock.Convert,Gtk.IconSize.Menu);
                    split.Activated+=delegate(object sender,EventArgs a) {
                        _view.MusicFileToDevice(((CS_AlbumInfo) this.Model[Selection.FirstIndex]).getSheet ());
                    };
                    mnu.Append (split);
                }
            }

            mnu.ShowAll ();
            mnu.Popup();

            return false;
        }
开发者ID:nailyk,项目名称:banshee-community-extensions,代码行数:42,代码来源:CS_AlbumListView.cs

示例14: Step1_SetWidget

        public void Step1_SetWidget(Gtk.Widget widget)
        {
            // Add right-click context menu to control.
            var menu = new Gtk.Menu();
            var resetMenuItem = new Gtk.MenuItem("Reset Camera Offset");
            resetMenuItem.Activated += delegate(object sender, EventArgs e) {
                SetCameraOffset(0, 0);
            };
            menu.Add(resetMenuItem);

            // Handle mouse move events.
            widget.MotionNotifyEvent += delegate(object o, Gtk.MotionNotifyEventArgs args) {
                if (!m_enabled) return;
                if (!m_mouseDown) return;

                double x = args.Event.X;
                double y = args.Event.Y;
                double dx = x - m_mouseDownX;
                double dy = y - m_mouseDownY;

                SetCameraOffset(m_offsetDownX + dx, m_offsetDownY + dy);
            };
            widget.ButtonPressEvent += delegate(object o, Gtk.ButtonPressEventArgs args) {
                if (m_enablePopupMenu && (args.Event.Button & 2) == 2) {
                    menu.ShowAll();
                    menu.Popup();
                    return;
                }

                m_mouseDown = true;
                m_mouseDownX = args.Event.X;
                m_mouseDownY = args.Event.Y;
                m_offsetDownX = m_offsetX;
                m_offsetDownY = m_offsetY;
            };
            widget.ButtonReleaseEvent += delegate(object o, Gtk.ButtonReleaseEventArgs args) {
                m_mouseDown = false;
            };
        }
开发者ID:bvssvni,项目名称:csharp-utils,代码行数:39,代码来源:CameraOffsetHelper.cs

示例15: OnNoteOpened

		public override void OnNoteOpened ()
		{
			menu = new Gtk.Menu ();
			menu.Hidden += OnMenuHidden;
			menu.ShowAll ();
			
			Gtk.Image tasqueImage = new Gtk.Image (TasqueIcon);
			tasqueImage.Show ();
			menuToolButton =
				new Gtk.MenuToolButton (tasqueImage, Catalog.GetString ("Tasque"));
			menuToolButton.Menu = menu;
			menuToolButton.Clicked += OnMenuToolButtonClicked;
			menuToolButton.ShowMenu += OnMenuItemActivated;
			menuToolButton.Sensitive = false;
			menuToolButton.Show ();
			AddToolItem (menuToolButton, -1);
			
			// Sensitize the Task button on text selection
			markSetTimeout = new InterruptableTimeout();
			markSetTimeout.Timeout += UpdateTaskButtonSensitivity;
			Note.Buffer.MarkSet += OnSelectionMarkSet;
		}
开发者ID:MichaelAquilina,项目名称:tomboy,代码行数:22,代码来源:TasqueNoteAddin.cs


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