diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 88f6ff1a0d..111d77dd8b 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -1317,7 +1317,11 @@ wxDataViewBitmapRenderer::wxDataViewBitmapRenderer( const wxString &varianttype, bool wxDataViewBitmapRenderer::SetValue( const wxVariant &value ) { - if (value.GetType() == wxT("wxBitmap")) + if (value.GetType() == wxT("wxBitmapBundle")) + { + m_bitmapBundle << value; + } + else if (value.GetType() == wxT("wxBitmap")) { wxBitmap bitmap; bitmap << value; @@ -1346,7 +1350,8 @@ bool wxDataViewBitmapRenderer::IsCompatibleVariantType(const wxString& variantType) const { // We can accept values of any types checked by SetValue(). - return variantType == wxS("wxBitmap") + return variantType == wxS("wxBitmapBundle") + || variantType == wxS("wxBitmap") || variantType == wxS("wxIcon"); } diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp index e537ba10d7..ce309b61d1 100644 --- a/src/gtk/dataview.cpp +++ b/src/gtk/dataview.cpp @@ -2569,22 +2569,32 @@ wxDataViewBitmapRenderer::wxDataViewBitmapRenderer( const wxString &varianttype, bool wxDataViewBitmapRenderer::SetValue( const wxVariant &value ) { - wxBitmap bitmap; - if (value.GetType() == wxS("wxBitmap")) + wxBitmapBundle bitmapBundle; + if (value.GetType() == wxS("wxBitmapBundle")) { + bitmapBundle << value; + } + else if (value.GetType() == wxS("wxBitmap")) + { + wxBitmap bitmap; bitmap << value; + bitmapBundle = wxBitmapBundle(bitmap); } else if (value.GetType() == wxS("wxIcon")) { wxIcon icon; icon << value; - bitmap.CopyFromIcon(icon); + bitmapBundle = wxBitmapBundle(icon); } #ifdef __WXGTK3__ - WX_CELL_RENDERER_PIXBUF(m_renderer)->Set(bitmap); + WX_CELL_RENDERER_PIXBUF(m_renderer)->Set(bitmapBundle); #else - g_object_set(G_OBJECT(m_renderer), "pixbuf", bitmap.IsOk() ? bitmap.GetPixbuf() : NULL, NULL); + g_object_set(G_OBJECT(m_renderer), + "pixbuf", + bitmapBundle.IsOk() ? bitmapBundle.GetBitmap(wxDefaultSize).GetPixbuf() + : NULL, + NULL); #endif return true; @@ -2599,7 +2609,8 @@ bool wxDataViewBitmapRenderer::IsCompatibleVariantType(const wxString& variantType) const { // We can accept values of any types checked by SetValue(). - return variantType == wxS("wxBitmap") + return variantType == wxS("wxBitmapBundle") + || variantType == wxS("wxBitmap") || variantType == wxS("wxIcon"); } diff --git a/src/osx/cocoa/dataview.mm b/src/osx/cocoa/dataview.mm index d2b8f14d11..524c998d08 100644 --- a/src/osx/cocoa/dataview.mm +++ b/src/osx/cocoa/dataview.mm @@ -28,6 +28,9 @@ #include "wx/osx/private/available.h" #include "wx/osx/private/datatransfer.h" #include "wx/osx/cocoa/dataview.h" + +#include "wx/private/bmpbndl.h" + #include "wx/renderer.h" #include "wx/stopwatch.h" #include "wx/dcgraph.h" @@ -2983,6 +2986,13 @@ wxDataViewBitmapRenderer::wxDataViewBitmapRenderer(const wxString& varianttype, bool wxDataViewBitmapRenderer::MacRender() { if (GetValue().GetType() == wxS("wxBitmap")) + { + wxBitmapBundle bundle; + bundle << GetValue(); + if (bundle.IsOk()) + [GetNativeData()->GetItemCell() setObjectValue:wxOSXGetImageFromBundle(bundle)]; + } + else if (GetValue().GetType() == wxS("wxBitmap")) { wxBitmap bitmap; bitmap << GetValue(); @@ -3003,7 +3013,8 @@ bool wxDataViewBitmapRenderer::IsCompatibleVariantType(const wxString& variantType) const { // We can accept values of any types checked by SetValue(). - return variantType == wxS("wxBitmap") + return variantType == wxS("wxBitmapBundle") + || variantType == wxS("wxBitmap") || variantType == wxS("wxIcon"); }