From: Julian Smart Date: Wed, 17 Jun 2009 16:32:22 +0000 (+0000) Subject: Avoid accidental enabling of disabled windows by checking for disabled parent X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/77a246e1187572d0019dc4403f29027f89928923 Avoid accidental enabling of disabled windows by checking for disabled parent git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61090 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/osx/window_osx.cpp b/src/osx/window_osx.cpp index f86cdec15c..1eb9d99b28 100644 --- a/src/osx/window_osx.cpp +++ b/src/osx/window_osx.cpp @@ -405,11 +405,25 @@ bool wxWindowMac::SetBackgroundColour(const wxColour& col ) return true ; } +static bool wxIsWindowOrParentDisabled(wxWindow* w) +{ + while (w && !w->IsTopLevel()) + { + if (!w->IsEnabled()) + return true; + w = w->GetParent(); + } + return false; +} + void wxWindowMac::SetFocus() { if ( !AcceptsFocus() ) return ; + if (wxIsWindowOrParentDisabled((wxWindow*) this)) + return; + wxWindow* former = FindFocus() ; if ( former == this ) return ;