]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/containr.cpp
don't assume there's always an active wxEventLoop instance
[wxWidgets.git] / src / common / containr.cpp
index 42aa660a504c1c40728332be3a432b9e670c5db4..3333232ec59e31e61aa101a4d06750037aff463a 100644 (file)
@@ -71,11 +71,9 @@ bool wxControlContainer::AcceptsFocus() const
             node = node->GetNext();
 
 #ifdef __WXMAC__
-            wxScrollBar *sb = wxDynamicCast( child , wxScrollBar ) ;
-            if ( sb == NULL || !m_winParent->MacIsWindowScrollbar( sb ) )
-                hasRealChildren = true ;
-            if ( sb && m_winParent->MacIsWindowScrollbar( sb ) )
+            if ( m_winParent->MacIsWindowScrollbar( child ) )
                 continue;
+            hasRealChildren = true ;
 #endif
             if ( child->AcceptsFocus() )
             {
@@ -309,8 +307,15 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event )
             }
         }
 
-        if ( bookctrl && bookctrl->GetEventHandler()->ProcessEvent(event) )
-            return;
+        if ( bookctrl )
+        {
+            // make sure that we don't bubble up the event again from the book
+            // control resulting in infinite recursion
+            wxNavigationKeyEvent eventCopy(event);
+            eventCopy.SetEventObject(m_winParent);
+            if ( bookctrl->GetEventHandler()->ProcessEvent(eventCopy) )
+                return;
+        }
     }
 
     // there is not much to do if we don't have children and we're not
@@ -641,8 +646,7 @@ bool wxSetFocusToChild(wxWindow *win, wxWindow **childLastFocused)
         node = node->GetNext();
 
 #ifdef __WXMAC__
-        wxScrollBar *sb = wxDynamicCast( child , wxScrollBar ) ;
-        if ( sb && child->GetParent()->MacIsWindowScrollbar( sb ) )
+        if ( child->GetParent()->MacIsWindowScrollbar( child ) )
             continue;
 #endif