]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp
Use our own getters and properties for wxVisualAttributes
[wxWidgets.git] / wxPython / contrib / gizmos / wxCode / src / treelistctrl.cpp
index 6cded83c615137ae04c201ef5328e6e5dd0cb421..1fbe0b94e9b02a70e5a00971c90c6d7362290ca1 100644 (file)
@@ -1336,7 +1336,7 @@ int wxTreeListHeaderWindow::XToCol(int x)
 
 void wxTreeListHeaderWindow::RefreshColLabel(int col)
 {
-    if ( col > GetColumnCount() )
+    if ( col >= GetColumnCount() )
         return;
     
     int x = 0;
@@ -3600,7 +3600,7 @@ void wxTreeListMainWindow::OnChar (wxKeyEvent &event) {
         default:
             if (event.GetKeyCode() >= (int)' ') {
                 if (!m_findTimer->IsRunning()) m_findStr.Clear();
-                m_findStr.Append (event.GetKeyCode());
+                m_findStr.Append ((char)event.GetKeyCode());
                 m_findTimer->Start (FIND_TIMER_TICKS, wxTIMER_ONE_SHOT);
                 wxTreeItemId prev = m_curItem? (wxTreeItemId*)m_curItem: (wxTreeItemId*)NULL;
                 while (true) {
@@ -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();
 }