public void Activate(Gdk.EventButton eb, Literal literal, Gtk.Menu popupMenu, bool isPopup) { /*MenuItem attach_item = new MenuItem (Catalog.GetString ("Find With")); TagMenu attach_menu = new TagMenu (attach_item, App.Instance.Database.Tags); attach_menu.TagSelected += literal.HandleAttachTagCommand; attach_item.ShowAll (); popup_menu.Append (attach_item);*/ if (literal.IsNegated) { GtkUtil.MakeMenuItem (popupMenu, String.Format (Catalog.GetString ("Include Photos Tagged \"{0}\""), literal.Tag.Name), new EventHandler (literal.HandleToggleNegatedCommand), true); } else { GtkUtil.MakeMenuItem (popupMenu, String.Format (Catalog.GetString ("Exclude Photos Tagged \"{0}\""), literal.Tag.Name), new EventHandler (literal.HandleToggleNegatedCommand), true); } GtkUtil.MakeMenuItem (popupMenu, Catalog.GetString ("Remove From Search"), "gtk-remove", new EventHandler (literal.HandleRemoveCommand), true); if (isPopup) { if (eb != null) popupMenu.Popup (null, null, null, eb.Button, eb.Time); else popupMenu.Popup (null, null, null, 0, Gtk.Global.CurrentEventTime); } }
// Place the menu underneath an arbitrary parent widget. The // parent widget must be set using menu.AttachToWidget before // calling this public static void PopupMenu (Gtk.Menu menu, Gdk.EventButton ev) { menu.Deactivated += DeactivateMenu; menu.Popup (null, null, new Gtk.MenuPositionFunc (GetMenuPosition), (ev == null) ? 0 : ev.Button, (ev == null) ? Gtk.Global.CurrentEventTime : ev.Time); }
public void Activate (Gdk.EventButton eb, Literal literal, Gtk.Menu popup_menu, bool is_popup) { //this.literal = literal; /*MenuItem attach_item = new MenuItem (Catalog.GetString ("Find With")); TagMenu attach_menu = new TagMenu (attach_item, MainWindow.Toplevel.Database.Tags); attach_menu.TagSelected += literal.HandleAttachTagCommand; attach_item.ShowAll (); popup_menu.Append (attach_item);*/ if (literal.IsNegated) { GtkUtil.MakeMenuItem (popup_menu, Catalog.GetString ("Include"), "gtk-cancel", new EventHandler (literal.HandleToggleNegatedCommand), true); } else { GtkUtil.MakeMenuItem (popup_menu, Catalog.GetString ("Exclude"), "gtk-delete", new EventHandler (literal.HandleToggleNegatedCommand), true); } GtkUtil.MakeMenuItem (popup_menu, Catalog.GetString ("Remove"), "gtk-remove", new EventHandler (literal.HandleRemoveCommand), true); if (is_popup) { if (eb != null) popup_menu.Popup (null, null, null, eb.Button, eb.Time); else popup_menu.Popup (null, null, null, 0, Gtk.Global.CurrentEventTime); } }
public void ShowContextMenu (Gtk.Menu menu) { menu.Popup (null, null, null, 0, Gtk.Global.CurrentEventTime); }
void PopupContextMenuAtLocation (Gtk.Menu menu, int x, int y) { menu.ShowAll (); Gtk.MenuPositionFunc pos_menu_func = null; // Set up the funtion to position the context menu // if we were called by the keyboard Gdk.Key.Menu. if (x == 0 && y == 0) pos_menu_func = PositionContextMenu; try { menu.Popup (null, null, pos_menu_func, 0, Gtk.Global.CurrentEventTime); } catch { Logger.Debug ("Menu popup failed with custom MenuPositionFunc; trying again without"); menu.Popup (null, null, null, 0, Gtk.Global.CurrentEventTime); } }