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

Method InsertNode

src/NppJsonViewer/TreeViewCtrl.cpp:24–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22}
23
24auto TreeViewCtrl::InsertNode(const std::wstring& text, LPARAM lparam, HTREEITEM parentNode) -> HTREEITEM
25{
26 TV_INSERTSTRUCT tvInsert {};
27
28 if (parentNode == TVI_ROOT)
29 {
30 tvInsert.hParent = NULL;
31 tvInsert.hInsertAfter = TVI_ROOT;
32 }
33 else
34 {
35 tvInsert.hParent = parentNode;
36 tvInsert.hInsertAfter = TVI_LAST;
37 }
38
39 if (text.length() + 1 > m_nMaxNodeTextLength)
40 m_nMaxNodeTextLength = text.length() + 1;
41
42 tvInsert.item.mask = TVIF_HANDLE | TVIF_TEXT | TVIF_PARAM;
43 tvInsert.item.pszText = const_cast<LPTSTR>(text.c_str());
44 tvInsert.item.lParam = lparam;
45
46 HTREEITEM item = reinterpret_cast<HTREEITEM>(SendDlgItemMessage(m_hParent, m_nCtrlID, TVM_INSERTITEM, 0, reinterpret_cast<LPARAM>(&tvInsert)));
47
48 return item;
49}
50
51void TreeViewCtrl::UpdateNodeText(HTREEITEM node, const std::wstring& text)
52{

Callers 2

DrawJsonTreeMethod · 0.80
InsertToTreeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected