Display the global menu bar if the last TLW is hidden in wxOSX

Hiding the last TLW should be enough to show the global menu bar, but this
only happened if it was closed and not just hidden.

Closes #16201.
This commit is contained in:
Joost Nieuwenhuijse
2016-02-21 19:55:46 +01:00
committed by Vadim Zeitlin
parent ace212a311
commit eb8f6e0173
4 changed files with 25 additions and 5 deletions

View File

@@ -51,6 +51,7 @@ public:
virtual wxPoint GetClientAreaOrigin() const wxOVERRIDE; virtual wxPoint GetClientAreaOrigin() const wxOVERRIDE;
// override some more virtuals // override some more virtuals
virtual bool Show(bool show = true) wxOVERRIDE;
virtual bool Enable(bool enable = true) wxOVERRIDE; virtual bool Enable(bool enable = true) wxOVERRIDE;
// event handlers // event handlers

View File

@@ -152,6 +152,7 @@ public:
static void SetAutoWindowMenu( bool enable ) { s_macAutoWindowMenu = enable ; } static void SetAutoWindowMenu( bool enable ) { s_macAutoWindowMenu = enable ; }
static bool GetAutoWindowMenu() { return s_macAutoWindowMenu ; } static bool GetAutoWindowMenu() { return s_macAutoWindowMenu ; }
void MacUninstallMenuBar() ;
void MacInstallMenuBar() ; void MacInstallMenuBar() ;
static wxMenuBar* MacGetInstalledMenuBar() { return s_macInstalledMenuBar ; } static wxMenuBar* MacGetInstalledMenuBar() { return s_macInstalledMenuBar ; }
static void MacSetCommonMenuBar(wxMenuBar* menubar) { s_macCommonMenuBar=menubar; } static void MacSetCommonMenuBar(wxMenuBar* menubar) { s_macCommonMenuBar=menubar; }

View File

@@ -412,4 +412,17 @@ void wxFrame::PositionBars()
#endif #endif
} }
bool wxFrame::Show(bool show)
{
if ( !show )
{
#if wxUSE_MENUS
if (m_frameMenuBar != NULL)
{
m_frameMenuBar->MacUninstallMenuBar();
}
#endif
}
return wxFrameBase::Show(show);
}

View File

@@ -633,11 +633,7 @@ wxMenuBar::~wxMenuBar()
if (s_macCommonMenuBar == this) if (s_macCommonMenuBar == this)
s_macCommonMenuBar = NULL; s_macCommonMenuBar = NULL;
if (s_macInstalledMenuBar == this) MacUninstallMenuBar();
{
gs_emptyMenuBar->GetPeer()->MakeRoot();
s_macInstalledMenuBar = NULL;
}
wxDELETE( m_rootMenu ); wxDELETE( m_rootMenu );
// apple menu is a submenu, therefore we don't have to delete it // apple menu is a submenu, therefore we don't have to delete it
m_appleMenu = NULL; m_appleMenu = NULL;
@@ -652,6 +648,15 @@ void wxMenuBar::Refresh(bool WXUNUSED(eraseBackground), const wxRect *WXUNUSED(r
wxCHECK_RET( IsAttached(), wxT("can't refresh unatteched menubar") ); wxCHECK_RET( IsAttached(), wxT("can't refresh unatteched menubar") );
} }
void wxMenuBar::MacUninstallMenuBar()
{
if (s_macInstalledMenuBar == this)
{
gs_emptyMenuBar->GetPeer()->MakeRoot();
s_macInstalledMenuBar = NULL;
}
}
void wxMenuBar::MacInstallMenuBar() void wxMenuBar::MacInstallMenuBar()
{ {
if ( s_macInstalledMenuBar == this ) if ( s_macInstalledMenuBar == this )