]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/menu.mm
disable new event code unconditionally for now
[wxWidgets.git] / src / osx / cocoa / menu.mm
index 3bac02bfadebe7365963e5d6883493d675160b3d..09a753f6b56e7af3c143bb1977850ce26b7e639b 100644 (file)
@@ -91,7 +91,8 @@
     if ( menuimpl )
     {
         wxMenu* wxpeer = (wxMenu*) menuimpl->GetWXPeer();
-        wxpeer->HandleMenuOpened();
+        if ( wxpeer )
+            wxpeer->HandleMenuOpened();
     }
 }
 
     if ( menuimpl )
     {
         wxMenu* wxpeer = (wxMenu*) menuimpl->GetWXPeer();
-        wxpeer->HandleMenuClosed();
+        if ( wxpeer )
+            wxpeer->HandleMenuClosed();
     }
 }
 
@@ -164,6 +166,24 @@ public :
         [m_osxMenu setTitle:cfText.AsNSString()];
     }
 
+    virtual void PopUp( wxWindow *win, int x, int y )
+    {
+        win->ScreenToClient( &x , &y ) ;
+        NSView *view = win->GetPeer()->GetWXWidget();
+        NSRect frame = [view frame];
+        frame.origin.x = x;
+        frame.origin.y = y;
+        frame.size.width = 1;
+        frame.size.height = 1;
+        NSPopUpButtonCell *popUpButtonCell = [[NSPopUpButtonCell alloc] initTextCell:@"" pullsDown:NO];
+        [popUpButtonCell setAutoenablesItems:NO];
+        [popUpButtonCell setAltersStateOfSelectedItem:NO];
+        [popUpButtonCell setMenu:m_osxMenu];
+        [popUpButtonCell selectItem:nil];
+        [popUpButtonCell performClickWithFrame:frame inView:view];
+        [popUpButtonCell release];
+    }
+
     WXHMENU GetHMenu() { return m_osxMenu; }
 
     static wxMenuImpl* Create( wxMenu* peer, const wxString& title );