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.
This commit is contained in:
Václav Slavík 2016-10-08 14:11:50 +02:00
parent eece498d0a
commit 8ad375592c

View File

@ -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;
}