diff options
author | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2011-11-05 03:20:34 +0400 |
---|---|---|
committer | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2011-11-05 03:54:47 +0400 |
commit | 136a254c036243828fc84ccd83d1b306c6ec7445 (patch) | |
tree | c3304ad1e79ced06920134e8f86de6fd15a50b3f /main/src/addins/MonoDevelop.Refactoring | |
parent | a06b1be4e0e4fa82b01e100a8fa69d2f3204559f (diff) |
[Refactoring] Port to context menu API
Diffstat (limited to 'main/src/addins/MonoDevelop.Refactoring')
-rw-r--r-- | main/src/addins/MonoDevelop.Refactoring/MonoDevelop.ContextAction/ContextActionWidget.cs | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.ContextAction/ContextActionWidget.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.ContextAction/ContextActionWidget.cs index bcb38b5862..fb17b68b74 100644 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.ContextAction/ContextActionWidget.cs +++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.ContextAction/ContextActionWidget.cs @@ -66,9 +66,14 @@ namespace MonoDevelop.ContextAction document.Editor.Parent.EditorOptionsChanged -= HandleDocumentEditorParentEditorOptionsChanged; base.OnDestroyed (); } - + public void PopupQuickFixMenu () { + PopupQuickFixMenu (null); + } + + void PopupQuickFixMenu (Gdk.EventButton evt) + { Gtk.Menu menu = new Gtk.Menu (); Dictionary<Gtk.MenuItem, ContextAction> fixTable = new Dictionary<Gtk.MenuItem, ContextAction> (); @@ -92,29 +97,19 @@ namespace MonoDevelop.ContextAction 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); + menuPushed = true; menu.Destroyed += delegate { menuPushed = false; QueueDraw (); }; + GtkWorkarounds.ShowContextMenu (menu, this, evt, Allocation); } protected override bool OnButtonPressEvent (Gdk.EventButton evnt) { - if (evnt.Button == 1) - PopupQuickFixMenu (); + if (!evnt.TriggersContextMenu () && evnt.Button == 1) + PopupQuickFixMenu (evnt); return base.OnButtonPressEvent (evnt); } |