]> git.saurik.com Git - wxWidgets.git/commitdiff
Avoid accidental enabling of disabled windows by checking for disabled parent
authorJulian Smart <julian@anthemion.co.uk>
Wed, 17 Jun 2009 16:32:22 +0000 (16:32 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Wed, 17 Jun 2009 16:32:22 +0000 (16:32 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61090 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/window_osx.cpp

index f86cdec15c137156f655222559567e5dd40db02d..1eb9d99b2869d28ff071ecad8af47004e30b0a83 100644 (file)
@@ -405,11 +405,25 @@ bool wxWindowMac::SetBackgroundColour(const wxColour& col )
     return true ;
 }
 
     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 ;
 
 void wxWindowMac::SetFocus()
 {
     if ( !AcceptsFocus() )
             return ;
 
+    if (wxIsWindowOrParentDisabled((wxWindow*) this))
+        return;
+
     wxWindow* former = FindFocus() ;
     if ( former == this )
         return ;
     wxWindow* former = FindFocus() ;
     if ( former == this )
         return ;