Fix appearance of tools with alpha bitmaps in wxMSW wxToolBar.

Recent changes broke the handling of tools with alpha bitmaps as drawing them
on the global toolbar bitmap changes its underlying HBITMAP now, but the code
in wxToolBar didn't expect this.

Fix it by updating the HBITMAP used after every DrawBitmap() call, just in
case it changed (it doesn't cost anything to reset it if it did not).

Closes #15876.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75649 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2014-01-19 13:15:57 +00:00
parent 322fc32b82
commit 0824752236

View File

@ -748,8 +748,7 @@ bool wxToolBar::Realize()
dcAllButtons.Clear();
}
m_hBitmap = bitmap.GetHBITMAP();
HBITMAP hBitmap = (HBITMAP)m_hBitmap;
HBITMAP hBitmap = GetHbitmapOf(bitmap);
#ifdef wxREMAP_BUTTON_COLOURS
if ( remapValue == Remap_Bg )
@ -789,6 +788,12 @@ bool wxToolBar::Realize()
// notice the last parameter: do use mask
dcAllButtons.DrawBitmap(bmp, x + xOffset, yOffset, true);
// Handle of the bitmap could have changed inside
// DrawBitmap() call if it had to convert it from DDB to
// DIB internally, as is necessary if the bitmap being
// drawn had alpha channel.
hBitmap = GetHbitmapOf(bitmap);
}
else
{
@ -861,6 +866,8 @@ bool wxToolBar::Realize()
}
#endif // wxREMAP_BUTTON_COLOURS
m_hBitmap = hBitmap;
bool addBitmap = true;
if ( oldToolBarBitmap )