+int wxListCtrl::CalcColumnAutoWidth(int col) const
+{
+ int width = 0;
+
+ for ( int i = 0; i < GetItemCount(); i++ )
+ {
+ wxListItem info;
+ info.SetMask(wxLIST_MASK_TEXT | wxLIST_MASK_IMAGE);
+ info.SetId(i);
+ info.SetColumn(col);
+ GetItem(info);
+
+ const wxFont font = info.GetFont();
+
+ int w = 0;
+ if ( font.IsOk() )
+ GetTextExtent(info.GetText(), &w, NULL, NULL, NULL, &font);
+ else
+ GetTextExtent(info.GetText(), &w, NULL);
+
+ w += 2 * kItemPadding;
+
+ if ( info.GetImage() != -1 )
+ w += kIconWidth;
+
+ width = wxMax(width, w);
+ }
+
+ return width;
+}
+