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
9#include <Alert.h>
10#include <Application.h>
11#include <Catalog.h>
12#include <LayoutBuilder.h>
13#include <TextView.h>
14
15#include "DevicesView.h"
16
17#undef B_TRANSLATION_CONTEXT
18#define B_TRANSLATION_CONTEXT "DevicesApplication"
19
20class DevicesApplication : public BApplication {
21public:
22								DevicesApplication();
23};
24
25
26class DevicesWindow : public BWindow {
27public:
28								DevicesWindow();
29	virtual	void				MessageReceived(BMessage* message);
30private:
31			DevicesView*		fDevicesView;
32};
33
34
35DevicesApplication::DevicesApplication()
36	:
37	BApplication("application/x-vnd.Haiku-Devices")
38{
39	DevicesWindow* window = new DevicesWindow();
40	window->CenterOnScreen();
41	window->Show();
42}
43
44
45DevicesWindow::DevicesWindow()
46	:
47	BWindow(BRect(50, 50, 960, 540), B_TRANSLATE_SYSTEM_NAME("Devices"),
48		B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS  | B_AUTO_UPDATE_SIZE_LIMITS
49			| B_QUIT_ON_WINDOW_CLOSE)
50{
51	BLayoutBuilder::Group<>(this, B_VERTICAL)
52		.SetInsets(0)
53		.Add(fDevicesView = new DevicesView());
54	GetLayout()->SetExplicitMinSize(BSize(640, 360));
55}
56
57
58void
59DevicesWindow::MessageReceived(BMessage* message)
60{
61	switch (message->what) {
62		case kMsgRefresh:
63		case kMsgReportCompatibility:
64		case kMsgGenerateSysInfo:
65		case kMsgSelectionChanged:
66		case kMsgOrderCategory:
67		case kMsgOrderConnection:
68			fDevicesView->MessageReceived(message);
69			break;
70
71		default:
72			BWindow::MessageReceived(message);
73			break;
74	}
75}
76
77
78int
79main()
80{
81	DevicesApplication app;
82	app.Run();
83	return 0;
84}
85