The existing code for calculation of the column width does not consider hidden columns. The width is always the same, even when I hide all column beside the main column. The width remains always the same. I refer to the inner width and the scrollbars inside the wxTreeListCtrl.
The attached patch fixes this issue. It consists of 2 parts:
Part 1: a change to the function: wxTreeListColumnInfo& GetColumn (int column);
take the following code:
void wxTreeListCtrl::SetColumnShown(int column, bool shown)
wxASSERT_MSG (column != GetMainColumn(), _T("The main column may not be hidden") );
m_header_win->SetColumn (column, GetColumn(column).SetShown(GetMainColumn()==column? true: shown));
GetColumn(column) returns a reference to the column information of the control and therefore SetShown modifies it directly. Calling SetColumn now does not work correctly because the column information has already been updated before the call to SetColumn happens. So I changed GetColumn to return a copy (and not a reference), which can then modified and passed to SetColumn.
Part 2: Extended all calls to column changes to check for visibility for calculation of m_total_col_width.
Beside this the patch contains 2 changes to compile with wxWidgets 2.9 and fixes a little warning (on MSVC).