X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dbeddfb93d3479d03d8ec4c0121dfbe3bbcc422b..cf516c2bb2b8bc462f6f0cb852fb2fc2d86c9c66:/src/osx/cocoa/menu.mm diff --git a/src/osx/cocoa/menu.mm b/src/osx/cocoa/menu.mm index 3bac02bfad..09a753f6b5 100644 --- a/src/osx/cocoa/menu.mm +++ b/src/osx/cocoa/menu.mm @@ -91,7 +91,8 @@ if ( menuimpl ) { wxMenu* wxpeer = (wxMenu*) menuimpl->GetWXPeer(); - wxpeer->HandleMenuOpened(); + if ( wxpeer ) + wxpeer->HandleMenuOpened(); } } @@ -102,7 +103,8 @@ 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 );