LV_ITEM_NATIVE *m_pItem;
LV_ITEM_NATIVE m_item;
- DECLARE_NO_COPY_CLASS(wxLV_ITEM)
+ wxDECLARE_NO_COPY_CLASS(wxLV_ITEM);
};
///////////////////////////////////////////////////////
delete attr;
}
- DECLARE_NO_COPY_CLASS(wxListItemInternalData)
+ wxDECLARE_NO_COPY_CLASS(wxListItemInternalData);
};
// Get the internal data structure
}
// same thing for CDIS_FOCUS (except simpler as there is only one of them)
+ //
+ // NB: cast is needed to work around the bug in mingw32 headers which don't
+ // have it inside ListView_GetNextItem() itself (unlike SDK ones)
if ( ::GetFocus() == hwndList &&
- ListView_GetNextItem(hwndList, -1, LVNI_FOCUSED) == item )
+ ListView_GetNextItem(
+ hwndList, static_cast<WPARAM>(-1), LVNI_FOCUSED) == item )
{
nmcd.uItemState |= CDIS_FOCUS;
}
// Necessary for drawing hrules and vrules, if specified
void wxListCtrl::OnPaint(wxPaintEvent& event)
{
+ const int itemCount = GetItemCount();
const bool drawHRules = HasFlag(wxLC_HRULES);
const bool drawVRules = HasFlag(wxLC_VRULES);
- if (!InReportView() || !(drawHRules || drawVRules))
+ if (!InReportView() || !(drawHRules || drawVRules) || !itemCount)
{
event.Skip();
return;
wxSize clientSize = GetClientSize();
wxRect itemRect;
- int itemCount = GetItemCount();
- int i;
if (drawHRules)
{
- long top = GetTopItem();
- for (i = top; i < top + GetCountPerPage() + 1; i++)
+ const long top = GetTopItem();
+ for ( int i = top; i < top + GetCountPerPage() + 1; i++ )
{
if (GetItemRect(i, itemRect))
{
{
cy = itemRect.GetBottom();
dc.DrawLine(0, cy, clientSize.x, cy);
+ break;
}
}
}
}
- i = itemCount - 1;
- if (drawVRules && (i > -1))
+
+ if (drawVRules)
{
wxRect firstItemRect;
GetItemRect(0, firstItemRect);
- if (GetItemRect(i, itemRect))
+ if (GetItemRect(itemCount - 1, itemRect))
{
// this is a fix for bug 673394: erase the pixels which we would
// otherwise leave on the screen