// returns true if it is a virtual list control
bool IsVirtual() const { return (GetWindowStyle() & wxLC_VIRTUAL) != 0; }
+ // refresh items selectively (only useful for virtual list controls)
+ void RefreshItem(long item);
+ void RefreshItems(long itemFrom, long itemTo);
+
// Operations
////////////////////////////////////////////////////////////////////////////
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);
}
}
+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
// ----------------------------------------------------------------------------