Don't allow user to resize non-resizable columns to best size.
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
This commit is contained in:
@@ -114,8 +114,15 @@ void wxHeaderCtrlBase::SetColumnCount(unsigned int count)
|
|||||||
void wxHeaderCtrlBase::OnSeparatorDClick(wxHeaderCtrlEvent& event)
|
void wxHeaderCtrlBase::OnSeparatorDClick(wxHeaderCtrlEvent& event)
|
||||||
{
|
{
|
||||||
const unsigned col = event.GetColumn();
|
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
|
w += 4*GetCharWidth(); // add some arbitrary margins around text
|
||||||
|
|
||||||
if ( !UpdateColumnWidthToFit(col, w) )
|
if ( !UpdateColumnWidthToFit(col, w) )
|
||||||
|
Reference in New Issue
Block a user