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