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


C# Gtk.Menu.Popup方法代码示例

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


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

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

示例2: ShowDockPopupMenu

		internal void ShowDockPopupMenu (uint time)
		{
			Gtk.Menu menu = new Gtk.Menu ();
			
			// Hide menuitem
			if ((Behavior & DockItemBehavior.CantClose) == 0) {
				Gtk.MenuItem mitem = new Gtk.MenuItem (Catalog.GetString("Hide"));
				mitem.Activated += delegate { Visible = false; };
				menu.Append (mitem);
			}

			Gtk.MenuItem citem;

			// Auto Hide menuitem
			if ((Behavior & DockItemBehavior.CantAutoHide) == 0 && Status != DockItemStatus.AutoHide) {
				citem = new Gtk.MenuItem (Catalog.GetString("Minimize"));
				citem.Activated += delegate { Status = DockItemStatus.AutoHide; };
				menu.Append (citem);
			}

			if (Status != DockItemStatus.Dockable) {
				// Dockable menuitem
				citem = new Gtk.MenuItem (Catalog.GetString("Dock"));
				citem.Activated += delegate { Status = DockItemStatus.Dockable; };
				menu.Append (citem);
			}

			// Floating menuitem
			if ((Behavior & DockItemBehavior.NeverFloating) == 0 && Status != DockItemStatus.Floating) {
				citem = new Gtk.MenuItem (Catalog.GetString("Undock"));
				citem.Activated += delegate { Status = DockItemStatus.Floating; };
				menu.Append (citem);
			}

			if (menu.Children.Length == 0) {
				menu.Destroy ();
				return;
			}

			ShowingContextMemu = true;

			menu.ShowAll ();
			menu.Hidden += (o,e) => {
				ShowingContextMemu = false;
			};
			menu.Popup (null, null, null, 3, time);
		}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:47,代码来源:DockItem.cs

示例3: ShowContextMenu

        public void ShowContextMenu(ActionItem aitem)
        {
            ActionMenuItem menuItem = (ActionMenuItem) aitem;

            Gtk.Menu m = new Gtk.Menu ();
            Gtk.MenuItem item = new Gtk.MenuItem (Catalog.GetString ("Insert Before"));
            m.Add (item);
            item.Activated += delegate (object s, EventArgs a) {
                InsertActionAt (menuItem, false, false);
            };
            item = new Gtk.MenuItem (Catalog.GetString ("Insert After"));
            m.Add (item);
            item.Activated += delegate (object s, EventArgs a) {
                InsertActionAt (menuItem, true, false);
            };

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

            item = new Gtk.ImageMenuItem (Gtk.Stock.Cut, null);
            m.Add (item);
            item.Activated += delegate (object s, EventArgs a) {
                menuItem.Cut ();
            };
            item.Visible = false;	// No copy & paste for now
            item = new Gtk.ImageMenuItem (Gtk.Stock.Copy, null);
            m.Add (item);
            item.Activated += delegate (object s, EventArgs a) {
                menuItem.Copy ();
            };
            item.Visible = false;	// No copy & paste for now
            item = new Gtk.ImageMenuItem (Gtk.Stock.Paste, null);
            m.Add (item);
            item.Activated += delegate (object s, EventArgs a) {
                Paste (menuItem);
            };
            item.Visible = false;	// No copy & paste for now
            item = new Gtk.ImageMenuItem (Gtk.Stock.Delete, null);
            m.Add (item);
            item.Activated += delegate (object s, EventArgs a) {
                menuItem.Delete ();
            };
            m.ShowAll ();
            m.Popup ();
        }
开发者ID:mono,项目名称:stetic,代码行数:44,代码来源:ActionMenuBar.cs

示例4: OnSelectIcon

		void OnSelectIcon (object s, Gtk.ButtonPressEventArgs args)
		{
			Gtk.Menu menu = new Gtk.Menu ();
			
			Gtk.CheckMenuItem item = new Gtk.CheckMenuItem (Catalog.GetString ("Action"));
			item.DrawAsRadio = true;
			item.Active = (node.Action.Type == Stetic.Wrapper.Action.ActionType.Action);
			item.Activated += OnSetActionType;
			menu.Insert (item, -1);
			
			item = new Gtk.CheckMenuItem (Catalog.GetString ("Radio Action"));
			item.DrawAsRadio = true;
			item.Active = (node.Action.Type == Stetic.Wrapper.Action.ActionType.Radio);
			item.Activated += OnSetRadioType;
			menu.Insert (item, -1);
			
			item = new Gtk.CheckMenuItem (Catalog.GetString ("Toggle Action"));
			item.DrawAsRadio = true;
			item.Active = (node.Action.Type == Stetic.Wrapper.Action.ActionType.Toggle);
			item.Activated += OnSetToggleType;
			menu.Insert (item, -1);
			
			menu.Insert (new Gtk.SeparatorMenuItem (), -1);
			
			Gtk.MenuItem itIcons = new Gtk.MenuItem (Catalog.GetString ("Select Icon"));
			menu.Insert (itIcons, -1);
			IconSelectorMenu menuIcons = new IconSelectorMenu (GetProject ());
			menuIcons.IconSelected += OnStockSelected;
			itIcons.Submenu = menuIcons;
			
			Gtk.MenuItem it = new Gtk.MenuItem (Catalog.GetString ("Clear Icon"));
			it.Sensitive = (node.Action.GtkAction.StockId != null);
			it.Activated += OnClearIcon;
			menu.Insert (it, -1);
			
			menu.ShowAll ();

			uint but = args != null ? args.Event.Button : 1;
			menu.Popup (null, null, new Gtk.MenuPositionFunc (OnDropMenuPosition), but, Gtk.Global.CurrentEventTime);
			
			// Make sure we get the focus after closing the menu, so we can keep browsing buttons
			// using the keyboard.
			menu.Hidden += delegate (object sender, EventArgs a) {
				GrabFocus ();
			};
			
			if (args != null)
				args.RetVal = false;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:49,代码来源:ActionToolItem.cs

示例5: OnStatusIconPopupMenu

        private static void OnStatusIconPopupMenu(object sender, EventArgs e)
        {
            Trace.Call(sender, e);

            Gtk.Menu menu = new Gtk.Menu();

            Gtk.ImageMenuItem preferencesItem = new Gtk.ImageMenuItem(Gtk.Stock.Preferences, null);
            preferencesItem.Activated += delegate {
                try {
                    PreferencesDialog dialog = new PreferencesDialog(_MainWindow);
                    dialog.CurrentPage = PreferencesDialog.Page.Interface;
                    dialog.CurrentInterfacePage = PreferencesDialog.InterfacePage.Notification;
                } catch (Exception ex) {
                    ShowException(ex);
                }
            };
            menu.Add(preferencesItem);

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

            Gtk.ImageMenuItem quitItem = new Gtk.ImageMenuItem(Gtk.Stock.Quit, null);
            quitItem.Activated += delegate {
                try {
                    Quit();
                } catch (Exception ex) {
                    ShowException(ex);
                }
            };
            menu.Add(quitItem);

            menu.ShowAll();
            menu.Popup();
        }
开发者ID:RoninBG,项目名称:smuxi,代码行数:33,代码来源:Frontend.cs

示例6: OnSelectIcon

		void OnSelectIcon (object sender, Gtk.ButtonPressEventArgs e)
		{
			Gtk.Menu menu = new Gtk.Menu ();
			
			Gtk.CheckMenuItem item = new Gtk.CheckMenuItem (Catalog.GetString ("Action"));
			item.DrawAsRadio = true;
			item.Active = (node.Action.Type == Stetic.Wrapper.Action.ActionType.Action);
			item.Activated += OnSetActionType;
			menu.Insert (item, -1);
			
			item = new Gtk.CheckMenuItem (Catalog.GetString ("Radio Action"));
			item.DrawAsRadio = true;
			item.Active = (node.Action.Type == Stetic.Wrapper.Action.ActionType.Radio);
			item.Activated += OnSetRadioType;
			menu.Insert (item, -1);
			
			item = new Gtk.CheckMenuItem (Catalog.GetString ("Toggle Action"));
			item.DrawAsRadio = true;
			item.Active = (node.Action.Type == Stetic.Wrapper.Action.ActionType.Toggle);
			item.Activated += OnSetToggleType;
			menu.Insert (item, -1);
			
			menu.Insert (new Gtk.SeparatorMenuItem (), -1);
			
			Gtk.MenuItem itIcons = new Gtk.MenuItem (Catalog.GetString ("Select Icon"));
			menu.Insert (itIcons, -1);
			IconSelectorMenu menuIcons = new IconSelectorMenu (GetProject ());
			menuIcons.IconSelected += OnStockSelected;
			itIcons.Submenu = menuIcons;
			
			Gtk.MenuItem it = new Gtk.MenuItem (Catalog.GetString ("Clear Icon"));
			it.Sensitive = (node.Action.GtkAction.StockId != null);
			it.Activated += OnClearIcon;
			menu.Insert (it, -1);
			
			menu.ShowAll ();
			menu.Popup (null, null, new Gtk.MenuPositionFunc (OnDropMenuPosition), 3, Gtk.Global.CurrentEventTime);
			e.RetVal = false;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:39,代码来源:ActionMenuItem.cs

示例7: ContextMenu


//.........这里部分代码省略.........
				MenuItem mnuViewSource = new MenuItem("View Source");
				mnuViewSource.Enabled = !string.IsNullOrEmpty(viewSourceUrl);
				mnuViewSource.Click += delegate { ViewSource(viewSourceUrl); };

				MenuItem mnuOpenInSystemBrowser = new MenuItem("View In System Browser");//nice for debugging with firefox/firebug
				mnuOpenInSystemBrowser.Enabled = !string.IsNullOrEmpty(viewSourceUrl);
				mnuOpenInSystemBrowser.Click += delegate { ViewInSystemBrowser(viewSourceUrl); };


				string properties = (doc != null && doc.Uri == Document.Uri) ? "Page Properties" : "IFRAME Properties";
				
				MenuItem mnuProperties = new MenuItem(properties);
				mnuProperties.Enabled = doc != null;
				mnuProperties.Click += delegate { ShowPageProperties(doc); };
				
				menu.MenuItems.AddRange(optionals.ToArray());
				menu.MenuItems.Add(mnuSelectAll);
				menu.MenuItems.Add("-");
				menu.MenuItems.Add(mnuViewSource);
				menu.MenuItems.Add(mnuOpenInSystemBrowser);
				menu.MenuItems.Add(mnuProperties);
			}

			// get image urls
			Uri backgroundImageSrc = null, imageSrc = null;
			nsIURI src;
			try
			{
				src = info.GetBackgroundImageSrcAttribute();
				backgroundImageSrc = src.ToUri();
				Marshal.ReleaseComObject( src );
			}
			catch (COMException comException)
			{
				if ((comException.ErrorCode & 0xFFFFFFFF) != 0x80004005)
					throw comException;
			}

			try
			{
				src = info.GetImageSrcAttribute();
				if ( src != null )
				{
					imageSrc = src.ToUri();
					Marshal.ReleaseComObject( src );
				}
			}
			catch (COMException comException)
			{
				if ((comException.ErrorCode & 0xFFFFFFFF) != 0x80004005)
					throw comException;
			}
			
			// get associated link.  note that this needs to be done manually because GetAssociatedLink returns a non-zero
			// result when no associated link is available, so an exception would be thrown by nsString.Get()
			string associatedLink = null;
			try
			{
				using (nsAString str = new nsAString())
				{
					info.GetAssociatedLinkAttribute(str);
					associatedLink = str.ToString();
				}
			}
			catch (COMException comException) { }			
			
			GeckoContextMenuEventArgs e = new GeckoContextMenuEventArgs(
				PointToClient(MousePosition), menu, associatedLink, backgroundImageSrc, imageSrc,
				GeckoNode.Create(Xpcom.QueryInterface<nsIDOMNode>(info.GetTargetNodeAttribute()))
				);
			
			OnShowContextMenu(e);
			
			if (e.ContextMenu != null && e.ContextMenu.MenuItems.Count > 0)
			{
#if GTK
				// When using GTK we can't use SWF to display the context menu: SWF displays
				// the context menu and then tries to track the mouse so that it knows when to
				// close the context menu. However, GTK intercepts the mouse click before SWF gets
				// it, so the menu never closes. Instead we display a GTK menu and translate
				// the SWF menu items into Gtk.MenuItems.
				// TODO: currently this code only handles text menu items. Would be nice to also
				// translate images etc.
				var popupMenu = new Gtk.Menu();

				foreach (MenuItem swfMenuItem in e.ContextMenu.MenuItems)
				{
					var gtkMenuItem = new Gtk.MenuItem(swfMenuItem.Text);
					gtkMenuItem.Sensitive = swfMenuItem.Enabled;
					MenuItem origMenuItem = swfMenuItem;
					gtkMenuItem.Activated += (sender, ev) => origMenuItem.PerformClick();
					popupMenu.Append(gtkMenuItem);
				}
				popupMenu.ShowAll();
				popupMenu.Popup();
#else
				e.ContextMenu.Show(this, e.Location);
#endif
			}
		}
开发者ID:RSchwoerer,项目名称:Terminals,代码行数:101,代码来源:GeckoWebBrowser.cs

示例8: ArrowButton_Click

		private void ArrowButton_Click(object sender, EventArgs e)
		{
			Gtk.Menu menu = new Gtk.Menu();
			
			foreach (string childId in _dummyFam.Children)
			{
				GedcomIndividualRecord child = (GedcomIndividualRecord)_database[childId];
				
				string name = child.GetName().Name;
				
				Gtk.ImageMenuItem menuItem = new Gtk.ImageMenuItem(name);
				menuItem.Image = new Gtk.Image(Gtk.Stock.JumpTo, Gtk.IconSize.Menu);
				menuItem.ShowAll();
				
				menu.Append(menuItem);
								
				menuItem.Activated += ChildMenu_Activated;
			}
			
			menu.Popup();
		}
开发者ID:Bert6623,项目名称:Gedcom.Net,代码行数:21,代码来源:PedigreeView.cs

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

示例10: PopupContextMenu

        // HERZUM SPRINT 2.3 TLAB-56 TLAB-57 TLAB-58 TLAB-59
        /*
        private void PopupContextMenu(IPrimaryToolDelegator mainTool, IDrawingEditor editor, ITool dt, MouseEvent ev)
        {
            m_contextMenu = new Gtk.Menu();
            Gtk.MenuItem editLabel = new Gtk.MenuItem("Edit label");

            editLabel.Activated += delegate(object sender, EventArgs e) 
            {
                SimpleTextTool textTool = new SimpleTextTool(editor, this, dt, ev);
                mainTool.DelegateTool = textTool;
                textTool.StartEditing();
            };
    
            m_contextMenu.Add(editLabel);
            m_contextMenu.ShowAll();

            m_contextMenu.Popup();
        }
        */

        private void PopupContextMenu(IPrimaryToolDelegator mainTool, IDrawingEditor editor, ITool dt, MouseEvent ev)
        {
            m_contextMenu = new Gtk.Menu();
            Gtk.MenuItem editLabel = new Gtk.MenuItem("Edit label");
            Gtk.MenuItem copy = new Gtk.MenuItem("Copy");
            Gtk.MenuItem cut = new Gtk.MenuItem("Cut");
            // Gtk.MenuItem paste = new Gtk.MenuItem("Paste");

            editLabel.Activated += delegate(object sender, EventArgs e) 
            {
                SimpleTextTool textTool = new SimpleTextTool(editor, this, dt, ev);
                mainTool.DelegateTool = textTool;
                textTool.StartEditing();
            };

            copy.Activated += delegate(object sender, EventArgs e) 
            {
                Clipboard.Copy(ExperimentNode.Owner as BaseExperiment);
            };

            cut.Activated += delegate(object sender, EventArgs e) 
            {
                Clipboard.Cut(ExperimentNode.Owner as BaseExperiment);
            };

            /*
            paste.Activated += delegate(object sender, EventArgs e) 
            {
                Clipboard.Paste(ExperimentNode.Owner as BaseExperiment);
                ExperimentCanvasPad ecp = ExperimentCanvasPadFactory.GetExperimentCanvasPad(m_applicationContext, this);
                ecp.DisplayAddedSubgraph(ExperimentNode.Owner as BaseExperiment); 
            };
            */

            m_contextMenu.Add(editLabel);
            m_contextMenu.Add(copy);
            m_contextMenu.Add(cut);
            // m_contextMenu.Add(paste);
            m_contextMenu.ShowAll();

            m_contextMenu.Popup();
        }
开发者ID:CoEST,项目名称:TraceLab,代码行数:63,代码来源:ComponentControl.cs

示例11: delegate

        void IMenuItemContainer.ShowContextMenu(ActionItem aitem)
        {
            ActionMenuItem menuItem = aitem as ActionMenuItem;

            Gtk.Menu m = new Gtk.Menu ();
            Gtk.MenuItem item = new Gtk.ImageMenuItem (Gtk.Stock.Cut, null);
            m.Add (item);
            item.Activated += delegate (object s, EventArgs a) {
                Cut (menuItem);
            };
            item.Visible = false;	// No copy & paste for now
            item = new Gtk.ImageMenuItem (Gtk.Stock.Copy, null);
            m.Add (item);
            item.Activated += delegate (object s, EventArgs a) {
                Copy (menuItem);
            };
            item.Visible = false;	// No copy & paste for now
            item = new Gtk.ImageMenuItem (Gtk.Stock.Paste, null);
            m.Add (item);
            item.Activated += delegate (object s, EventArgs a) {
                Paste (menuItem);
            };
            item.Visible = false;	// No copy & paste for now
            item = new Gtk.ImageMenuItem (Gtk.Stock.Delete, null);
            m.Add (item);
            item.Activated += delegate (object s, EventArgs a) {
                Delete (menuItem);
            };
            m.ShowAll ();
            m.Popup ();
        }
开发者ID:mono,项目名称:stetic,代码行数:31,代码来源:ActionGroupEditor.cs

示例12: PopupContextMenu

        private void PopupContextMenu(IPrimaryToolDelegator mainTool, IDrawingEditor editor, ITool dt, MouseEvent ev)
        {
            m_contextMenu = new Gtk.Menu();
            Gtk.MenuItem editLabel = new Gtk.MenuItem("Edit label");

            editLabel.Activated += delegate(object sender, EventArgs e) 
            {
                SimpleTextTool textTool = new SimpleTextTool(editor, this, dt, ev);
                mainTool.DelegateTool = textTool;
                textTool.StartEditing();
            };
    
            m_contextMenu.Add(editLabel);
            m_contextMenu.ShowAll();

            m_contextMenu.Popup();
        }
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:17,代码来源:ComponentControl.cs

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

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

示例15: ShowPopup

        private void ShowPopup()
        {
            Gtk.Menu menu = new Gtk.Menu ();

            Gtk.MenuItem deleteFile = new Gtk.MenuItem (GettextCatalog.GetString ("Delete file"));
            deleteFile.Activated += new EventHandler (OnDeleteFiles);

            Gtk.MenuItem renameFile = new Gtk.MenuItem (GettextCatalog.GetString ("Rename file"));
            renameFile.Activated += new EventHandler (OnRenameFile);
            renameFile.Sensitive = false;

            menu.Append (deleteFile);
            menu.Append (renameFile);

            menu.Popup (null, null, null, 3, Gtk.Global.CurrentEventTime);
            menu.ShowAll ();
        }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:17,代码来源:FileList.cs


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