From b658d79e44c9f9c6f1daa421f00c8db7739060e2 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 19 Feb 2007 20:35:36 +0000 Subject: [PATCH] Patch #1662729: TreeListCtrl::SetColumnWidth accepting wxLIST_AUTOSIZE and wxLIST_AUTOSIZE_USEHEADER. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@44529 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp b/wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp index 6cded83c61..2f719e27d2 100644 --- a/wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp +++ b/wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp @@ -4681,6 +4681,18 @@ int wxTreeListCtrl::GetColumnCount() const void wxTreeListCtrl::SetColumnWidth(int column, int width) { + if (width == wxLIST_AUTOSIZE_USEHEADER) + { + wxFont font = m_header_win->GetFont(); + m_header_win->GetTextExtent(m_header_win->GetColumnText(column), &width, NULL, NULL, NULL, font.Ok()? &font: NULL); + //search wxTreeListHeaderWindow::OnPaint to understand this: + width += 2*EXTRA_WIDTH + MARGIN; + } + else if (width == wxLIST_AUTOSIZE) + { + width = m_main_win->GetBestColumnWidth(column); + } + m_header_win->SetColumnWidth (column, width); m_header_win->Refresh(); }