9b41308798c5f51dc39a9f9d3b52e45175d4c88b
[reactos.git] / reactos / dll / win32 / devmgr / devmgmt / DeviceView.h
1 #pragma once
2 #include "Node.h"
3
4 enum ViewType
5 {
6 DevicesByType,
7 DevicesByConnection,
8 ResourcesByType,
9 ResourcesByConnection
10 };
11
12
13 class CDeviceView
14 {
15 CAtlList<CNode *> m_ClassNodeList;
16 CAtlList<CNode *> m_DeviceNodeList;
17
18 SP_CLASSIMAGELIST_DATA m_ImageListData;
19
20 HWND m_hMainWnd;
21 HWND m_hTreeView;
22 HWND m_hPropertyDialog;
23 HMENU m_hMenu;
24 HMENU m_hContextMenu;
25 ViewType m_ViewType;
26
27 HTREEITEM m_hTreeRoot;
28 DEVINST m_RootDevInst;
29
30 bool m_ShowHidden;
31 int m_RootClassImage;
32
33 public:
34 CDeviceView(
35 HWND hMainWnd
36 );
37
38 ~CDeviceView(void);
39
40 bool Initialize();
41 bool Uninitialize();
42
43 LRESULT OnSize(
44 _In_ int x,
45 _In_ int y,
46 _In_ int cx,
47 _In_ int cy
48 );
49
50 LRESULT OnRightClick(
51 _In_ LPNMHDR NmHdr
52 );
53
54 LRESULT OnContextMenu(
55 _In_ LPARAM lParam
56 );
57
58 VOID Refresh(
59 _In_ ViewType Type,
60 _In_ bool ScanForChanges,
61 _In_ bool UpdateView
62 );
63
64 VOID DisplayPropertySheet();
65 VOID SetFocus();
66
67 VOID SetHiddenDevices(_In_ bool ShowHidden)
68 {
69 m_ShowHidden = ShowHidden;
70 }
71
72 ViewType GetCurrentView() { return m_ViewType; }
73
74 bool HasProperties(_In_ LPTV_ITEMW TvItem);
75 //bool SelDeviceIsHidden();
76 bool CanDisable(_In_ LPTV_ITEMW TvItem);
77 bool IsDisabled(_In_ LPTV_ITEMW TvItem);
78 bool SelDeviceIsStarted();
79 bool SelDeviceIsInstalled();
80
81 private:
82 bool AddRootDevice();
83
84 bool RefreshDeviceList();
85
86 static unsigned int __stdcall RefreshThread(
87 void *Param
88 );
89
90 bool ListDevicesByConnection(
91 );
92 bool ListDevicesByType(
93 );
94
95 bool GetNextClass(
96 _In_ ULONG ClassIndex,
97 _Out_ LPGUID ClassGuid,
98 _Out_ HDEVINFO *hDevInfo
99 );
100
101 VOID RecurseChildDevices(
102 _In_ DEVINST ParentDevice,
103 _In_ HTREEITEM hParentTreeItem
104 );
105
106 bool GetChildDevice(
107 _In_ DEVINST ParentDevInst,
108 _Out_ PDEVINST DevInst
109 );
110
111 bool GetSiblingDevice(
112 _In_ DEVINST PrevDevice,
113 _Out_ PDEVINST DevInst
114 );
115
116 HTREEITEM InsertIntoTreeView(
117 _In_ HTREEITEM hParent,
118 _In_ CNode *Node
119 );
120
121 VOID RecurseDeviceView(
122 _In_ HTREEITEM hParentItem
123 );
124
125 VOID EmptyDeviceView(
126 );
127
128 CNode* GetNode(_In_ LPTV_ITEMW TvItem);
129 CNode* GetSelectedNode();
130
131 CNode* GetClassNode(_In_ LPGUID ClassGuid);
132 CNode* GetDeviceNode(_In_ DEVINST Device);
133 void EmptyLists();
134 };
135