xref: /haiku/src/preferences/time/Time.cpp (revision 1b8f7f13a3dc70e0e903cb94248220b40b732204)
1 /*
2  * Copyright 2002-2007, Haiku. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Andrew McCall <mccall@digitalparadise.co.uk>
7  *		Mike Berg <mike@agamemnon.homelinux.net>
8  *		Julun <host.haiku@gmx.de>
9  */
10 
11 #include "Time.h"
12 #include "TimeMessages.h"
13 #include "TimeSettings.h"
14 #include "TimeWindow.h"
15 
16 
17 #include <Alert.h>
18 #include <Message.h>
19 
20 
21 TimeApplication::TimeApplication()
22 	: BApplication(HAIKU_APP_SIGNATURE),
23 	  fWindow(NULL)
24 {
25 	BPoint pt = TimeSettings().LeftTop();
26 	fWindow = new TTimeWindow(pt);
27 }
28 
29 
30 TimeApplication::~TimeApplication()
31 {
32 }
33 
34 
35 void
36 TimeApplication::MessageReceived(BMessage *message)
37 {
38 	switch (message->what) {
39 		case UPDATE_SETTINGS:
40 		{
41 			BPoint pt;
42 			if (message->FindPoint("LeftTop", &pt) == B_OK)
43 				TimeSettings().SetLeftTop(pt);
44 		}	break;
45 
46 		default:
47 			BApplication::MessageReceived(message);
48 			break;
49 	}
50 }
51 
52 
53 void
54 TimeApplication::ReadyToRun()
55 {
56 	fWindow->Show();
57 }
58 
59 
60 void
61 TimeApplication::AboutRequested()
62 {
63 	BAlert alert("about", "Time & Date, by\n\nAndrew Edward McCall\nMike Berg", "OK");
64 	alert.Go();
65 }
66 
67 
68 //	#pragma mark -
69 
70 
71 int
72 main(int argc, char** argv)
73 {
74 	TimeApplication app;
75 	app.Run();
76 
77 	return 0;
78 }
79 
80