]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't clip hidden windows from the staticbox's refresh. Also handle
authorRobin Dunn <robin@alldunn.com>
Fri, 15 Apr 2005 03:00:15 +0000 (03:00 +0000)
committerRobin Dunn <robin@alldunn.com>
Fri, 15 Apr 2005 03:00:15 +0000 (03:00 +0000)
non wxWindows better.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33617 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/statbox.cpp

index 1aa091a7b1e34cd6650803413d5991fe4246f5a5..a73cb5bf68d5e3c6edfbf7726f80743d85e10723 100644 (file)
@@ -258,35 +258,44 @@ WXHRGN wxStaticBox::MSWGetRegionWithoutChildren()
           child;
           child = ::GetWindow(child, GW_HWNDNEXT) )
     {
-        wxWindow *childWindow = wxGetWindowFromHWND((WXHWND) child);
-
-        // can't just test for (this != child) here since if a wxStaticBox
-        // overlaps another wxStaticBox then neither are drawn. The overlapping
-        // region will flicker but we shouldn't have overlapping windows anyway.
-        if ( !childWindow || !wxDynamicCast(childWindow, wxStaticBox) )
+        if ( ! ::IsWindowVisible(child) )
+        {
+            // if the window isn't visible then it doesn't need clipped
+            continue;
+        }
+        
+        LONG style = ::GetWindowLong(child, GWL_STYLE);
+        wxString str(wxGetWindowClass(child));
+        str.UpperCase();
+        if ( str == wxT("BUTTON") && (style & BS_GROUPBOX) != 0 )
         {
-            ::GetWindowRect(child, &rc);
-            if ( ::RectInRegion(hrgn, &rc) )
+            // Don't clip any static boxes, not just this one.  This will
+            // result in flicker in overlapping static boxes, but at least
+            // they will all be drawn correctly and we shouldn't have
+            // overlapping windows anyway.
+            continue;
+        }
+        
+        ::GetWindowRect(child, &rc);
+        if ( ::RectInRegion(hrgn, &rc) )
+        {
+            // need to remove WS_CLIPSIBLINGS from all sibling windows
+            // that are within this staticbox if set
+            if ( style & WS_CLIPSIBLINGS )
             {
-                // need to remove WS_CLIPSIBLINGS from all sibling windows
-                // that are within this staticbox if set
-                LONG style = ::GetWindowLong(child, GWL_STYLE);
-                if ( style & WS_CLIPSIBLINGS )
-                {
-                    style &= ~WS_CLIPSIBLINGS;
-                    ::SetWindowLong(child, GWL_STYLE, style);
-
-                    // MSDN: "If you have changed certain window data using
-                    // SetWindowLong, you must call SetWindowPos to have the
-                    // changes take effect."
-                    ::SetWindowPos(child, NULL, 0, 0, 0, 0,
-                                   SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
-                                   SWP_FRAMECHANGED);
-                }
-
-                AutoHRGN hrgnChild(::CreateRectRgnIndirect(&rc));
-                ::CombineRgn(hrgn, hrgn, hrgnChild, RGN_DIFF);
+                style &= ~WS_CLIPSIBLINGS;
+                ::SetWindowLong(child, GWL_STYLE, style);
+                
+                // MSDN: "If you have changed certain window data using
+                // SetWindowLong, you must call SetWindowPos to have the
+                // changes take effect."
+                ::SetWindowPos(child, NULL, 0, 0, 0, 0,
+                               SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
+                               SWP_FRAMECHANGED);
             }
+
+            AutoHRGN hrgnChild(::CreateRectRgnIndirect(&rc));
+            ::CombineRgn(hrgn, hrgn, hrgnChild, RGN_DIFF);
         }
     }