[RTL][NTDLL]
[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 bool SelDeviceIsStarted();
82 bool SelDeviceIsInstalled();
83
84 private:
85 bool AddRootDevice();
86
87 bool RefreshDeviceList();
88
89 static unsigned int __stdcall RefreshThread(
90 void *Param
91 );
92
93 bool ListDevicesByConnection(
94 );
95 bool ListDevicesByType(
96 );
97
98 bool GetNextClass(
99 _In_ ULONG ClassIndex,
100 _Out_ LPGUID ClassGuid,
101 _Out_ HDEVINFO *hDevInfo
102 );
103
104 bool RecurseChildDevices(
105 _In_ DEVINST ParentDevice,
106 _In_ HTREEITEM hParentTreeItem
107 );
108
109 bool GetChildDevice(
110 _In_ DEVINST ParentDevInst,
111 _Out_ PDEVINST DevInst
112 );
113
114 bool GetSiblingDevice(
115 _In_ DEVINST PrevDevice,
116 _Out_ PDEVINST DevInst
117 );
118
119 HTREEITEM InsertIntoTreeView(
120 _In_ HTREEITEM hParent,
121 _In_ CNode *Node
122 );
123
124 VOID RecurseDeviceView(
125 _In_ HTREEITEM hParentItem
126 );
127
128 VOID EmptyDeviceView(
129 );
130
131 CNode* GetNode(
132 _In_ LPTV_ITEMW TvItem
133 );
134 CNode* GetSelectedNode();
135
136 CClassNode* GetClassNode(
137 _In_ LPGUID ClassGuid
138 );
139 CDeviceNode* GetDeviceNode(
140 _In_ DEVINST Device
141 );
142 void EmptyLists();
143 };
144