MCPcopy Create free account
hub / github.com/BeneficialCode/WinArk / OnSubItemPrePaint

Method OnSubItemPrePaint

WinArk/EtwView.cpp:313–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

311}
312
313DWORD CEtwView::OnSubItemPrePaint(int, LPNMCUSTOMDRAW cd) {
314 auto lcd = (LPNMLVCUSTOMDRAW)cd;
315 auto cm = GetColumnManager(m_List);
316 auto sub = cm->GetRealColumn(lcd->iSubItem);
317 lcd->clrTextBk = CLR_INVALID;
318
319 if ((cm->GetColumn(sub).Flags & ColumnFlags::Numeric) == ColumnFlags::Numeric)
320 ::SelectObject(cd->hdc, (HFONT)GetFrame()->GetMonoFont());
321 else
322 ::SelectObject(cd->hdc, m_hFont);
323
324 int index = (int)cd->dwItemSpec;
325 if (sub == 8 && (m_List.GetItemState(index, LVIS_SELECTED) & LVIS_SELECTED) == 0) {
326 auto& item = m_Events[index];
327 auto start = (size_t)0;
328 auto details = GetEventDetails(item.get());
329 bool bold = false;
330 CDCHandle dc(cd->hdc);
331 std::wstring str;
332 int x = cd->rc.left + 6, y = cd->rc.top, right = cd->rc.right;
333 SIZE size;
334 for (;;) {
335 auto pos = details.find(L";", start);
336 if (pos == std::wstring::npos)
337 break;
338 str = details.substr(start, pos - start);
339
340 auto colon = str.find(L":");
341 dc.SetTextColor(::GetSysColor(COLOR_WINDOWTEXT));
342 dc.GetTextExtent(str.c_str(), (int)colon + 1, &size);
343 if (x + size.cx > right)
344 break;
345
346 dc.TextOutW(x, y, str.c_str(), (int)colon + 1);
347 x += size.cx;
348
349 dc.SetTextColor(RGB(0, 0, 255));
350 dc.GetTextExtent(str.data() + colon + 1, (int)str.size() - (int)colon - 1, &size);
351 if (x + size.cx > right)
352 break;
353 dc.TextOutW(x, y, str.data() + colon + 1, (int)str.size() - (int)colon - 1);
354 x += size.cx + 4;
355
356 start = pos + 1;
357 }
358 return CDRF_SKIPDEFAULT;
359 }
360
361 return CDRF_NEWFONT | CDRF_NOTIFYSUBITEMDRAW;
362}
363
364DWORD CEtwView::OnItemPrePaint(int, LPNMCUSTOMDRAW cd) {
365 m_hFont = (HFONT)::GetCurrentObject(cd->hdc, OBJ_FONT);

Callers

nothing calls this directly

Calls 4

GetMonoFontMethod · 0.80
SetTextColorMethod · 0.80
GetRealColumnMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected