1/*
2 * Copyright 2001-2010, Haiku.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Michael Pfeiffer
7 */
8
9
10#include "Printers.h"
11
12#include <Locale.h>
13
14#include "pr_server.h"
15#include "Messages.h"
16#include "PrintersWindow.h"
17
18
19int
20main()
21{
22	PrintersApp app;
23	app.Run();
24	return 0;
25}
26
27
28PrintersApp::PrintersApp()
29	: Inherited(PRINTERS_SIGNATURE)
30{
31}
32
33
34void
35PrintersApp::ReadyToRun()
36{
37	PrintersWindow* win = new PrintersWindow(BRect(78, 71, 561, 409));
38	win->Show();
39}
40
41
42void
43PrintersApp::MessageReceived(BMessage* msg)
44{
45	if (msg->what == B_PRINTER_CHANGED || msg->what == PRINTERS_ADD_PRINTER) {
46			// broadcast message
47		uint32 what = msg->what;
48		if (what == PRINTERS_ADD_PRINTER)
49			what = kMsgAddPrinter;
50
51		BWindow* w;
52		for (int32 i = 0; (w = WindowAt(i)) != NULL; i++) {
53			BMessenger msgr(NULL, w);
54			msgr.SendMessage(what);
55		}
56	} else {
57		BApplication::MessageReceived(msg);
58	}
59}
60
61
62void
63PrintersApp::ArgvReceived(int32 argc, char** argv)
64{
65	for (int i = 1; i < argc; i++) {
66		// TODO: show a pre-filled add printer dialog here
67	}
68}
69
70