Resize name column in wxFileListCtrl to be as wide as possible
To avoid truncating the names of the files shown in this column, allocate all the available space to it. Closes #17757.
This commit is contained in:
committed by
Vadim Zeitlin
parent
6293d7427c
commit
0698da3d6b
@@ -160,6 +160,7 @@ public:
|
|||||||
void OnListDeleteAllItems( wxListEvent &event );
|
void OnListDeleteAllItems( wxListEvent &event );
|
||||||
void OnListEndLabelEdit( wxListEvent &event );
|
void OnListEndLabelEdit( wxListEvent &event );
|
||||||
void OnListColClick( wxListEvent &event );
|
void OnListColClick( wxListEvent &event );
|
||||||
|
void OnSize( wxSizeEvent &event );
|
||||||
|
|
||||||
virtual void SortItems(wxFileData::fileListFieldType field, bool forward);
|
virtual void SortItems(wxFileData::fileListFieldType field, bool forward);
|
||||||
bool GetSortDirection() const { return m_sort_forward; }
|
bool GetSortDirection() const { return m_sort_forward; }
|
||||||
|
@@ -364,6 +364,7 @@ wxBEGIN_EVENT_TABLE(wxFileListCtrl,wxListCtrl)
|
|||||||
EVT_LIST_DELETE_ALL_ITEMS(wxID_ANY, wxFileListCtrl::OnListDeleteAllItems)
|
EVT_LIST_DELETE_ALL_ITEMS(wxID_ANY, wxFileListCtrl::OnListDeleteAllItems)
|
||||||
EVT_LIST_END_LABEL_EDIT(wxID_ANY, wxFileListCtrl::OnListEndLabelEdit)
|
EVT_LIST_END_LABEL_EDIT(wxID_ANY, wxFileListCtrl::OnListEndLabelEdit)
|
||||||
EVT_LIST_COL_CLICK(wxID_ANY, wxFileListCtrl::OnListColClick)
|
EVT_LIST_COL_CLICK(wxID_ANY, wxFileListCtrl::OnListColClick)
|
||||||
|
EVT_SIZE (wxFileListCtrl::OnSize)
|
||||||
wxEND_EVENT_TABLE()
|
wxEND_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
@@ -809,6 +810,25 @@ void wxFileListCtrl::OnListColClick( wxListEvent &event )
|
|||||||
SortItems(m_sort_field, m_sort_forward);
|
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)
|
void wxFileListCtrl::SortItems(wxFileData::fileListFieldType field, bool forward)
|
||||||
{
|
{
|
||||||
m_sort_field = field;
|
m_sort_field = field;
|
||||||
|
Reference in New Issue
Block a user