xref: /haiku/src/preferences/screen/ScreenApplication.cpp (revision 22440f4105cafc95cc1d49f9bc65bb395c527d86)
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 			fScreenWindow->PostMessage(message);
55 			break;
56 
57 		default:
58 			BApplication::MessageReceived(message);
59 			break;
60 	}
61 }
62 
63 
64 //	#pragma mark -
65 
66 
67 int
68 main()
69 {
70 	ScreenApplication app;
71 	app.Run();
72 
73 	return 0;
74 }
75