xref: /haiku/src/preferences/screen/ScreenApplication.cpp (revision d3d8b26997fac34a84981e6d2b649521de2cc45a)
1 /*
2  * Copyright 2001-2006, Haiku.
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 
20 
21 static const char* kAppSignature = "application/x-vnd.Be-SCRN";
22 
23 
24 ScreenApplication::ScreenApplication()
25 	:	BApplication(kAppSignature),
26 	fScreenWindow(new ScreenWindow(new ScreenSettings()))
27 {
28 	fScreenWindow->Show();
29 }
30 
31 
32 void
33 ScreenApplication::AboutRequested()
34 {
35 	BAlert *aboutAlert = new BAlert("About", "Screen preferences by the Haiku team",
36 		"Ok", NULL, NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_INFO_ALERT);
37 	aboutAlert->SetShortcut(0, B_OK);
38 	aboutAlert->Go();
39 }
40 
41 
42 void
43 ScreenApplication::MessageReceived(BMessage* message)
44 {
45 	switch (message->what) {
46 		case SET_INITIAL_MODE_MSG:
47 		case SET_CUSTOM_REFRESH_MSG:
48 		case MAKE_INITIAL_MSG:
49 			fScreenWindow->PostMessage(message);
50 			break;
51 
52 		default:
53 			BApplication::MessageReceived(message);
54 			break;
55 	}
56 }
57 
58 
59 //	#pragma mark -
60 
61 
62 int
63 main()
64 {
65 	ScreenApplication app;
66 	app.Run();
67 
68 	return 0;
69 }
70