X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/036da5e37479c4e2bc3493d3a7a37ac629757515..97c58531bf6912d5b6214b4bd6298466ebcb87ca:/include/wx/containr.h diff --git a/include/wx/containr.h b/include/wx/containr.h index d6df418e25..cd79e5dd5b 100644 --- a/include/wx/containr.h +++ b/include/wx/containr.h @@ -13,10 +13,6 @@ #ifndef _WX_CONTAINR_H_ #define _WX_CONTAINR_H_ -#ifdef __GNUG__ - #pragma interface "containr.h" -#endif - class WXDLLEXPORT wxFocusEvent; class WXDLLEXPORT wxNavigationKeyEvent; class WXDLLEXPORT wxWindow; @@ -65,10 +61,13 @@ public: void HandleOnFocus(wxFocusEvent& event); void HandleOnWindowDestroy(wxWindowBase *child); - // should be called from SetFocus(), returns FALSE if we did nothing with + // should be called from SetFocus(), returns false if we did nothing with // the focus and the default processing should take place bool DoSetFocus(); + // can our child get the focus? + bool AcceptsFocus() const; + // called from OnChildFocus() handler, i.e. when one of our (grand) // children gets the focus void SetLastFocus(wxWindow *win); @@ -89,10 +88,13 @@ protected: // a temporary override of m_winDefault, use the latter if NULL wxWindow *m_winTmpDefault; + // a guard against infinite recursion + bool m_inSetFocus; + DECLARE_NO_COPY_CLASS(wxControlContainer) }; -// this function is for wxWindows internal use only +// this function is for wxWidgets internal use only extern bool wxSetFocusToChild(wxWindow *win, wxWindow **child); // ---------------------------------------------------------------------------- @@ -107,10 +109,12 @@ public: \ void OnFocus(wxFocusEvent& event); \ virtual void OnChildFocus(wxChildFocusEvent& event); \ virtual void SetFocus(); \ + virtual void SetFocusIgnoringChildren(); \ virtual void RemoveChild(wxWindowBase *child); \ virtual wxWindow *GetDefaultItem() const; \ virtual wxWindow *SetDefaultItem(wxWindow *child); \ virtual void SetTmpDefaultItem(wxWindow *win); \ + virtual bool AcceptsFocus() const; \ \ protected: \ wxControlContainer m_container @@ -156,6 +160,11 @@ void classname::SetFocus() \ wxWindow::SetFocus(); \ } \ \ +void classname::SetFocusIgnoringChildren() \ +{ \ + wxWindow::SetFocus(); \ +} \ + \ void classname::OnChildFocus(wxChildFocusEvent& event) \ { \ m_container.SetLastFocus(event.GetWindow()); \ @@ -164,6 +173,10 @@ void classname::OnChildFocus(wxChildFocusEvent& event) \ void classname::OnFocus(wxFocusEvent& event) \ { \ m_container.HandleOnFocus(event); \ +} \ +bool classname::AcceptsFocus() const \ +{ \ + return m_container.AcceptsFocus(); \ }