Only apply the background fix if the toolbar has controls
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@48548 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -265,15 +265,6 @@ bool wxToolBar::MSWCreateToolbar(const wxPoint& pos, const wxSize& size)
|
|||||||
// toolbar-specific post initialisation
|
// toolbar-specific post initialisation
|
||||||
::SendMessage(GetHwnd(), TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
|
::SendMessage(GetHwnd(), TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
|
||||||
|
|
||||||
// The toolbar background for some colour schemes cannot be determined
|
|
||||||
// (for example Silver). So set an explicit background colour to avoid parts of
|
|
||||||
// the background being painted wrongly.
|
|
||||||
|
|
||||||
int majorVersion, minorVersion;
|
|
||||||
wxGetOsVersion(& majorVersion, & minorVersion);
|
|
||||||
if (majorVersion < 6)
|
|
||||||
SetBackgroundColour(GetBackgroundColour());
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -959,6 +950,8 @@ bool wxToolBar::Realize()
|
|||||||
// Deal with the controls finally
|
// Deal with the controls finally
|
||||||
// ------------------------------
|
// ------------------------------
|
||||||
|
|
||||||
|
bool hasControls = false;
|
||||||
|
|
||||||
// adjust the controls size to fit nicely in the toolbar
|
// adjust the controls size to fit nicely in the toolbar
|
||||||
int y = 0;
|
int y = 0;
|
||||||
size_t index = 0;
|
size_t index = 0;
|
||||||
@@ -990,6 +983,8 @@ bool wxToolBar::Realize()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hasControls = true;
|
||||||
|
|
||||||
wxControl *control = tool->GetControl();
|
wxControl *control = tool->GetControl();
|
||||||
wxSize size = control->GetSize();
|
wxSize size = control->GetSize();
|
||||||
|
|
||||||
@@ -1099,6 +1094,13 @@ bool wxToolBar::Realize()
|
|||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
UpdateSize();
|
UpdateSize();
|
||||||
|
|
||||||
|
// Fix a bug on e.g. the Silver theme on WinXP where control backgrounds
|
||||||
|
// are incorrectly drawn, by forcing the background to a specific colour.
|
||||||
|
int majorVersion, minorVersion;
|
||||||
|
wxGetOsVersion(& majorVersion, & minorVersion);
|
||||||
|
if (majorVersion < 6 && hasControls && !!UseBgCol())
|
||||||
|
SetBackgroundColour(GetBackgroundColour());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user