MCPcopy Create free account
hub / github.com/DiscordMessenger/dm / OnNotifyTree

Method OnNotifyTree

src/windows/ChannelView.cpp:521–566  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

519}
520
521bool ChannelView::OnNotifyTree(LRESULT& out, WPARAM wParam, LPARAM lParam)
522{
523 LPNMHDR nmhdr = (LPNMHDR)lParam;
524
525 switch (nmhdr->code)
526 {
527 case TVN_ITEMEXPANDED:
528 {
529 NMTREEVIEW* nmtv = (NMTREEVIEW*)lParam;
530
531 HTREEITEM hItem = nmtv->itemNew.hItem;
532 if (!hItem) break;
533
534 SetItemIcon(hItem, nmtv->action == TVE_EXPAND ? m_nCategoryCollapseIcon : m_nCategoryExpandIcon);
535 break;
536 }
537 case TVN_SELCHANGED:
538 {
539 NMTREEVIEW* nmtv = (NMTREEVIEW*) lParam;
540
541 HTREEITEM hSelectedItem = nmtv->itemNew.hItem;
542 if (!hSelectedItem) break;
543
544 TVITEM item;
545 item.hItem = hSelectedItem;
546 item.mask = TVIF_PARAM;
547 if (!TreeView_GetItem(m_treeHwnd, &item)) break;
548
549 // look for a channel with that name
550 size_t idx = size_t(item.lParam);
551 if (idx >= m_channels.size())
552 break;
553
554 Snowflake sf = m_channels[item.lParam].m_snowflake;
555
556 if (sf) {
557 m_currentChannel = sf;
558 GetDiscordInstance()->OnSelectChannel(sf);
559 }
560
561 break;
562 }
563 }
564
565 return false;
566}
567
568bool ChannelView::OnNotifyList(LRESULT& out, WPARAM wParam, LPARAM lParam)
569{

Callers 1

WndProcMethod · 0.80

Calls 3

GetDiscordInstanceFunction · 0.85
OnSelectChannelMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected