X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/55d99c7a77789ff4904bf96eddca3715eb5af9b9..4455332266b332ca005c3430234f9a2b372b5764:/src/common/containr.cpp?ds=sidebyside diff --git a/src/common/containr.cpp b/src/common/containr.cpp index cf52acee49..5f251fda7b 100644 --- a/src/common/containr.cpp +++ b/src/common/containr.cpp @@ -49,6 +49,28 @@ wxControlContainer::wxControlContainer(wxWindow *winParent) m_winDefault = NULL; } +bool wxControlContainer::AcceptsFocus() const +{ + // We can accept focus only when at last one child will accept focus + if ( m_winParent->IsShown() && m_winParent->IsEnabled() ) + { + wxWindowList::Node *node = m_winParent->GetChildren().GetFirst(); + while ( node ) + { + wxWindow *child = node->GetData(); + + if ( child->AcceptsFocus() ) + { + return TRUE; + } + + node = node->GetNext(); + } + } + + return FALSE; +} + void wxControlContainer::SetLastFocus(wxWindow *win) { // the panel itself should never get the focus at all but if it does happen @@ -386,3 +408,4 @@ bool wxSetFocusToChild(wxWindow *win, wxWindow **childLastFocused) return FALSE; } +