| 3 | #include "DeviceManager.h" |
| 4 | |
| 5 | class CDeviceManagerView : |
| 6 | public CWindowImpl<CDeviceManagerView,CListViewCtrl>, |
| 7 | public CVirtualListView<CDeviceManagerView> { |
| 8 | public: |
| 9 | // ��������ᴴ��һ�����ھ����m_hWnd |
| 10 | DECLARE_WND_CLASS(nullptr); |
| 11 | |
| 12 | bool IsSortable(HWND,int col) const; |
| 13 | void DoSort(const SortInfo* si); |
| 14 | |
| 15 | private: |
| 16 | enum class ItemType { |
| 17 | None,String,MultiString,Dword,Boolean,Guid,PowerData |
| 18 | }; |
| 19 | struct ItemData { |
| 20 | PCWSTR Name; |
| 21 | ItemType Type; |
| 22 | WinSys::DeviceRegistryPropertyType PropertyType; |
| 23 | CString Value; |
| 24 | }; |
| 25 | |
| 26 | struct ClassItemData { |
| 27 | PCWSTR Name; |
| 28 | ItemType Type; |
| 29 | WinSys::DeviceClassRegistryPropertyType PropertyType; |
| 30 | CString Value; |
| 31 | }; |
| 32 | |
| 33 | BEGIN_MSG_MAP(CDeviceManagerView) |
| 34 | MESSAGE_HANDLER(WM_CREATE,OnCreate) |
| 35 | MESSAGE_HANDLER(WM_SIZE,OnSize) |
| 36 | NOTIFY_CODE_HANDLER(TVN_SELCHANGED,OnTreeSelectionChanged) |
| 37 | NOTIFY_CODE_HANDLER(LVN_GETDISPINFO,OnListGetDispInfo) |
| 38 | CHAIN_MSG_MAP(CVirtualListView<CDeviceManagerView>) |
| 39 | END_MSG_MAP() |
| 40 | |
| 41 | LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); |
| 42 | LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); |
| 43 | LRESULT OnTreeSelectionChanged(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/); |
| 44 | LRESULT OnListGetDispInfo(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/); |
| 45 | |
| 46 | void Refresh(); |
| 47 | void UpdateList(); |
| 48 | CString GetDeviceProperty(WinSys::DeviceInfo& di, int index) const; |
| 49 | LRESULT GetDeviceClassInfo(LVITEM& item) const; |
| 50 | CString GetDeviceClassProperty(const GUID* guid, int index) const; |
| 51 | LRESULT GetDeviceInfo(LVITEM& item) const; |
| 52 | static bool CompareItems(const CString& i1, const CString& i2, bool asc); |
| 53 | |
| 54 | friend class CMainFrame; |
| 55 | private: |
| 56 | std::unique_ptr<WinSys::DeviceManager> m_DevMgr; |
| 57 | std::vector<WinSys::DeviceInfo> m_Devices; |
| 58 | std::vector<ItemData> m_Items; |
| 59 | std::vector<ClassItemData> m_ClassItems; |
| 60 | std::unordered_map<HTREEITEM, GUID> m_DeviceClasses; |
| 61 | WinSys::DeviceInfo* m_SelectedDevice; |
| 62 | const GUID* m_SelectedClass; |
nothing calls this directly
no outgoing calls
no test coverage detected