]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/listctrl.cpp
compilation fixes for wxUSE_TOOLBAR under MSW
[wxWidgets.git] / src / generic / listctrl.cpp
index 79c094ccf7bbcbce6a5f928bb3f70b865cda3cf7..e643ee26b5afe98583025eb530acd53738495608 100644 (file)
@@ -435,7 +435,7 @@ protected:
     wxCursor          *m_resizeCursor;
     bool               m_isDragging;
 
-    // column being resized
+    // column being resized or -1
     int m_column;
 
     // divider line position in logical (unscrolled) coords
@@ -2022,8 +2022,9 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event )
         int xpos = 0;
 
         // find the column where this event occured
-        int countCol = m_owner->GetColumnCount();
-        for (int col = 0; col < countCol; col++)
+        int col,
+            countCol = m_owner->GetColumnCount();
+        for (col = 0; col < countCol; col++)
         {
             xpos += m_owner->GetColumnWidth( col );
             m_column = col;
@@ -2044,6 +2045,9 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event )
             m_minX = xpos;
         }
 
+        if ( col == countCol )
+            m_column = -1;
+
         if (event.LeftDown() || event.RightUp())
         {
             if (hit_border && event.LeftDown())
@@ -4163,6 +4167,9 @@ void wxListMainWindow::DeleteColumn( int col )
 
     m_dirty = TRUE;
     m_columns.DeleteNode( node );
+
+    // invalidate it as it has to be recalculated
+    m_headerWidth = 0;
 }
 
 void wxListMainWindow::DoDeleteAllItems()
@@ -4357,6 +4364,9 @@ void wxListMainWindow::InsertColumn( long col, wxListItem &item )
         {
             m_columns.Append( column );
         }
+
+        // invalidate it as it has to be recalculated
+        m_headerWidth = 0;
     }
 }