Avoid accidental enabling of disabled windows by checking for disabled parent

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_9_0_BRANCH@61089 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2009-06-17 16:31:53 +00:00
parent f762a296b2
commit bfc5496654

View File

@@ -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 ;