diff --git a/include/wx/generic/filectrlg.h b/include/wx/generic/filectrlg.h index d460fd3e99..c7bb9ddf4a 100644 --- a/include/wx/generic/filectrlg.h +++ b/include/wx/generic/filectrlg.h @@ -160,6 +160,7 @@ public: void OnListDeleteAllItems( wxListEvent &event ); void OnListEndLabelEdit( wxListEvent &event ); void OnListColClick( wxListEvent &event ); + void OnSize( wxSizeEvent &event ); virtual void SortItems(wxFileData::fileListFieldType field, bool forward); bool GetSortDirection() const { return m_sort_forward; } diff --git a/src/generic/filectrlg.cpp b/src/generic/filectrlg.cpp index 4c030d2b14..ab960b4677 100644 --- a/src/generic/filectrlg.cpp +++ b/src/generic/filectrlg.cpp @@ -364,6 +364,7 @@ wxBEGIN_EVENT_TABLE(wxFileListCtrl,wxListCtrl) EVT_LIST_DELETE_ALL_ITEMS(wxID_ANY, wxFileListCtrl::OnListDeleteAllItems) EVT_LIST_END_LABEL_EDIT(wxID_ANY, wxFileListCtrl::OnListEndLabelEdit) EVT_LIST_COL_CLICK(wxID_ANY, wxFileListCtrl::OnListColClick) + EVT_SIZE (wxFileListCtrl::OnSize) wxEND_EVENT_TABLE() @@ -809,6 +810,25 @@ void wxFileListCtrl::OnListColClick( wxListEvent &event ) SortItems(m_sort_field, m_sort_forward); } +void wxFileListCtrl::OnSize( wxSizeEvent &event ) +{ + event.Skip(); + + if ( InReportView() ) + { + // In report mode, set name column to use remaining width. + int newNameWidth = GetClientSize().GetWidth(); + for ( int i = 1; i < GetColumnCount(); i++ ) + { + newNameWidth -= GetColumnWidth(i); + if ( newNameWidth <= 0 ) + return; + } + + SetColumnWidth(0, newNameWidth); + } +} + void wxFileListCtrl::SortItems(wxFileData::fileListFieldType field, bool forward) { m_sort_field = field;