]> git.saurik.com Git - wxWidgets.git/commitdiff
take images and margins into account when setting column width to wxLIST_AUTOSIZE_USE...
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 7 Mar 2007 22:30:14 +0000 (22:30 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 7 Mar 2007 22:30:14 +0000 (22:30 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44652 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/listctrl.cpp

index 7fd022e786a8f38bf4f353cb0648b524703a74f7..97c78dfd4230919bb2fe8e0760cd615749b679af 100644 (file)
@@ -3704,6 +3704,19 @@ void wxListMainWindow::SetColumnWidth( int col, int width )
     if (width == wxLIST_AUTOSIZE_USEHEADER)
     {
         width = GetTextLength(column->GetText());
+        width += 2*EXTRA_WIDTH;
+
+        // check for column header's image availability
+        const int image = column->GetImage();
+        if ( image != -1 )
+        {
+            if ( m_small_image_list )
+            {
+                int ix = 0, iy = 0;
+                m_small_image_list->GetSize(image, ix, iy);
+                width += ix + HEADER_IMAGE_MARGIN_IN_REPORT_MODE;
+            }
+        }
     }
     else if ( width == wxLIST_AUTOSIZE )
     {