1/*
2 * Copyright 2004-2006, Haiku. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors in chronological order:
6 *		Andrew McCall, mccall@digitalparadise.co.uk
7 *		Jérôme Duval
8 *		Marcus Overhagen
9 */
10
11
12#include "Keyboard.h"
13#include "KeyboardWindow.h"
14#include "KeyboardMessages.h"
15
16#include <Alert.h>
17
18#undef B_TRANSLATION_CONTEXT
19#define B_TRANSLATION_CONTEXT "KeyboardApplication"
20
21KeyboardApplication::KeyboardApplication()
22	: BApplication("application/x-vnd.Haiku-Keyboard")
23{
24	new KeyboardWindow();
25}
26
27
28void
29KeyboardApplication::MessageReceived(BMessage* message)
30{
31	switch (message->what) {
32		case ERROR_DETECTED:
33		{
34			BAlert* errorAlert = new BAlert("Error",
35				B_TRANSLATE("Something has gone wrong!"),
36				B_TRANSLATE("OK"), NULL, NULL,
37				B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT);
38			errorAlert->SetFlags(errorAlert->Flags() | B_CLOSE_ON_ESCAPE);
39			errorAlert->Go();
40			be_app->PostMessage(B_QUIT_REQUESTED);
41			break;
42		}
43		default:
44			BApplication::MessageReceived(message);
45			break;
46	}
47}
48
49
50void
51KeyboardApplication::AboutRequested()
52{
53	BAlert* alert = new BAlert("about",
54		B_TRANSLATE("Written by Andrew Edward McCall"),	B_TRANSLATE("OK"));
55	alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
56	alert->Go();
57}
58
59
60//	#pragma mark -
61
62
63int
64main(int, char**)
65{
66	KeyboardApplication	app;
67	app.Run();
68
69	return 0;
70}
71
72