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