Correct positioning of popup menus relative to mouse pointer

Also simplify the code by using the native method available since OS X 10.6
instead of emulating it.

Closes #15385.
This commit is contained in:
John Roberts 2016-02-01 01:58:17 +01:00 committed by Vadim Zeitlin
parent 023fd88bd7
commit 33d8d4e57c
2 changed files with 2 additions and 12 deletions

View File

@ -209,3 +209,4 @@ wxOSX/Cocoa:
- Don't leave wxSlider labels shown when the slider itself is hidden.
- Don't generate wxEVT_TEXT_ENTER for controls without wxTE_PROCESS_ENTER.
- Implement wxToolTip::SetDelay() (David Vanderson).
- Correct positioning of popup menus relative to mouse pointer (John Roberts).

View File

@ -237,18 +237,7 @@ public :
{
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];
[m_osxMenu popUpMenuPositioningItem:nil atLocation:CGPointMake(x, y) inView:view];
}
virtual void GetMenuBarDimensions(int &x, int &y, int &width, int &height) const wxOVERRIDE