xref: /haiku/src/apps/sudoku/Sudoku.cpp (revision b55a57da7173b9af0432bd3e148d03f06161d036)
1 /*
2  * Copyright 2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include "Sudoku.h"
8 
9 #include "SudokuWindow.h"
10 
11 #include <stdlib.h>
12 
13 #include <Alert.h>
14 #include <Application.h>
15 #include <TextView.h>
16 
17 
18 const char* kSignature = "application/x-vnd.Haiku-Sudoku";
19 
20 
21 Sudoku::Sudoku()
22 	: BApplication(kSignature)
23 {
24 }
25 
26 
27 Sudoku::~Sudoku()
28 {
29 }
30 
31 
32 void
33 Sudoku::ReadyToRun()
34 {
35 	fWindow = new SudokuWindow();
36 	fWindow->Show();
37 }
38 
39 
40 void
41 Sudoku::RefsReceived(BMessage* message)
42 {
43 	fWindow->PostMessage(message);
44 }
45 
46 
47 void
48 Sudoku::MessageReceived(BMessage* message)
49 {
50 	BApplication::MessageReceived(message);
51 }
52 
53 
54 void
55 Sudoku::AboutRequested()
56 {
57 	Sudoku::DisplayAbout();
58 }
59 
60 
61 void
62 Sudoku::DisplayAbout()
63 {
64 	BAlert *alert = new BAlert("about", "Sudoku\n"
65 		"\twritten by Axel Dörfler\n"
66 		"\tCopyright 2007, Haiku Inc.\n", "OK");
67 	BTextView *view = alert->TextView();
68 	BFont font;
69 
70 	view->SetStylable(true);
71 
72 	view->GetFont(&font);
73 	font.SetSize(18);
74 	font.SetFace(B_BOLD_FACE);
75 	view->SetFontAndColor(0, 6, &font);
76 
77 	alert->Go();
78 }
79 
80 
81 //	#pragma mark -
82 
83 
84 int
85 main(int /*argc*/, char** /*argv*/)
86 {
87 	srand(system_time() % INT_MAX);
88 
89 	Sudoku sudoku;
90 	sudoku.Run();
91 
92 	return 0;
93 }
94