implemented RefreshItem(s) under MSW

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11032 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2001-07-14 02:03:23 +00:00
parent f008af1635
commit a7f560a2cb
2 changed files with 28 additions and 0 deletions

View File

@ -231,6 +231,10 @@ public:
// 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
////////////////////////////////////////////////////////////////////////////

View 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
// ----------------------------------------------------------------------------