Add wxBitmap::operator=(wxImage) to wxMSW to resolve amboguities

Code doing "bitmap = image" compiled in the other ports, but not in
wxMSW with WXWIN_COMPATIBILITY_3_0==1 as there was an ambiguity between
converting wxImage to wxBitmap, as intended, or converting wxImage to
wxCursor and then assigning it to wxBitmap using operator=(wxCursor)
overload.

Resolve this ambiguity by providing operator=() overload taking wxImage
directly.

This fixes widgets sample compilation under MSW after the changes of
455a45f5a8

See https://github.com/wxWidgets/wxWidgets/pull/946
This commit is contained in:
Vadim Zeitlin 2018-09-23 15:51:26 +02:00
parent f58ea62596
commit 1833c3d8e4

View File

@ -103,6 +103,13 @@ public:
(void)CopyFromCursor(cursor, wxBitmapTransparency_Auto);
}
#if wxUSE_IMAGE
wxBitmap& operator=(const wxImage& image)
{
return *this = wxBitmap(image);
}
#endif // wxUSE_IMAGE
wxBitmap& operator=(const wxIcon& icon)
{
(void)CopyFromIcon(icon);