Fixing Popup Menu with Submenus
Submenus have to turn off autoenablind as well, see #549 and https://trac.wxwidgets.org/ticket/17459
This commit is contained in:
parent
37191f6f16
commit
102edb544d
@ -241,7 +241,7 @@ public :
|
||||
NSView *view = win->GetPeer()->GetWXWidget();
|
||||
// Turn off auto-enable; it caused popup menus inside of dialogs
|
||||
// to be entirely disabled.
|
||||
[m_osxMenu setAutoenablesItems:NO];
|
||||
DisableAutoEnable();
|
||||
[m_osxMenu popUpMenuPositioningItem:nil atLocation:NSMakePoint(x, y) inView:view];
|
||||
}
|
||||
|
||||
@ -254,6 +254,23 @@ public :
|
||||
width = r.size.width;
|
||||
}
|
||||
|
||||
void DisableAutoEnable()
|
||||
{
|
||||
[m_osxMenu setAutoenablesItems:NO];
|
||||
|
||||
wxMenu* menu = GetWXPeer();
|
||||
for ( auto item : menu->GetMenuItems() )
|
||||
{
|
||||
if ( item->IsSubMenu() )
|
||||
{
|
||||
wxMenuCocoaImpl* subimpl = dynamic_cast<wxMenuCocoaImpl*>(item->GetSubMenu()->GetPeer());
|
||||
if ( subimpl )
|
||||
subimpl->DisableAutoEnable();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WXHMENU GetHMenu() wxOVERRIDE { return m_osxMenu; }
|
||||
|
||||
static wxMenuImpl* Create( wxMenu* peer, const wxString& title );
|
||||
|
Loading…
Reference in New Issue
Block a user