moved WM_PRINTCLIENT from wxRadioBox to wxStaticBox to allow using it as parent for other controls (modified patch 1188384)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34271 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-05-22 18:29:14 +00:00
parent 06eab9020d
commit 9705fbe904
2 changed files with 22 additions and 21 deletions

View File

@@ -700,28 +700,11 @@ WXHRGN wxRadioBox::MSWGetRegionWithoutChildren()
WXLRESULT WXLRESULT
wxRadioBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) wxRadioBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{ {
if ( nMsg == WM_PRINTCLIENT )
{
// we have to process WM_PRINTCLIENT ourselves as otherwise the radio
// buttons background 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
// colour as with static box, see comments there)
wxBrush brush(GetParent()->GetBackgroundColour());
wxFillRect(GetHwnd(), (HDC)wParam, GetHbrushOf(brush));
}
return 0;
}
// FIXME: Without this, the radiobox corrupts other controls as it moves // FIXME: Without this, the radiobox corrupts other controls as it moves
// in a dynamic layout. Refreshing causes flicker, but it's better than // in a dynamic layout. Refreshing causes flicker, but it's better than
// leaving droppings. Note that for some reason, wxStaticBox doesn't need // leaving droppings. Note that for some reason, wxStaticBox doesn't need
// this (perhaps because it has no real children?) // this (perhaps because it has no real children?)
else if (nMsg == WM_MOVE) if ( nMsg == WM_MOVE )
{ {
WXLRESULT res = wxControl::MSWWindowProc(nMsg, wParam, lParam); WXLRESULT res = wxControl::MSWWindowProc(nMsg, wParam, lParam);
wxRect rect = GetRect(); wxRect rect = GetRect();

View File

@@ -209,6 +209,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); return wxControl::MSWWindowProc(nMsg, wParam, lParam);
} }
@@ -275,7 +293,7 @@ WXHRGN wxStaticBox::MSWGetRegionWithoutChildren()
// if the window isn't visible then it doesn't need clipped // if the window isn't visible then it doesn't need clipped
continue; continue;
} }
LONG style = ::GetWindowLong(child, GWL_STYLE); LONG style = ::GetWindowLong(child, GWL_STYLE);
wxString str(wxGetWindowClass(child)); wxString str(wxGetWindowClass(child));
str.UpperCase(); str.UpperCase();
@@ -287,7 +305,7 @@ WXHRGN wxStaticBox::MSWGetRegionWithoutChildren()
// overlapping windows anyway. // overlapping windows anyway.
continue; continue;
} }
::GetWindowRect(child, &rc); ::GetWindowRect(child, &rc);
if ( ::RectInRegion(hrgn, &rc) ) if ( ::RectInRegion(hrgn, &rc) )
{ {
@@ -297,7 +315,7 @@ WXHRGN wxStaticBox::MSWGetRegionWithoutChildren()
{ {
style &= ~WS_CLIPSIBLINGS; style &= ~WS_CLIPSIBLINGS;
::SetWindowLong(child, GWL_STYLE, style); ::SetWindowLong(child, GWL_STYLE, style);
// MSDN: "If you have changed certain window data using // MSDN: "If you have changed certain window data using
// SetWindowLong, you must call SetWindowPos to have the // SetWindowLong, you must call SetWindowPos to have the
// changes take effect." // changes take effect."