From 24054c95d8313cc41cb215f34352fc4d206473d1 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 13 Dec 2018 23:42:15 +0100 Subject: [PATCH] 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. --- include/wx/generic/dataview.h | 2 ++ src/generic/datavgen.cpp | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/wx/generic/dataview.h b/include/wx/generic/dataview.h index 815dfcb75b..2ee210ceac 100644 --- a/include/wx/generic/dataview.h +++ b/include/wx/generic/dataview.h @@ -107,6 +107,8 @@ public: return m_flags; } + virtual bool IsResizeable() const wxOVERRIDE; + virtual bool IsSortKey() const wxOVERRIDE { return m_sort; diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index c5aad72db8..5df51937e1 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -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 //-----------------------------------------------------------------------------