]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/statbox.cpp
CYGWIN socket compilation fixes
[wxWidgets.git] / src / msw / statbox.cpp
index beb279730064a0e963a67885039bc9cbd57b8331..e23f78abe18a89c67d42a4879086d2a993467baf 100644 (file)
@@ -42,6 +42,7 @@
 #include "wx/dcmemory.h"
 
 #include "wx/msw/private.h"
+#include "wx/msw/missing.h"
 
 // ----------------------------------------------------------------------------
 // wxWin macros
@@ -142,8 +143,26 @@ WXDWORD wxStaticBox::MSWGetStyle(long style, WXDWORD *exstyle) const
     styleWin &= ~WS_CLIPCHILDREN;
 
     if ( exstyle )
+    {
         *exstyle = 0;
 
+        // If any of the ancestors are scrolling windows, style has to be
+        // WS_EX_TRANSPARENT or the static box won't be painted when the window
+        // is scrolled. We try not to do this normally, because we get a lot of
+        // flicker.
+        for ( wxWindow *win = GetParent(); win; win = win->GetParent() )
+        {
+            if ( win->HasFlag(wxVSCROLL) || win->HasFlag(wxHSCROLL) )
+            {
+                *exstyle = WS_EX_TRANSPARENT;
+                break;
+            }
+
+            if ( win->IsTopLevel() )
+                break;
+        }
+    }
+
     return styleWin | BS_GROUPBOX;
 }
 
@@ -306,7 +325,7 @@ void wxStaticBox::PaintBackground(wxDC& dc, const RECT& rc)
     //  3. this is backwards compatible behaviour and some people rely on it,
     //     see http://groups.google.com/groups?selm=4252E932.3080801%40able.es
     wxWindow *parent = GetParent();
-    HBRUSH hbr = (HBRUSH)parent->MSWGetBgBrush(dc.GetHDC(), this);
+    HBRUSH hbr = (HBRUSH)parent->MSWGetBgBrush(dc.GetHDC(), GetHWND());
 
     // if there is no special brush for painting this control, just use the
     // solid background colour