1 /* 2 * Copyright 2001-2009, Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Rafael Romo 7 * Stefano Ceccherini (burton666@libero.it) 8 * Andrew Bachmann 9 * Sergei Panteleev 10 */ 11 12 13 #include "ScreenApplication.h" 14 #include "ScreenWindow.h" 15 #include "ScreenSettings.h" 16 #include "Constants.h" 17 18 #include <Alert.h> 19 #include <Catalog.h> 20 21 22 #undef B_TRANSLATION_CONTEXT 23 #define B_TRANSLATION_CONTEXT "Screen" 24 25 26 static const char* kAppSignature = "application/x-vnd.Haiku-Screen"; 27 28 29 ScreenApplication::ScreenApplication() 30 : BApplication(kAppSignature), 31 fScreenWindow(new ScreenWindow(new ScreenSettings())) 32 { 33 fScreenWindow->Show(); 34 } 35 36 37 void 38 ScreenApplication::AboutRequested() 39 { 40 BAlert *aboutAlert = new BAlert(B_TRANSLATE("About"), 41 B_TRANSLATE("Screen preferences by the Haiku team"), B_TRANSLATE("OK"), 42 NULL, NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_INFO_ALERT); 43 aboutAlert->SetFlags(aboutAlert->Flags() | B_CLOSE_ON_ESCAPE); 44 aboutAlert->Go(); 45 } 46 47 48 void 49 ScreenApplication::MessageReceived(BMessage* message) 50 { 51 switch (message->what) { 52 case SET_CUSTOM_REFRESH_MSG: 53 case MAKE_INITIAL_MSG: 54 case UPDATE_DESKTOP_COLOR_MSG: 55 fScreenWindow->PostMessage(message); 56 break; 57 58 default: 59 BApplication::MessageReceived(message); 60 break; 61 } 62 } 63 64 65 // #pragma mark - 66 67 68 int 69 main() 70 { 71 ScreenApplication app; 72 app.Run(); 73 74 return 0; 75 } 76