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
28static const uint32 kMsgRefresh				= 'refr';
29static const uint32 kMsgReportCompatibility	= 'repo';
30static const uint32 kMsgGenerateSysInfo		= 'sysi';
31static const uint32 kMsgSelectionChanged	= 'selc';
32static const uint32 kMsgOrderCategory		= 'ocat';
33static const uint32 kMsgOrderConnection		= 'ocon';
34
35typedef enum {
36	ORDER_BY_CONNECTION,
37	ORDER_BY_CATEGORY
38} OrderByType;
39
40typedef std::map<Category, Device*> CategoryMap;
41typedef std::map<Category, Device*>::const_iterator CategoryMapIterator;
42
43typedef std::vector<Device*> Devices;
44
45
46class 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, Device* parent);
62		static int   SortItemsCompare(const BListItem*, const BListItem*);
63
64	private:
65		BOutlineListView*	fDevicesOutline;
66		PropertyList*		fAttributesView;
67		BMenuField*			fOrderByMenu;
68		Devices				fDevices;
69		OrderByType			fOrderBy;
70		CategoryMap			fCategoryMap;
71
72};
73
74#endif /* DEVICESVIEW_H */
75