X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2c750daecddf6d69364e66e6465113ad9b9454a5..59f76658d3ab2bfd3e645617c7d2b7676ae63e18:/include/wx/containr.h diff --git a/include/wx/containr.h b/include/wx/containr.h index 0549e6be09..277909e559 100644 --- a/include/wx/containr.h +++ b/include/wx/containr.h @@ -4,7 +4,6 @@ // Author: Vadim Zeitlin // Modified by: // Created: 06.08.01 -// RCS-ID: $Id$ // Copyright: (c) 2001, 2011 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -62,18 +61,26 @@ public: // This can be called by the window to indicate that it never wants to have // the focus for itself. - void DisableSelfFocus() { m_acceptsFocusSelf = false; } + void DisableSelfFocus() + { m_acceptsFocusSelf = false; UpdateParentCanFocus(); } + + // This can be called to undo the effect of a previous DisableSelfFocus() + // (otherwise calling it is not necessary as the window does accept focus + // by default). + void EnableSelfFocus() + { m_acceptsFocusSelf = true; UpdateParentCanFocus(); } // should be called from SetFocus(), returns false if we did nothing with // the focus and the default processing should take place bool DoSetFocus(); // returns whether we should accept focus ourselves or not - bool AcceptsFocus() const { return m_acceptsFocusSelf; } + bool AcceptsFocus() const; // Returns whether we or one of our children accepts focus. bool AcceptsFocusRecursively() const - { return m_acceptsFocusSelf || m_acceptsFocusChildren; } + { return AcceptsFocus() || + (m_acceptsFocusChildren && HasAnyChildrenAcceptingFocus()); } // We accept focus from keyboard if we accept it at all. bool AcceptsFocusFromKeyboard() const { return AcceptsFocusRecursively(); } @@ -90,6 +97,10 @@ protected: // return true if we have any children accepting focus bool HasAnyFocusableChildren() const; + // return true if we have any children that do accept focus right now + bool HasAnyChildrenAcceptingFocus() const; + + // the parent window we manage the children for wxWindow *m_winParent;