]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/listctrl.cpp
use wxRegEx if available in wxString::Matches
[wxWidgets.git] / src / msw / listctrl.cpp
index ddc46eb6d354b257c819d655aff13a289a7d3272..107623555b3fec9692fdacf03d8cab8db682bead 100644 (file)
@@ -1683,6 +1683,14 @@ WXLPARAM wxListCtrl::OnCustomDraw(WXLPARAM lParam)
         case CDDS_ITEMPREPAINT:
             {
                 size_t item = (size_t)nmcd.dwItemSpec;
+                if ( item >= (size_t)GetItemCount() )
+                {
+                    // we get this message with item == 0 for an empty control,
+                    // we must ignore it as calling OnGetItemAttr() would be
+                    // wrong
+                    return CDRF_DODEFAULT;
+                }
+
                 wxListItemAttr *attr =
                     IsVirtual() ? OnGetItemAttr(item)
                                 : (wxListItemAttr *)m_attrs.Get(item);
@@ -1850,6 +1858,22 @@ void wxListCtrl::SetItemCount(long count)
     }
 }
 
+void wxListCtrl::RefreshItem(long item)
+{
+    if ( !ListView_Update(GetHwnd(), item) )
+    {
+        wxLogLastError(_T("ListView_Update"));
+    }
+}
+
+void wxListCtrl::RefreshItems(long itemFrom, long itemTo)
+{
+    for ( long item = itemFrom; item <= itemTo; item++ )
+    {
+        RefreshItem(item);
+    }
+}
+
 // ----------------------------------------------------------------------------
 // wxListItem
 // ----------------------------------------------------------------------------