]> git.saurik.com Git - wxWidgets.git/commitdiff
If -1 is passed to InsertItem for the imageIndex then don't set wxLIST_MASK_IMAGE
authorRobin Dunn <robin@alldunn.com>
Tue, 2 Aug 2011 20:23:42 +0000 (20:23 +0000)
committerRobin Dunn <robin@alldunn.com>
Tue, 2 Aug 2011 20:23:42 +0000 (20:23 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68495 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/listctrl.cpp
src/msw/listctrl.cpp

index bcf799a00be753f2bc56d1d6ab03cf6623f32316..09354910b6d046f46a13eb0cc50d23b67e21fcf3 100644 (file)
@@ -4027,7 +4027,7 @@ void wxListMainWindow::InsertItem( wxListItem &item )
     wxListLineData *line = new wxListLineData(this);
 
     line->SetItem( item.m_col, item );
-    if ( item.m_mask & wxLIST_MASK_IMAGE )
+    if ( item.m_mask & wxLIST_MASK_IMAGE && item.GetImage() != -1)
     {
         // Reset the buffered height if it's not big enough for the new image.
         if (m_small_image_list)
@@ -4866,7 +4866,9 @@ long wxGenericListCtrl::InsertItem( long index, const wxString &label, int image
     wxListItem info;
     info.m_text = label;
     info.m_image = imageIndex;
-    info.m_mask = wxLIST_MASK_TEXT | wxLIST_MASK_IMAGE;
+    info.m_mask = wxLIST_MASK_TEXT;
+    if (imageIndex > -1)
+        info.m_mask |= wxLIST_MASK_IMAGE;
     info.m_itemId = index;
     return InsertItem( info );
 }
index 9d49a3be1031cf23610edcbe74f15372f8ca9b0c..1e1c9a722c4ccf43c34192c48d0190df29ef7ccc 100644 (file)
@@ -1727,7 +1727,9 @@ long wxListCtrl::InsertItem(long index, const wxString& label, int imageIndex)
     wxListItem info;
     info.m_image = imageIndex;
     info.m_text = label;
-    info.m_mask = wxLIST_MASK_IMAGE | wxLIST_MASK_TEXT;
+    info.m_mask = wxLIST_MASK_TEXT;
+    if (imageIndex > -1)
+        info.m_mask |= wxLIST_MASK_IMAGE;
     info.m_itemId = index;
     return InsertItem(info);
 }