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