MonoDevelop.Components.Docking.DockItem.ShowDockPopupMenu C# (CSharp) Method

ShowDockPopupMenu() private method

private ShowDockPopupMenu ( uint time ) : void
time uint
return void
		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);
		}
	}

Usage Example

示例#1
0
 protected override bool OnButtonPressEvent(Gdk.EventButton evnt)
 {
     if (bar.Frame.OverlayWidgetVisible)
     {
         return(false);
     }
     if (evnt.TriggersContextMenu())
     {
         it.ShowDockPopupMenu(this, evnt);
     }
     else if (evnt.Button == 1)
     {
         if (evnt.Type == Gdk.EventType.TwoButtonPress)
         {
             // Instead of changing the state of the pad here, do it when the button is released.
             // Changing the state will make this bar item to vanish before the ReleaseEvent is received, and in this
             // case the ReleaseEvent may be fired on another widget that is taking the space of this bar item.
             // This was happening for example with the feedback button.
             itemActivated = true;
         }
         else
         {
             AutoShow();
             it.Present(true);
         }
     }
     return(true);
 }
All Usage Examples Of MonoDevelop.Components.Docking.DockItem::ShowDockPopupMenu