]> git.saurik.com Git - wxWidgets.git/commitdiff
reopen app according to HIG
authorStefan Csomor <csomor@advancedconcepts.ch>
Sat, 29 May 2004 14:56:49 +0000 (14:56 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Sat, 29 May 2004 14:56:49 +0000 (14:56 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27502 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/app.cpp

index dd66fb10e44544197e576fd15e96616a29e3ca3e..47af6e5cd115e8d4e8c7e781fb74beafbf56cad8 100644 (file)
@@ -304,11 +304,38 @@ 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* win = NULL ;
+        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 ) ;
+    }
 }
 
 //----------------------------------------------------------------------