-
- case NM_RCLICK:
- /* TECH NOTE: NM_RCLICK isn't really good enough here. We want to
- subclass and check for the actual WM_RBUTTONDOWN message, because
- NM_RCLICK waits for the WM_RBUTTONUP message as well before firing off.
- We want to have notify events for both down -and- up. */
- {
- // if the user processes it in wxEVT_COMMAND_RIGHT_CLICK(), don't do
- // anything else
- if ( wxControl::MSWOnNotify(idCtrl, lParam, result) ) {
- return TRUE;
- }
-
- // else translate it into wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK event
- LVHITTESTINFO lvhti;
-#ifdef __GNUWIN32__
- memset(&lvhti,0,sizeof(LVHITTESTINFO));
-#else
- ZeroMemory(&lvhti, sizeof(LVHITTESTINFO)); // must set all fields to 0
-#endif
- ::GetCursorPos(&(lvhti.pt));
- ::ScreenToClient(GetHwnd(),&(lvhti.pt));
- if(ListView_HitTest(GetHwnd(),&lvhti)!=-1) {
- if(lvhti.flags & LVHT_ONITEM) {
- eventType = wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK;
- event.m_itemIndex = lvhti.iItem;
- }
- }
- }
- break;
-
- /*
- case NM_MCLICK: // ***** THERE IS NO NM_MCLICK. Subclass anyone? ******
- {
- // if the user processes it in wxEVT_COMMAND_MIDDLE_CLICK(), don't do
- // anything else
- if ( wxControl::MSWOnNotify(idCtrl, lParam, result) )
- {
- return TRUE;
- }
-
- // else translate it into wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK event
- eventType = wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK;
- NMITEMACTIVATE* hdr = (NMITEMACTIVATE*)lParam;
- event.m_itemIndex = hdr->iItem;
- }
- break;
- */
-
- case LVN_SETDISPINFO:
+
+ case NM_RCLICK:
+ /* TECH NOTE: NM_RCLICK isn't really good enough here. We want to
+ subclass and check for the actual WM_RBUTTONDOWN message,
+ because NM_RCLICK waits for the WM_RBUTTONUP message as well
+ before firing off. We want to have notify events for both down
+ -and- up. */
+ {
+ // if the user processes it in wxEVT_COMMAND_RIGHT_CLICK(),
+ // don't do anything else
+ if ( wxControl::MSWOnNotify(idCtrl, lParam, result) )
+ {
+ return TRUE;
+ }
+
+ // else translate it into wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK event
+ LV_HITTESTINFO lvhti;
+ wxZeroMemory(lvhti);
+
+ ::GetCursorPos(&(lvhti.pt));
+ ::ScreenToClient(GetHwnd(),&(lvhti.pt));
+ if ( ListView_HitTest(GetHwnd(),&lvhti) != -1 )
+ {
+ if ( lvhti.flags & LVHT_ONITEM )
+ {
+ eventType = wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK;
+ event.m_itemIndex = lvhti.iItem;
+ event.m_pointDrag.x = lvhti.pt.x;
+ event.m_pointDrag.y = lvhti.pt.y;
+ }
+ }
+ }
+ break;
+
+#if 0
+ case NM_MCLICK: // ***** THERE IS NO NM_MCLICK. Subclass anyone? ******
+ {
+ // if the user processes it in wxEVT_COMMAND_MIDDLE_CLICK(), don't do
+ // anything else
+ if ( wxControl::MSWOnNotify(idCtrl, lParam, result) )
+ {
+ return TRUE;
+ }
+
+ // else translate it into wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK event
+ eventType = wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK;
+ NMITEMACTIVATE* hdr = (NMITEMACTIVATE*)lParam;
+ event.m_itemIndex = hdr->iItem;
+ }
+ break;
+#endif // 0
+
+#if defined(_WIN32_IE) && _WIN32_IE >= 0x300
+ case NM_CUSTOMDRAW:
+ {
+ 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
+ *result = m_hasAnyAttr ? CDRF_NOTIFYITEMDRAW
+ : CDRF_DODEFAULT;
+ return TRUE;
+
+ case CDDS_ITEMPREPAINT:
+ {
+ wxListItemAttr *attr =
+ (wxListItemAttr *)m_attrs.Get(nmcd.dwItemSpec);
+
+ 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();
+ }
+
+ // 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);
+
+ *result = CDRF_NEWFONT;
+ }
+ else
+ {
+ *result = CDRF_DODEFAULT;
+ }
+
+ lplvcd->clrText = wxColourToRGB(colText);
+ lplvcd->clrTextBk = wxColourToRGB(colBack);
+
+ return TRUE;
+ }
+
+ default:
+ *result = CDRF_DODEFAULT;
+ return TRUE;
+ }
+ }
+// break; // can never be reached
+#endif // _WIN32_IE >= 0x300
+
+ case LVN_GETDISPINFO:
+ if ( IsVirtual() )