]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't assert if no icon is specified for a wxDataViewCtrl item.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 13 May 2012 21:37:16 +0000 (21:37 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 13 May 2012 21:37:16 +0000 (21:37 +0000)
An item in a column using wxDataViewIconTextRenderer might not have any valid
icon associated with it, don't assert in case it doesn't in the native GTK
version.

Notice that the generic wxDataViewCtrl implementation already supports this
but not perfectly: no space is reserved for the icon in the images without
one, so giving the image to only some of them looks ugly. The GTK version
aligns both the items with and without icon properly and simply leaves the
image part blank and it would be better to modify the generic version to do
the same thing in the future.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71427 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/dataview.cpp

index 31fa32fbe1bf5b5f21a7281c91344c63f8072aef..01fad1c67ce1fc1aa09760aa2d2ee666eabc10df 100644 (file)
@@ -2792,7 +2792,9 @@ bool wxDataViewIconTextRenderer::SetValue( const wxVariant &value )
     m_value << value;
 
     SetTextValue(m_value.GetText());
-    SetPixbufProp(m_rendererIcon, m_value.GetIcon().GetPixbuf());
+
+    const wxIcon& icon = m_value.GetIcon();
+    SetPixbufProp(m_rendererIcon, icon.IsOk() ? icon.GetPixbuf() : NULL);
 
     return true;
 }