X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d9506e775853406953c4b3ecd6f57b85abdafdfd..b0230a69bcf6db9a18bbdefb0c3027c6a438ed55:/src/generic/panelg.cpp diff --git a/src/generic/panelg.cpp b/src/generic/panelg.cpp index e586d96323..2a91143d97 100644 --- a/src/generic/panelg.cpp +++ b/src/generic/panelg.cpp @@ -121,9 +121,11 @@ void wxPanel::OnSize(wxSizeEvent& WXUNUSED(event)) void wxPanel::OnNavigationKey( wxNavigationKeyEvent& event ) { - // there is not much to do if we have only one child (or not at all) and - // we're not interested in "notebook page change" events here - if ( (GetChildren().GetCount() < 2) || event.IsWindowChange() ) + const wxWindowList& children = GetChildren(); + + // there is not much to do if we don't have children and we're not + // interested in "notebook page change" events here + if ( !children.GetCount() || event.IsWindowChange() ) { wxWindow *parent = GetParent(); if ( !parent || !parent->GetEventHandler()->ProcessEvent(event) ) @@ -144,8 +146,6 @@ void wxPanel::OnNavigationKey( wxNavigationKeyEvent& event ) // the event is propagated downwards if the event emitter was our parent bool goingDown = event.GetEventObject() == GetParent(); - const wxWindowList& children = GetChildren(); - // we should start from the first/last control and not from the one which // had focus the last time if we're propagating the event downwards because // for our parent we look like a single control @@ -227,14 +227,9 @@ void wxPanel::OnNavigationKey( wxNavigationKeyEvent& event ) if ( focussed_child_of_parent->IsTopLevel() ) break; - // is the parent a panel? - wxPanel *panel = wxDynamicCast(parent, wxPanel); - if (panel) - { - event.SetCurrentFocus( focussed_child_of_parent ); - if (parent->GetEventHandler()->ProcessEvent( event )) - return; - } + event.SetCurrentFocus( focussed_child_of_parent ); + if (parent->GetEventHandler()->ProcessEvent( event )) + return; focussed_child_of_parent = parent; } @@ -279,6 +274,7 @@ void wxPanel::OnNavigationKey( wxNavigationKeyEvent& event ) } //else: the child manages its focus itself + event.Skip( FALSE ); return; } @@ -318,10 +314,8 @@ void wxPanel::SetFocus() // think my addition to OnNavigationKey() above takes care of it. // Keeping #ifdef __WXGTK__ for now, but please try removing it and see // what happens. - -#ifdef __WXGTK__ - m_winLastFocused = (wxWindow *)NULL; -#endif // 0 + // + // RR: Removed for now. Let's see what happens.. if ( !SetFocusToChild() ) { @@ -331,7 +325,7 @@ void wxPanel::SetFocus() void wxPanel::OnFocus(wxFocusEvent& event) { - wxLogTrace(_T("focus"), _T("OnFocus on wxPanel 0x%08x."), GetHandle()); + wxLogTrace(_T("focus"), _T("OnFocus on wxPanel 0x%08x, name: %s"), GetHandle(), GetName().c_str() ); // If the panel gets the focus *by way of getting clicked on* // we move the focus to either the last window that had the