X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/72a55896e5bdf4ac03006fd280194afa1fd88cc1..2fb18bf45bcf391a8eb973886072dc67893e9bbe:/src/msw/statbox.cpp?ds=inline diff --git a/src/msw/statbox.cpp b/src/msw/statbox.cpp index 04d9874b6b..829976e363 100644 --- a/src/msw/statbox.cpp +++ b/src/msw/statbox.cpp @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "statbox.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -209,6 +205,24 @@ WXLRESULT wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPar } } + if ( nMsg == WM_PRINTCLIENT ) + { + // we have to process WM_PRINTCLIENT ourselves as otherwise child + // windows' background (eg buttons in radio box) would never be drawn + // unless we have a parent with non default background + + // so check first if we have one + if ( !HandlePrintClient((WXHDC)wParam) ) + { + // no, we don't, erase the background ourselves + // (don't use our own) - see PaintBackground for explanation + wxBrush brush(GetParent()->GetBackgroundColour()); + wxFillRect(GetHwnd(), (HDC)wParam, GetHbrushOf(brush)); + } + + return 0; + } + return wxControl::MSWWindowProc(nMsg, wParam, lParam); } @@ -264,6 +278,7 @@ WXHRGN wxStaticBox::MSWGetRegionWithoutChildren() RECT rc; ::GetWindowRect(GetHwnd(), &rc); HRGN hrgn = ::CreateRectRgn(rc.left, rc.top, rc.right + 1, rc.bottom + 1); + bool foundThis = false; // iterate over all child windows (not just wxWindows but all windows) for ( HWND child = ::GetWindow(GetHwndOf(GetParent()), GW_CHILD); @@ -275,19 +290,26 @@ WXHRGN wxStaticBox::MSWGetRegionWithoutChildren() // 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) == BS_GROUPBOX ) { - // 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; + if ( child == GetHwnd() ) + foundThis = true; + + // Any static boxes below this one in the Z-order can't be clipped + // since if we have the case where a static box with a low Z-order + // is nested inside another static box with a high Z-order then the + // nested static box would be painted over. Doing it this way + // unfortunately results in flicker if the Z-order of nested static + // boxes is not inside (lowest) to outside (highest) but at least + // they are still shown. + if ( foundThis ) + continue; } - + ::GetWindowRect(child, &rc); if ( ::RectInRegion(hrgn, &rc) ) { @@ -297,7 +319,7 @@ WXHRGN wxStaticBox::MSWGetRegionWithoutChildren() { 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."