Reactos
at master 189 lines 3.5 kB view raw
1#pragma once 2#include "DeviceNode.h" 3#include "ClassNode.h" 4#include "RootNode.h" 5#include "ResourceNode.h" 6#include "ResourceTypeNode.h" 7 8enum ViewType 9{ 10 DevicesByType, 11 DevicesByConnection, 12 ResourcesByType, 13 ResourcesByConnection 14}; 15 16 17class CDeviceView 18{ 19 20 HWND m_hMainWnd; 21 HWND m_hTreeView; 22 HWND m_hPropertyDialog; 23 HMENU m_hMenu; 24 ViewType m_ViewType; 25 HTREEITEM m_hTreeRoot; 26 bool m_ShowHidden; 27 28 CRootNode *m_RootNode; 29 CAtlList<CClassNode *> m_ClassNodeList; 30 CAtlList<CDeviceNode *> m_DeviceNodeList; 31 SP_CLASSIMAGELIST_DATA m_ImageListData; 32 33public: 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 OnDoubleClick( 51 _In_ LPNMHDR NmHdr 52 ); 53 54 LRESULT OnRightClick( 55 _In_ LPNMHDR NmHdr 56 ); 57 58 LRESULT OnContextMenu( 59 _In_ LPARAM lParam 60 ); 61 62 LRESULT OnAction( 63 UINT Action 64 ); 65 66 VOID Refresh( 67 _In_ ViewType Type, 68 _In_ bool ScanForChanges, 69 _In_ bool UpdateView 70 ); 71 72 VOID DisplayPropertySheet(); 73 VOID SetFocus(); 74 75 VOID SetHiddenDevices(_In_ bool ShowHidden) 76 { 77 m_ShowHidden = ShowHidden; 78 } 79 80 ViewType GetCurrentView() { return m_ViewType; } 81 82 bool CreateActionMenu( 83 _In_ HMENU OwnerMenu, 84 _In_ bool MainMenu 85 ); 86 87 CNode* GetSelectedNode( 88 ); 89 90 bool SelDeviceIsStarted(); 91 bool SelDeviceIsInstalled(); 92 93private: 94 bool AddRootDevice(); 95 96 bool RefreshDeviceList(); 97 98 static unsigned int __stdcall RefreshThread( 99 void *Param 100 ); 101 102 bool ListDevicesByConnection( 103 ); 104 bool ListDevicesByType( 105 ); 106 bool ListResourcesByType( 107 ); 108 109 bool RecurseResources( 110 _In_ DEVINST ParentDevice, 111 _In_ HTREEITEM hMemoryTreeItem, 112 _In_ HTREEITEM hPortTreeItem, 113 _In_ HTREEITEM hDmaTreeItem, 114 _In_ HTREEITEM hIrqTreeItem 115 ); 116 117 bool GetNextClass( 118 _In_ ULONG ClassIndex, 119 _Out_ LPGUID ClassGuid, 120 _Out_ HDEVINFO *hDevInfo 121 ); 122 123 bool RecurseChildDevices( 124 _In_ DEVINST ParentDevice, 125 _In_ HTREEITEM hParentTreeItem 126 ); 127 128 bool EnableSelectedDevice( 129 _In_ bool Enable, 130 _Out_ bool &NeedsReboot 131 ); 132 133 bool UpdateSelectedDevice( 134 _Out_ bool &NeedsReboot 135 ); 136 137 bool UninstallSelectedDevice( 138 ); 139 140 bool RunAddHardwareWizard( 141 ); 142 143 bool GetChildDevice( 144 _In_ DEVINST ParentDevInst, 145 _Out_ PDEVINST DevInst 146 ); 147 148 bool GetSiblingDevice( 149 _In_ DEVINST PrevDevice, 150 _Out_ PDEVINST DevInst 151 ); 152 153 HTREEITEM InsertIntoTreeView( 154 _In_opt_ HTREEITEM hParent, 155 _In_ CNode *Node 156 ); 157 158 void BuildActionMenuForNode( 159 _In_ HMENU OwnerMenu, 160 _In_ CNode *Node, 161 _In_ bool MainMenu 162 ); 163 164 HTREEITEM RecurseFindDevice( 165 _In_ HTREEITEM hParentItem, 166 _In_ CNode *Node 167 ); 168 169 void SelectNode( 170 _In_ CNode *Node 171 ); 172 173 void EmptyDeviceView( 174 ); 175 176 CNode* GetNode( 177 _In_ LPTV_ITEMW TvItem 178 ); 179 180 CClassNode* GetClassNode( 181 _In_ LPGUID ClassGuid 182 ); 183 CDeviceNode* GetDeviceNode( 184 _In_ DEVINST Device 185 ); 186 void EmptyLists( 187 ); 188}; 189