From 1833c3d8e44e04f7c50c04fecafe33bdf46590fc Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 23 Sep 2018 15:51:26 +0200 Subject: [PATCH] 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 455a45f5a8925573e0d2355cfb6f7ecedce6fc99 See https://github.com/wxWidgets/wxWidgets/pull/946 --- include/wx/msw/bitmap.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/wx/msw/bitmap.h b/include/wx/msw/bitmap.h index b4ebc8b5c3..eb16dd47e6 100644 --- a/include/wx/msw/bitmap.h +++ b/include/wx/msw/bitmap.h @@ -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);