X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2b5f62a0b2db198609b45dec622a018dae37008e..ef5df12bdf587773bcd0ac0e521af9fc9013a0c9:/src/common/containr.cpp?ds=inline diff --git a/src/common/containr.cpp b/src/common/containr.cpp index 5b5df9ea92..5f251fda7b 100644 --- a/src/common/containr.cpp +++ b/src/common/containr.cpp @@ -6,7 +6,7 @@ // Created: 06.08.01 // RCS-ID: $Id$ // Copyright: (c) 2001 Vadim Zeitlin -// License: wxWindows license +// License: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -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; } +