]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/containr.cpp
suppress Sun CC warnings about casting between C++ and extern C function pointers
[wxWidgets.git] / src / common / containr.cpp
index bbc5d48b6186a8c10c545a7b5ccc97d40da628b6..16fda35e9d8632efa52957e0b6fae8744e99cf20 100644 (file)
@@ -75,10 +75,8 @@ bool wxControlContainerBase::ShouldAcceptFocus() const
         wxWindow *child = node->GetData();
         node = node->GetNext();
 
-#ifdef __WXMAC__
-        if ( m_winParent->MacIsWindowScrollbar( child ) )
+        if ( !m_winParent->IsClientAreaChild(child) )
             continue;
-#endif
 
         if ( child->CanAcceptFocus() )
             return false;
@@ -141,12 +139,16 @@ void wxControlContainer::SetLastFocus(wxWindow *win)
     }
 
     // propagate the last focus upwards so that our parent can set focus back
-    // to us if it loses it now and regains later
-    wxWindow *parent = m_winParent->GetParent();
-    if ( parent )
+    // to us if it loses it now and regains later; do *not* do this if we are
+    // a toplevel window (e.g. wxDialog) that has another frame as its parent
+    if ( !m_winParent->IsTopLevel() )
     {
-        wxChildFocusEvent eventFocus(m_winParent);
-        parent->GetEventHandler()->ProcessEvent(eventFocus);
+        wxWindow *parent = m_winParent->GetParent();
+        if ( parent )
+        {
+            wxChildFocusEvent eventFocus(m_winParent);
+            parent->GetEventHandler()->ProcessEvent(eventFocus);
+        }
     }
 }
 
@@ -654,11 +656,10 @@ bool wxSetFocusToChild(wxWindow *win, wxWindow **childLastFocused)
         wxWindow *child = node->GetData();
         node = node->GetNext();
 
-#ifdef __WXMAC__
-        if ( child->GetParent()->MacIsWindowScrollbar( child ) )
+        // skip special windows:
+        if ( !win->IsClientAreaChild(child) )
             continue;
-#endif
-        
+
         if ( child->CanAcceptFocusFromKeyboard() && !child->IsTopLevel() )
         {
 #ifdef __WXMSW__