]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/statbox.cpp
Take src x, y into account when blitting with alpha
[wxWidgets.git] / src / msw / statbox.cpp
index a73cb5bf68d5e3c6edfbf7726f80743d85e10723..88e485e64b57e19ecc41ab01e546dedf816c041c 100644 (file)
@@ -40,6 +40,7 @@
 #include "wx/sysopt.h"
 #include "wx/image.h"
 #include "wx/dcmemory.h"
+#include "wx/sysopt.h"
 
 #include "wx/msw/private.h"
 #include "wx/msw/missing.h"
@@ -123,7 +124,8 @@ bool wxStaticBox::Create(wxWindow *parent,
         return false;
 
 #ifndef __WXWINCE__
-    Connect(wxEVT_PAINT, wxPaintEventHandler(wxStaticBox::OnPaint));
+    if (!wxSystemOptions::IsFalse(wxT("msw.staticbox.optimized-paint")))
+        Connect(wxEVT_PAINT, wxPaintEventHandler(wxStaticBox::OnPaint));
 #endif // !__WXWINCE__
 
     return true;
@@ -143,7 +145,12 @@ WXDWORD wxStaticBox::MSWGetStyle(long style, WXDWORD *exstyle) const
     styleWin &= ~WS_CLIPCHILDREN;
 
     if ( exstyle )
-        *exstyle = 0;
+    {
+        if (wxSystemOptions::IsFalse(wxT("msw.staticbox.optimized-paint")))
+            *exstyle = WS_EX_TRANSPARENT;
+        else
+            *exstyle = 0;
+    }
 
     return styleWin | BS_GROUPBOX;
 }
@@ -267,7 +274,7 @@ WXHRGN wxStaticBox::MSWGetRegionWithoutChildren()
         LONG style = ::GetWindowLong(child, GWL_STYLE);
         wxString str(wxGetWindowClass(child));
         str.UpperCase();
-        if ( str == wxT("BUTTON") && (style & BS_GROUPBOX) != 0 )
+        if ( str == wxT("BUTTON") && (style & BS_GROUPBOX) == BS_GROUPBOX )
         {
             // Don't clip any static boxes, not just this one.  This will
             // result in flicker in overlapping static boxes, but at least
@@ -330,6 +337,15 @@ void wxStaticBox::PaintBackground(wxDC& dc, const RECT& rc)
     ::FillRect(GetHdcOf(dc), &rc, hbr);
 }
 
+void wxStaticBox::PaintForeground(wxDC& dc, const RECT& WXUNUSED(rc))
+{
+    // NB: neither setting the text colour nor transparent background mode
+    //     doesn't change anything: the static box def window proc still
+    //     draws the label in its own colours, so if we want to have control
+    //     over this we really have to draw everything ourselves
+    MSWDefWindowProc(WM_PAINT, (WPARAM)GetHdcOf(dc), 0);
+}
+
 void wxStaticBox::OnPaint(wxPaintEvent& WXUNUSED(event))
 {
     RECT rc;
@@ -341,13 +357,7 @@ void wxStaticBox::OnPaint(wxPaintEvent& WXUNUSED(event))
     memdc.SelectObject(bitmap);
 
     PaintBackground(memdc, rc);
-
-    // NB: neither setting the text colour nor transparent background mode
-    //     doesn't change anything: the static box def window proc still
-    //     draws the label in its own colours, so if we want to have control
-    //     over this we really have to draw everything ourselves
-    MSWDefWindowProc(WM_PAINT, (WPARAM)GetHdcOf(memdc), 0);
-
+    PaintForeground(memdc, rc);
 
     // now only blit the static box border itself, not the interior, to avoid
     // flicker when background is drawn below