xref: /haiku/headers/libs/print/libprint/PrinterDriver.h (revision 220d04022750f40f8bac8f01fa551211e28d04f2)
1 #ifndef _PRINTER_DRIVER_H
2 #define _PRINTER_DRIVER_H
3 
4 
5 #include <SupportDefs.h>
6 
7 
8 class BFile;
9 class BMessage;
10 class BNode;
11 class PrinterCap;
12 class PrinterData;
13 class GraphicsDriver;
14 
15 #define kAttrPageSettings "libprint/page_settings"
16 #define kAttrJobSettings  "libprint/job_settings"
17 
18 class PrinterDriver {
19 public:
20 							PrinterDriver(BNode* spoolFolder);
21 	virtual					~PrinterDriver();
22 
23 	virtual	const char*		GetSignature() const = 0;
24 	virtual	const char*		GetDriverName() const = 0;
25 	virtual	const char*		GetVersion() const = 0;
26 	virtual	const char*		GetCopyright() const = 0;
27 
28 	virtual	PrinterCap*		InstantiatePrinterCap(PrinterData* printerData) = 0;
29 	virtual	PrinterData*	InstantiatePrinterData(BNode* node);
30 	virtual	GraphicsDriver*	InstantiateGraphicsDriver(BMessage* settings,
31 								PrinterData* printerData,
32 								PrinterCap* printerCap) = 0;
33 
34 			void			InitPrinterDataAndCap();
35 
36 	virtual	void			About();
37 	virtual	char*			AddPrinter(char* printerName);
38 			BMessage*		ConfigPage(BMessage* settings);
39 			BMessage*		ConfigJob(BMessage* settings);
40 			BMessage*		TakeJob(BFile* printJob, BMessage* settings);
41 
42 protected:
43 			PrinterData*	GetPrinterData() { return fPrinterData; }
44 			PrinterCap*		GetPrinterCap() { return fPrinterCap; }
45 
46 private:
47 			bool			_ReadSettings(const char* attrName,
48 								BMessage* settings);
49 			void			_WriteSettings(const char* attrName,
50 								BMessage* settings);
51 			void			_MergeWithPreviousSettings(const char* attrName,
52 								BMessage* settings);
53 
54 	BNode*          fSpoolFolder;
55 	PrinterData*    fPrinterData;
56 	PrinterCap*     fPrinterCap;
57 	GraphicsDriver* fGraphicsDriver;
58 };
59 
60 PrinterDriver* instantiate_printer_driver(BNode* printerFolder = NULL);
61 
62 #endif	// _PRINTER_DRIVER_H
63