]> git.saurik.com Git - wxWidgets.git/commitdiff
No real changes, just refactor wxControlContainer code a little.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 23 Jul 2013 00:43:29 +0000 (00:43 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 23 Jul 2013 00:43:29 +0000 (00:43 +0000)
Extract the call to wxWindow::SetCanFocus() into a separate
UpdateParentCanFocus() function as it can be necessary to do it from places
other than UpdateCanFocusChildren() too.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74582 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/containr.h
src/common/containr.cpp

index 24e404a7f8fe5377887cfd43a4bce0cefa68c541..0549e6be09a0ab2e0bd6e5bb6aceb0d3de83a6b9 100644 (file)
@@ -97,6 +97,9 @@ protected:
     wxWindow *m_winLastFocused;
 
 private:
+    // Update the window status to reflect whether it is getting focus or not.
+    void UpdateParentCanFocus();
+
     // Indicates whether the associated window can ever have focus itself.
     //
     // Usually this is the case, e.g. a wxPanel can be used either as a
index 9de060cddaff1e454cc345cef2395d4343bb9cf4..a194041631a66f2dc03da0b8de97669ecd7233dc 100644 (file)
 // wxControlContainerBase
 // ----------------------------------------------------------------------------
 
+void wxControlContainerBase::UpdateParentCanFocus()
+{
+    // In the ports where it does something non trivial, the parent window
+    // should only be focusable if it doesn't have any focusable children
+    // (e.g. native focus handling in wxGTK totally breaks down otherwise).
+    m_winParent->SetCanFocus(m_acceptsFocusSelf && !m_acceptsFocusChildren);
+}
+
 bool wxControlContainerBase::UpdateCanFocusChildren()
 {
     const bool acceptsFocusChildren = HasAnyFocusableChildren();
@@ -54,10 +62,7 @@ bool wxControlContainerBase::UpdateCanFocusChildren()
     {
         m_acceptsFocusChildren = acceptsFocusChildren;
 
-        // In the ports where it does something non trivial, the parent window
-        // should only be focusable if it doesn't have any focusable children
-        // (e.g. native focus handling in wxGTK totally breaks down otherwise).
-        m_winParent->SetCanFocus(m_acceptsFocusSelf && !m_acceptsFocusChildren);
+        UpdateParentCanFocus();
     }
 
     return m_acceptsFocusChildren;