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