MCPcopy Create free account
hub / github.com/NPP-JSONViewer/JSON-Viewer / ShowContextMenu

Method ShowContextMenu

src/NppJsonViewer/JsonViewDlg.cpp:717–740  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

715}
716
717void JsonViewDlg::ShowContextMenu(int x, int y)
718{
719 POINT p {.x = x, .y = y};
720
721 TVHITTESTINFO tvHitInfo {.pt = p, .flags = 0, .hItem = nullptr};
722
723 m_pTreeView->ScreenToTreeView(&(tvHitInfo.pt));
724
725 // Detect if the given position is on the element TVITEM
726 HTREEITEM hTreeItem = m_pTreeView->HitTest(&tvHitInfo);
727
728 if (hTreeItem != nullptr)
729 {
730 // Make item selected
731 m_pTreeView->SelectItem(hTreeItem);
732
733 if (tvHitInfo.flags & (TVHT_ONITEM | TVHT_ONITEMBUTTON))
734 {
735 // Right click
736 UpdateNodePath(hTreeItem);
737 ShowContextMenu(hTreeItem, &p);
738 }
739 }
740}
741
742void JsonViewDlg::ShowContextMenu(HTREEITEM htiNode, LPPOINT lppScreen)
743{

Callers

nothing calls this directly

Calls 7

ScreenToTreeViewMethod · 0.80
HitTestMethod · 0.80
SelectItemMethod · 0.80
GetRootMethod · 0.80
HasChildMethod · 0.80

Tested by

no test coverage detected