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

Class TreeViewCtrl

src/NppJsonViewer/TreeViewCtrl.h:10–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#include "JsonNode.h"
9
10class TreeViewCtrl
11{
12 HWND m_hTree = nullptr;
13 HWND m_hParent = nullptr;
14 int m_nCtrlID = 0;
15 size_t m_nMaxNodeTextLength = 0;
16
17public:
18 TreeViewCtrl() = default;
19 ~TreeViewCtrl() = default;
20
21 void OnInit(HWND hParent, int ctrlID);
22
23 HWND GetTreeViewHandle() const
24 {
25 return m_hTree;
26 }
27
28 auto InitTree() -> HTREEITEM;
29 auto InsertNode(const std::wstring& text, LPARAM lparam, HTREEITEM parentNode) -> HTREEITEM;
30 void UpdateNodeText(HTREEITEM node, const std::wstring& text);
31 auto GetNodeCount() const -> unsigned int;
32
33 bool IsExpanded(HTREEITEM node) const;
34 bool IsThisOrAnyChildExpanded(HTREEITEM node) const;
35 bool IsThisOrAnyChildCollapsed(HTREEITEM node) const;
36
37 void Expand(HTREEITEM node) const;
38 void Collapse(HTREEITEM node) const;
39
40 BOOL ScreenToTreeView(LPPOINT lpPoint) const;
41 auto HitTest(LPTVHITTESTINFO lpHTInfo) const -> HTREEITEM;
42
43 auto GetRoot() const -> HTREEITEM;
44 bool SelectItem(HTREEITEM hti, bool firstVisible = false) const;
45 bool HasChild(HTREEITEM hti) const;
46
47 HTREEITEM GetSelection() const;
48 void SetSelection(HTREEITEM hItem) const;
49
50 bool IsItemVisible(HTREEITEM hti) const;
51
52 HTREEITEM NextItem(HTREEITEM htiCurrent) const
53 {
54 return NextItem(htiCurrent, nullptr);
55 }
56
57 HTREEITEM NextItem(HTREEITEM htiCurrent, HTREEITEM htiNextRoot) const;
58
59 auto GetNodeName(HTREEITEM hti, bool removeTrailingCount) const -> std::wstring;
60 auto GetNodePos(HTREEITEM hti) const -> LPARAM;
61 auto GetNodeKey(HTREEITEM hti) const -> std::wstring;
62 auto GetNodeValue(HTREEITEM hti) const -> std::wstring;
63 auto GetNodePath(HTREEITEM hti) const -> std::wstring;
64 auto GetNodePosition(HTREEITEM hti) const -> Position*;
65
66private:
67 void ExpandOrCollapse(HTREEITEM node, UINT_PTR code) const;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected