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