Merge branch 'dvc-col-update'

Avoid recursively updating wxHeaderColumns during resize in the generic
wxDataViewCtrl implementation.

See https://github.com/wxWidgets/wxWidgets/pull/1711
This commit is contained in:
Vadim Zeitlin
2020-01-19 17:48:19 +01:00
2 changed files with 23 additions and 3 deletions

View File

@@ -150,6 +150,10 @@ public:
UpdateWidth();
}
// This method is also internal and called when the column is resized by
// user interactively.
void WXOnResize(int width);
int WXGetManuallySetWidth() const { return m_manuallySetWidth; }
private:
@@ -331,7 +335,11 @@ public: // utility functions not part of the API
// update the display after a change to an individual column
void OnColumnChange(unsigned int idx);
// update after the column width changes, also calls OnColumnChange()
// update after the column width changes due to interactive resizing
void OnColumnResized();
// update after the column width changes because of e.g. title or bitmap
// change, invalidates the column best width and calls OnColumnChange()
void OnColumnWidthChange(unsigned int idx);
// update after a change to the number of columns

View File

@@ -204,6 +204,14 @@ int wxDataViewColumn::GetWidth() const
}
}
void wxDataViewColumn::WXOnResize(int width)
{
m_width =
m_manuallySetWidth = width;
m_owner->OnColumnResized();
}
void wxDataViewColumn::UpdateDisplay()
{
if (m_owner)
@@ -401,8 +409,7 @@ private:
wxDataViewCtrl * const owner = GetOwner();
const unsigned col = event.GetColumn();
owner->GetColumn(col)->SetWidth(event.GetWidth());
GetOwner()->OnColumnChange(col);
owner->GetColumn(col)->WXOnResize(event.GetWidth());
}
void OnEndReorder(wxHeaderCtrlEvent& event)
@@ -5455,6 +5462,11 @@ bool wxDataViewCtrl::InsertColumn( unsigned int pos, wxDataViewColumn *col )
return true;
}
void wxDataViewCtrl::OnColumnResized()
{
m_clientArea->UpdateDisplay();
}
void wxDataViewCtrl::OnColumnWidthChange(unsigned int idx)
{
InvalidateColBestWidth(idx);