From 8ad375592c94e8077adf8bc1e5d00d8960885816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Sat, 8 Oct 2016 14:11:50 +0200 Subject: [PATCH] OS X: fixes wxDataViewBitmapRenderer data handling Handle both wxIcon and wxBitmap data, as other ports do, and correctly handle their null values when no bitmap should be shown. --- src/osx/cocoa/dataview.mm | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/osx/cocoa/dataview.mm b/src/osx/cocoa/dataview.mm index a2974367c2..6fd76e988f 100644 --- a/src/osx/cocoa/dataview.mm +++ b/src/osx/cocoa/dataview.mm @@ -2820,11 +2820,20 @@ wxDataViewBitmapRenderer::wxDataViewBitmapRenderer(const wxString& varianttype, // In all other cases the method returns 'false'. bool wxDataViewBitmapRenderer::MacRender() { - wxBitmap bitmap; - - bitmap << GetValue(); - if (bitmap.IsOk()) - [GetNativeData()->GetItemCell() setObjectValue:[[bitmap.GetNSImage() retain] autorelease]]; + if (GetValue().GetType() == wxS("wxBitmap")) + { + wxBitmap bitmap; + bitmap << GetValue(); + if (bitmap.IsOk()) + [GetNativeData()->GetItemCell() setObjectValue:[[bitmap.GetNSImage() retain] autorelease]]; + } + else if (GetValue().GetType() == wxS("wxIcon")) + { + wxIcon icon; + icon << GetValue(); + if (icon.IsOk()) + [GetNativeData()->GetItemCell() setObjectValue:[[icon.GetNSImage() retain] autorelease]]; + } return true; }