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

@@ -2819,12 +2819,21 @@ wxDataViewBitmapRenderer::wxDataViewBitmapRenderer(const wxString& varianttype,
// simulates a non-existing bitmap.
// In all other cases the method returns 'false'.
bool wxDataViewBitmapRenderer::MacRender()
{
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;
}