X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/43790a0d0386ba63c967545cea7487df2db6e966..fdd74b41b0a94b214aab4b7b03e75b60e877bd4e:/src/mac/carbon/app.cpp diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index dd66fb10e4..e28fe3d913 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -304,11 +304,37 @@ void wxApp::MacNewFile() void wxApp::MacReopenApp() { - // eventually check for open docs, if none, call MacNewFile - wxTopLevelWindowMac* topLevelWindow = wxDynamicCast(GetTopWindow(), wxTopLevelWindowMac); - - if (topLevelWindow && topLevelWindow->IsIconized()) - topLevelWindow->Iconize(false); + // HIG says : + // if there is no open window -> create a new one + // if all windows are hidden -> show the first + // if some windows are not hidden -> do nothing + + wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst(); + if ( node == NULL ) + { + MacNewFile() ; + } + else + { + wxTopLevelWindow* firstIconized = NULL ; + while (node) + { + wxTopLevelWindow* win = (wxTopLevelWindow*) node->GetData(); + if ( win->IsIconized() == false ) + { + firstIconized = NULL ; + break ; + } + else + { + if ( firstIconized == NULL ) + firstIconized = win ; + } + node = node->GetNext(); + } + if ( firstIconized ) + firstIconized->Iconize( false ) ; + } } //----------------------------------------------------------------------