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