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 "DevicePCI.h" 23 #include "DeviceACPI.h" 24 #include "DeviceSCSI.h" 25 #include "PropertyList.h" 26 #include "PropertyListPlain.h" 27 28 static const uint32 kMsgRefresh = 'refr'; 29 static const uint32 kMsgReportCompatibility = 'repo'; 30 static const uint32 kMsgGenerateSysInfo = 'sysi'; 31 static const uint32 kMsgSelectionChanged = 'selc'; 32 static const uint32 kMsgOrderCategory = 'ocat'; 33 static const uint32 kMsgOrderConnection = 'ocon'; 34 35 typedef enum { 36 ORDER_BY_CONNECTION, 37 ORDER_BY_CATEGORY 38 } OrderByType; 39 40 typedef std::map<Category, Device*> CategoryMap; 41 typedef std::map<Category, Device*>::const_iterator CategoryMapIterator; 42 43 typedef std::vector<Device*> Devices; 44 45 46 class DevicesView : public BView { 47 public: 48 DevicesView(); 49 ~DevicesView(); 50 51 virtual void CreateLayout(); 52 53 virtual void MessageReceived(BMessage* msg); 54 virtual void RescanDevices(); 55 virtual void CreateCategoryMap(); 56 virtual void DeleteCategoryMap(); 57 58 virtual void DeleteDevices(); 59 virtual void RebuildDevicesOutline(); 60 virtual void AddChildrenToOutlineByConnection(Device* parent); 61 virtual void AddDeviceAndChildren(device_node_cookie* node, 62 Device* parent); 63 static int SortItemsCompare(const BListItem*, const BListItem*); 64 65 private: 66 BOutlineListView* fDevicesOutline; 67 PropertyListPlain* fBasicView; 68 PropertyListPlain* fBusView; 69 PropertyList* fAttributesView; 70 BMenuField* fOrderByMenu; 71 BTabView* fTabView; 72 Devices fDevices; 73 OrderByType fOrderBy; 74 CategoryMap fCategoryMap; 75 BTab* fBasicTab; 76 BTab* fDeviceTypeTab; 77 BTab* fDetailedTab; 78 79 }; 80 81 #endif /* DEVICESVIEW_H */ 82