| 22 | } |
| 23 | |
| 24 | auto 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 | |
| 51 | void TreeViewCtrl::UpdateNodeText(HTREEITEM node, const std::wstring& text) |
| 52 | { |
no outgoing calls
no test coverage detected