xref: /haiku/src/servers/print/ConfigWindow.h (revision 1acbe440b8dd798953bec31d18ee589aa3f71b73)
1 /*
2  * Copyright 2002-2006, Haiku. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Michael Pfeiffer
7  */
8 
9 #ifndef _CONFIG_WINDOW_H
10 #define _CONFIG_WINDOW_H
11 
12 #include "BeUtils.h"
13 #include "ObjectList.h"
14 
15 #include <InterfaceKit.h>
16 
17 enum config_setup_kind {
18 	kPageSetup,
19 	kJobSetup,
20 };
21 
22 class ConfigWindow : public BWindow {
23 	enum {
24 		MSG_PAGE_SETUP       = 'cwps',
25 		MSG_JOB_SETUP        = 'cwjs',
26 		MSG_PRINTER_SELECTED = 'cwpr',
27 		MSG_OK               = 'cwok',
28 		MSG_CANCEL           = 'cwcl',
29 	};
30 
31 public:
32 	ConfigWindow(config_setup_kind kind, Printer* defaultPrinter, BMessage* settings, AutoReply* sender);
33 	~ConfigWindow();
34 	void Go();
35 
36 	void MessageReceived(BMessage* m);
37 	void AboutRequested();
38 	void FrameMoved(BPoint p);
39 
40 	static BRect GetWindowFrame();
41 	static void SetWindowFrame(BRect frame);
42 
43 private:
44 	BPictureButton* AddPictureButton(BView* panel, BRect frame, const char* name, const char* on, const char* off, uint32 what);
45 	BStringView* AddStringView(BView* panel, BRect frame, const char* text);
46 	void PrinterForMimeType();
47 	void SetupPrintersMenu(BMenu* menu);
48 	void UpdateAppSettings(const char* mime, const char* printer);
49 	void UpdateSettings(bool read);
50 	void UpdateUI();
51 	void Setup(config_setup_kind);
52 
53 	config_setup_kind fKind;
54 	Printer*    fDefaultPrinter;
55 	BMessage*   fSettings;
56 	AutoReply*  fSender;
57 	BString     fSenderMimeType;
58 
59 	BString     fPrinterName;
60 	Printer*    fCurrentPrinter;
61 	BMessage    fPageSettings;
62 	BMessage    fJobSettings;
63 
64 	sem_id      fFinished;
65 
66 	BMenuField* fPrinters;
67 	BPictureButton*    fPageSetup;
68 	BPictureButton*    fJobSetup;
69 	BButton*    fOk;
70 	BStringView* fPageFormatText;
71 	BStringView* fJobSetupText;
72 };
73 
74 #endif
75