Prevent the user from resizing the last wxDataViewCtrl column

This is useless as this column will be automatically expanded to fill
all the available space anyhow.

See #18295.
This commit is contained in:
Vadim Zeitlin
2018-12-13 23:42:15 +01:00
parent 841c14c37c
commit 24054c95d8
2 changed files with 13 additions and 0 deletions

View File

@@ -107,6 +107,8 @@ public:
return m_flags;
}
virtual bool IsResizeable() const wxOVERRIDE;
virtual bool IsSortKey() const wxOVERRIDE
{
return m_sort;

View File

@@ -256,6 +256,17 @@ void wxDataViewColumn::SetSortOrder(bool ascending)
m_owner->OnColumnChange(idx);
}
bool wxDataViewColumn::IsResizeable() const
{
// The last column in generic wxDataViewCtrl is never resizeable by the
// user because it's always automatically expanded to consume all the
// available space, so prevent the user from resizing it.
if ( this == GetOwner()->GetColumn(GetOwner()->GetColumnCount() - 1) )
return false;
return wxDataViewColumnBase::IsResizeable();
}
//-----------------------------------------------------------------------------
// wxDataViewHeaderWindow
//-----------------------------------------------------------------------------