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 20 class DevicesApplication : public BApplication { 21 public: 22 DevicesApplication(); 23 }; 24 25 26 class DevicesWindow : public BWindow { 27 public: 28 DevicesWindow(); 29 virtual void MessageReceived(BMessage* message); 30 private: 31 DevicesView* fDevicesView; 32 }; 33 34 35 DevicesApplication::DevicesApplication() 36 : 37 BApplication("application/x-vnd.Haiku-Devices") 38 { 39 DevicesWindow* window = new DevicesWindow(); 40 window->CenterOnScreen(); 41 window->Show(); 42 } 43 44 45 DevicesWindow::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 58 void 59 DevicesWindow::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 78 int 79 main() 80 { 81 DevicesApplication app; 82 app.Run(); 83 return 0; 84 } 85