Make wxCOL_WIDTH_AUTOSIZE work dynamically in generic wxDataViewCtrl

Caching the best column widths broke autosizing behaviour if the column title
was updated after setting the width to wxCOL_WIDTH_AUTOSIZE.

Fix this by invaliding the column cached width if its text changes.
This commit is contained in:
Vadim Zeitlin
2016-03-17 22:34:14 +01:00
parent a9be974d5b
commit db6e1c5b38
2 changed files with 28 additions and 5 deletions

View File

@@ -186,6 +186,15 @@ void wxDataViewColumn::UpdateDisplay()
}
}
void wxDataViewColumn::UpdateWidth()
{
if (m_owner)
{
int idx = m_owner->GetColumnIndex( this );
m_owner->OnColumnWidthChange( idx );
}
}
void wxDataViewColumn::UnsetAsSortKey()
{
m_sort = false;
@@ -4846,6 +4855,13 @@ bool wxDataViewCtrl::InsertColumn( unsigned int pos, wxDataViewColumn *col )
return true;
}
void wxDataViewCtrl::OnColumnWidthChange(unsigned int idx)
{
InvalidateColBestWidth(idx);
OnColumnChange(idx);
}
void wxDataViewCtrl::OnColumnChange(unsigned int idx)
{
if ( m_headerArea )