1 /* 2 * Copyright 2008 Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Julun, <host.haiku@gmx.de 7 */ 8 #ifndef _PRINTER_H_ 9 #define _PRINTER_H_ 10 11 12 #include <Directory.h> 13 #include <Entry.h> 14 #include <image.h> 15 #include <Message.h> 16 #include <Node.h> 17 #include <Path.h> 18 #include <String.h> 19 20 21 namespace BPrivate { 22 namespace Print { 23 24 25 class BPrinter { 26 public: 27 BPrinter(); 28 BPrinter(const BEntry& entry); 29 BPrinter(const BPrinter& printer); 30 BPrinter(const node_ref& nodeRef); 31 BPrinter(const entry_ref& entryRef); 32 BPrinter(const BDirectory& directory); 33 ~BPrinter(); 34 35 status_t SetTo(const BEntry& entry); 36 status_t SetTo(const node_ref& nodeRef); 37 status_t SetTo(const entry_ref& entryRef); 38 status_t SetTo(const BDirectory& directory); 39 void Unset(); 40 41 bool IsValid() const; 42 status_t InitCheck() const; 43 44 bool IsFree() const; 45 bool IsDefault() const; 46 bool IsShareable() const; 47 48 BString Name() const; 49 BString State() const; 50 BString Driver() const; 51 BString Comments() const; 52 BString Transport() const; 53 BString TransportAddress() const; 54 status_t DefaultSettings(BMessage& settings); 55 56 status_t StartWatching(const BMessenger& listener); 57 void StopWatching(); 58 59 BPrinter& operator=(const BPrinter& printer); 60 bool operator==(const BPrinter& printer) const; 61 bool operator!=(const BPrinter& printer) const; 62 63 private: 64 status_t _Configure() const; 65 status_t _ConfigureJob(BMessage& settings); 66 status_t _ConfigurePage(BMessage& settings); 67 68 BPath _DriverPath() const; 69 image_id _LoadDriver() const; 70 void _AddPrinterName(BMessage& settings); 71 BString _ReadAttribute(const char* attribute) const; 72 73 private: 74 BMessenger* fListener; 75 entry_ref fPrinterEntryRef; 76 }; 77 78 79 } // namespace Print 80 } // namespace BPrivate 81 82 83 #endif // _PRINTER_H_ 84