]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't allow user to resize non-resizable columns to best size.
authorVáclav Slavík <vslavik@fastmail.fm>
Mon, 24 Jan 2011 14:35:33 +0000 (14:35 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Mon, 24 Jan 2011 14:35:33 +0000 (14:35 +0000)
Double-clicking columns separator resizes the column to the best width
for its content. This should only be done for resizeable columns,
though.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66740 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/headerctrlcmn.cpp

index 270e124bd2e95787de7be72e27ba590e63765422..4e32625c6b536cda52afe7633119e1ead95fddf4 100644 (file)
@@ -114,8 +114,15 @@ void wxHeaderCtrlBase::SetColumnCount(unsigned int count)
 void wxHeaderCtrlBase::OnSeparatorDClick(wxHeaderCtrlEvent& event)
 {
     const unsigned col = event.GetColumn();
+    const wxHeaderColumn& column = GetColumn(col);
 
-    int w = wxWindowBase::GetTextExtent(GetColumn(col).GetTitle()).x;
+    if ( !column.IsResizeable() )
+    {
+        event.Skip();
+        return;
+    }
+
+    int w = wxWindowBase::GetTextExtent(column.GetTitle()).x;
     w += 4*GetCharWidth(); // add some arbitrary margins around text
 
     if ( !UpdateColumnWidthToFit(col, w) )