]> git.saurik.com Git - wxWidgets.git/commitdiff
Update line height in generic wxListCtrl to match images height.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 26 Apr 2011 22:57:12 +0000 (22:57 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 26 Apr 2011 22:57:12 +0000 (22:57 +0000)
The height of the items of the generic wxListCtrl remained too small if an
image of a greater than standard size was used.

Fix this by forcing the line height recalculation when adding an item using an
image higher than the current line height.

Closes #12806.

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

src/generic/listctrl.cpp

index 0c877f3b0ccd3c100d538c9054000e6f317014d5..bcf799a00be753f2bc56d1d6ab03cf6623f32316 100644 (file)
@@ -4027,6 +4027,19 @@ void wxListMainWindow::InsertItem( wxListItem &item )
     wxListLineData *line = new wxListLineData(this);
 
     line->SetItem( item.m_col, item );
+    if ( item.m_mask & wxLIST_MASK_IMAGE )
+    {
+        // Reset the buffered height if it's not big enough for the new image.
+        if (m_small_image_list)
+        {
+            int imageWidth, imageHeight;
+            m_small_image_list->GetSize(item.GetImage(),
+                                        imageWidth, imageHeight);
+
+            if ( imageHeight > m_lineHeight )
+                m_lineHeight = 0;
+        }
+    }
 
     m_lines.Insert( line, id );