xref: /haiku/src/servers/print/ConfigWindow.h (revision 2807c36668a1730dd59bc39de65e0b8f88cd5d0d)
1 /*****************************************************************************/
2 // ConfigWindow
3 //
4 // Author
5 //   Michael Pfeiffer
6 //
7 // This application and all source files used in its construction, except
8 // where noted, are licensed under the MIT License, and have been written
9 // and are:
10 //
11 // Copyright (c) 2002 OpenBeOS Project
12 //
13 // Permission is hereby granted, free of charge, to any person obtaining a
14 // copy of this software and associated documentation files (the "Software"),
15 // to deal in the Software without restriction, including without limitation
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 // and/or sell copies of the Software, and to permit persons to whom the
18 // Software is furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included
21 // in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30 /*****************************************************************************/
31 
32 #ifndef _CONFIG_WINDOW_H
33 #define _CONFIG_WINDOW_H
34 
35 #include "BeUtils.h"
36 #include "ObjectList.h"
37 
38 #include <InterfaceKit.h>
39 
40 enum config_setup_kind {
41 	kPageSetup,
42 	kJobSetup,
43 };
44 
45 class ConfigWindow : public BWindow {
46 	enum {
47 		MSG_PAGE_SETUP       = 'cwps',
48 		MSG_JOB_SETUP        = 'cwjs',
49 		MSG_PRINTER_SELECTED = 'cwpr',
50 		MSG_OK               = 'cwok',
51 		MSG_CANCEL           = 'cwcl',
52 	};
53 
54 public:
55 	ConfigWindow(config_setup_kind kind, Printer* defaultPrinter, BMessage* settings, AutoReply* sender);
56 	~ConfigWindow();
57 	void Go();
58 
59 	void MessageReceived(BMessage* m);
60 	void AboutRequested();
61 	void FrameMoved(BPoint p);
62 
63 	static BRect GetWindowFrame();
64 	static void SetWindowFrame(BRect frame);
65 
66 private:
67 	BPictureButton* AddPictureButton(BView* panel, BRect frame, const char* name, const char* on, const char* off, uint32 what);
68 	BStringView* AddStringView(BView* panel, BRect frame, const char* text);
69 	void PrinterForMimeType();
70 	void SetupPrintersMenu(BMenu* menu);
71 	void UpdateAppSettings(const char* mime, const char* printer);
72 	void UpdateSettings(bool read);
73 	void UpdateUI();
74 	void Setup(config_setup_kind);
75 
76 	config_setup_kind fKind;
77 	Printer*    fDefaultPrinter;
78 	BMessage*   fSettings;
79 	AutoReply*  fSender;
80 	BString     fSenderMimeType;
81 
82 	BString     fPrinterName;
83 	Printer*    fCurrentPrinter;
84 	BMessage    fPageSettings;
85 	BMessage    fJobSettings;
86 
87 	sem_id      fFinished;
88 
89 	BMenuField* fPrinters;
90 	BPictureButton*    fPageSetup;
91 	BPictureButton*    fJobSetup;
92 	BButton*    fOk;
93 	BStringView* fPageFormatText;
94 	BStringView* fJobSetupText;
95 };
96 
97 #endif
98