Example #1
0
        public void Show(Gtk.Widget parent, Gdk.EventButton evt)
        {
                        #if MAC
            if (Platform.IsMac)
            {
                ContextMenuExtensionsMac.ShowContextMenu(parent, evt, this);
                return;
            }
                        #endif

            ContextMenuExtensionsGtk.ShowContextMenu(parent, evt, this);
        }
Example #2
0
        public void Show(Gtk.Widget parent, int x, int y, Action closeHandler, bool selectFirstItem = false)
        {
                        #if MAC
            if (Platform.IsMac)
            {
                ContextMenuExtensionsMac.ShowContextMenu(parent, x, y, this, closeHandler, selectFirstItem);
                return;
            }
                        #endif

            ContextMenuExtensionsGtk.ShowContextMenu(parent, x, y, this, closeHandler, selectFirstItem);
        }
Example #3
0
        public void Show(Gtk.Widget parent, int x, int y, Action closeHandler, bool selectFirstItem = false)
        {
                        #if MAC
            if (Platform.IsMac)
            {
                int tx, ty;

                // x, y are in gtk coordinates, so they need to be translated for Cocoa.
                parent.TranslateCoordinates(parent.Toplevel, x, y, out tx, out ty);
                ContextMenuExtensionsMac.ShowContextMenu(parent, tx, ty, this, closeHandler, selectFirstItem);
                return;
            }
                        #endif

            ContextMenuExtensionsGtk.ShowContextMenu(parent, x, y, this, closeHandler, selectFirstItem);
        }
Example #4
0
 internal void Show(Xwt.Widget parent, int x, int y, Action closeHandler, bool selectFirstItem = false)
 {
     if (parent.Surface.NativeWidget is Gtk.Widget widget)
     {
         Show(widget, x, y, closeHandler, selectFirstItem);
         return;
     }
                 #if MAC
     if (parent.Surface.NativeWidget is AppKit.NSView view)
     {
         ContextMenuExtensionsMac.ShowContextMenu((AppKit.NSView)view, x, y, this, closeHandler, selectFirstItem);
         return;
     }
                 #endif
     throw new NotSupportedException();
 }