GetParent() was always used in test for wxHSCROLL checked in in last commit; use the parent window recursively as intended instead; slightly simplified the code

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33479 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-04-10 17:55:52 +00:00
parent 916f434d88
commit a83b5b74c3

View File

@@ -143,24 +143,23 @@ WXDWORD wxStaticBox::MSWGetStyle(long style, WXDWORD *exstyle) const
if ( exstyle ) if ( exstyle )
{ {
// If any of the ancestors are scrolling windows, style has to be WS_EX_TRANSPARENT *exstyle = 0;
// 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. // If any of the ancestors are scrolling windows, style has to be
wxWindow* p = GetParent(); // WS_EX_TRANSPARENT or the static box won't be painted when the window
bool ancestorScrolls = false; // is scrolled. We try not to do this normally, because we get a lot of
while (p && !p->IsTopLevel()) // flicker.
for ( wxWindow *win = GetParent(); win; win = win->GetParent() )
{ {
if (p->HasFlag(wxVSCROLL) || GetParent()->HasFlag(wxHSCROLL)) if ( win->HasFlag(wxVSCROLL) || win->HasFlag(wxHSCROLL) )
{ {
ancestorScrolls = true; *exstyle = WS_EX_TRANSPARENT;
break; break;
} }
p = p->GetParent();
if ( win->IsTopLevel() )
break;
} }
if (ancestorScrolls)
*exstyle = WS_EX_TRANSPARENT;
else
*exstyle = 0;
} }
return styleWin | BS_GROUPBOX; return styleWin | BS_GROUPBOX;