]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/frame.cpp
added clientcontext variable to Open Transport initialisation
[wxWidgets.git] / src / mac / carbon / frame.cpp
index 16aee93377ffe33d4e7921998f7ba5f44f676c8b..aded221ea5316ca76ef57d180bfbdb0368d23e6a 100644 (file)
@@ -100,6 +100,7 @@ bool wxFrame::Create(wxWindow *parent,
   m_frameToolBar = NULL ;
 #endif
   m_frameStatusBar = NULL;
+  m_winLastFocused = NULL ;
 
   SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
 
@@ -230,7 +231,7 @@ void wxFrame::SetMenuBar(wxMenuBar *menuBar)
   
     m_frameMenuBar = NULL;
     m_frameMenuBar = menuBar;
-    m_frameMenuBar->MacInstallMenuBar() ;
+//    m_frameMenuBar->MacInstallMenuBar() ;
     m_frameMenuBar->Attach(this);
 }
 
@@ -259,10 +260,21 @@ void wxFrame::OnActivate(wxActivateEvent& event)
 {
     if ( !event.GetActive() )
     {
+       // remember the last focused child
+        m_winLastFocused = FindFocus();
+        while ( m_winLastFocused )
+        {
+            if ( GetChildren().Find(m_winLastFocused) )
+                break;
+
+            m_winLastFocused = m_winLastFocused->GetParent();
+        }
+
         event.Skip();
-        return;
     }
-
+       else
+       {
+/*
     for ( wxWindowList::Node *node = GetChildren().GetFirst();
           node;
           node = node->GetNext() )
@@ -273,7 +285,7 @@ void wxFrame::OnActivate(wxActivateEvent& event)
         // restore focus
         wxWindow *child = node->GetData();
 
-        if ( !child->IsTopLevel()
+        if ( !child->IsTopLevel() && child->AcceptsFocus()
 #if wxUSE_TOOLBAR
              && !wxDynamicCast(child, wxToolBar)
 #endif // wxUSE_TOOLBAR
@@ -283,9 +295,17 @@ void wxFrame::OnActivate(wxActivateEvent& event)
            )
         {
             child->SetFocus();
-            return;
+            break;
         }
     }
+   */
+       wxSetFocusToChild(this, &m_winLastFocused);
+
+           if ( m_frameMenuBar != NULL )
+           {
+               m_frameMenuBar->MacInstallMenuBar() ;
+           }
+       }
 }
 
 void wxFrame::DoGetClientSize(int *x, int *y) const