1 /* 2 * Copyright 2008-2009 Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT license. 4 * 5 * Authors: 6 * Pieter Panman 7 */ 8 #ifndef DEVICESVIEW_H 9 #define DEVICESVIEW_H 10 11 12 #include <MenuField.h> 13 #include <MenuItem.h> 14 #include <OutlineListView.h> 15 #include <PopUpMenu.h> 16 #include <TabView.h> 17 #include <View.h> 18 19 #include <map> 20 21 #include "Device.h" 22 #include "DeviceACPI.h" 23 #include "DevicePCI.h" 24 #include "DeviceSCSI.h" 25 #include "DeviceUSB.h" 26 #include "PropertyList.h" 27 #include "PropertyListPlain.h" 28 29 static const uint32 kMsgRefresh = 'refr'; 30 static const uint32 kMsgReportCompatibility = 'repo'; 31 static const uint32 kMsgGenerateSysInfo = 'sysi'; 32 static const uint32 kMsgSelectionChanged = 'selc'; 33 static const uint32 kMsgOrderCategory = 'ocat'; 34 static const uint32 kMsgOrderConnection = 'ocon'; 35 36 typedef enum { 37 ORDER_BY_CONNECTION, 38 ORDER_BY_CATEGORY 39 } OrderByType; 40 41 typedef std::map<Category, Device*> CategoryMap; 42 typedef std::map<Category, Device*>::const_iterator CategoryMapIterator; 43 44 typedef std::vector<Device*> Devices; 45 46 47 class DevicesView : public BView { 48 public: 49 DevicesView(); 50 ~DevicesView(); 51 52 virtual void CreateLayout(); 53 54 virtual void MessageReceived(BMessage* msg); 55 virtual void RescanDevices(); 56 virtual void CreateCategoryMap(); 57 virtual void DeleteCategoryMap(); 58 59 virtual void DeleteDevices(); 60 virtual void RebuildDevicesOutline(); 61 virtual void AddChildrenToOutlineByConnection(Device* parent); 62 virtual void AddDeviceAndChildren(device_node_cookie* node, 63 Device* parent); 64 static int SortItemsCompare(const BListItem*, const BListItem*); 65 66 private: 67 BOutlineListView* fDevicesOutline; 68 PropertyListPlain* fBasicView; 69 PropertyListPlain* fBusView; 70 PropertyList* fAttributesView; 71 BMenuField* fOrderByMenu; 72 BTabView* fTabView; 73 Devices fDevices; 74 OrderByType fOrderBy; 75 CategoryMap fCategoryMap; 76 BTab* fBasicTab; 77 BTab* fDeviceTypeTab; 78 BTab* fDetailedTab; 79 80 }; 81 82 #endif /* DEVICESVIEW_H */ 83