+ // post processing
+ // ---------------
+
+ switch ( nmhdr->code )
+ {
+ case LVN_DELETEALLITEMS:
+ // always return TRUE to suppress all additional LVN_DELETEITEM
+ // notifications - this makes deleting all items from a list ctrl
+ // much faster
+ *result = TRUE;
+
+ return TRUE;
+
+ case LVN_ENDLABELEDIT:
+ // logic here is inversed compared to all the other messages
+ *result = event.IsAllowed();
+
+ return TRUE;
+ }
+
+ *result = !event.IsAllowed();
+
+ return TRUE;
+}
+
+#if defined(_WIN32_IE) && _WIN32_IE >= 0x300
+
+WXLPARAM wxListCtrl::OnCustomDraw(WXLPARAM lParam)
+{
+ LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)lParam;
+ NMCUSTOMDRAW& nmcd = lplvcd->nmcd;
+ switch ( nmcd.dwDrawStage )
+ {
+ case CDDS_PREPAINT:
+ // if we've got any items with non standard attributes,
+ // notify us before painting each item
+ //
+ // for virtual controls, always suppose that we have attributes as
+ // there is no way to check for this
+ return IsVirtual() || m_hasAnyAttr ? CDRF_NOTIFYITEMDRAW
+ : CDRF_DODEFAULT;
+
+ 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);
+
+ if ( !attr )
+ {
+ // nothing to do for this item
+ return CDRF_DODEFAULT;
+ }
+
+ HFONT hFont;
+ wxColour colText, colBack;
+ if ( attr->HasFont() )
+ {
+ wxFont font = attr->GetFont();
+ hFont = (HFONT)font.GetResourceHandle();
+ }
+ else
+ {
+ hFont = 0;
+ }
+
+ if ( attr->HasTextColour() )
+ {
+ colText = attr->GetTextColour();
+ }
+ else
+ {
+ colText = GetTextColour();
+ }
+
+ if ( attr->HasBackgroundColour() )
+ {
+ colBack = attr->GetBackgroundColour();
+ }
+ else
+ {
+ colBack = GetBackgroundColour();
+ }
+
+ lplvcd->clrText = wxColourToRGB(colText);
+ lplvcd->clrTextBk = wxColourToRGB(colBack);
+
+ // note that if we wanted to set colours for
+ // individual columns (subitems), we would have
+ // returned CDRF_NOTIFYSUBITEMREDRAW from here
+ if ( hFont )
+ {
+ ::SelectObject(nmcd.hdc, hFont);
+
+ return CDRF_NEWFONT;
+ }
+ }
+ // fall through to return CDRF_DODEFAULT
+
+ default:
+ return CDRF_DODEFAULT;
+ }
+}
+
+#endif // NM_CUSTOMDRAW supported
+
+// Necessary for drawing hrules and vrules, if specified
+void wxListCtrl::OnPaint(wxPaintEvent& event)
+{
+ wxPaintDC dc(this);
+
+ wxControl::OnPaint(event);
+
+ // Reset the device origin since it may have been set
+ dc.SetDeviceOrigin(0, 0);
+
+ bool drawHRules = ((GetWindowStyle() & wxLC_HRULES) != 0);
+ bool drawVRules = ((GetWindowStyle() & wxLC_VRULES) != 0);
+
+ if (!drawHRules && !drawVRules)
+ return;
+ if ((GetWindowStyle() & wxLC_REPORT) == 0)
+ return;
+
+ wxPen pen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID);
+ dc.SetPen(pen);
+ dc.SetBrush(* wxTRANSPARENT_BRUSH);
+
+ wxSize clientSize = GetClientSize();
+ wxRect itemRect;
+ int cy=0;
+
+ int itemCount = GetItemCount();
+ int i;
+ if (drawHRules)