]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/listctrl.cpp
don't hard code the menu bar height under WinCE (closes #10248)
[wxWidgets.git] / src / msw / listctrl.cpp
index 504899d2ee5aef071db9caaf1f9e9e158a2c317f..d7bac52606a3872eae19737a5a3ec3b667de83ac 100644 (file)
@@ -39,6 +39,7 @@
 #endif
 
 #include "wx/imaglist.h"
+#include "wx/vector.h"
 
 #include "wx/msw/private.h"
 
@@ -2485,7 +2486,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
                     if ( lvi.mask & LVIF_TEXT )
                     {
                         wxString text = OnGetItemText(item, lvi.iSubItem);
-                        wxStrlcpy(lvi.pszText, text, lvi.cchTextMax);
+                        wxStrlcpy(lvi.pszText, text.c_str(), lvi.cchTextMax);
                     }
 
                     // see comment at the end of wxListCtrl::GetColumn()
@@ -2908,11 +2909,14 @@ void wxListCtrl::OnPaint(wxPaintEvent& event)
             dc.SetPen(pen);
             dc.SetBrush(*wxTRANSPARENT_BRUSH);
 
-            int numCols = GetColumnCount();
-            int* indexArray = new int[numCols];
-            if ( !ListView_GetColumnOrderArray( GetHwnd(), numCols, indexArray) )
+            const int numCols = GetColumnCount();
+            wxVector<int> indexArray(numCols);
+            if ( !ListView_GetColumnOrderArray(GetHwnd(),
+                                               numCols,
+                                               &indexArray[0]) )
             {
                 wxFAIL_MSG( _T("invalid column index array in OnPaint()") );
+                return;
             }
 
             int x = itemRect.GetX();
@@ -2923,8 +2927,6 @@ void wxListCtrl::OnPaint(wxPaintEvent& event)
                 dc.DrawLine(x-1, firstItemRect.GetY() - gap,
                             x-1, itemRect.GetBottom());
             }
-
-            delete indexArray;
         }
     }
 }