1 /* Copyright (C) 2006 The gtkmm Development Team
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Library General Public
5 * License as published by the Free Software Foundation; either
6 * version 2 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Library General Public License for more details.
13 * You should have received a copy of the GNU Library General Public
14 * License along with this library; if not, write to the Free
15 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 #include <gtkmm/pagesetup.h>
21 _PINCLUDE(glibmm/private/object_p.h)
26 _WRAP_ENUM(PrintCapabilities, GtkPrintCapabilities)
28 /** A Printer object represents a printer. You only need to deal directly with printers if you use the
29 * non-portable PrintUnixDialog API.
31 * A Printer object allows to get status information about the printer, such as its description, its location,
32 * the number of queued jobs, etc. Most importantly, a Printer object can be used to create a PrintJob object,
33 * which lets you print to the printer.
39 class Printer : public Glib::Object
41 _CLASS_GOBJECT(Printer, GtkPrinter, GTK_PRINTER, Glib::Object, GObject)
42 _GTKMMPROC_WIN32_NO_WRAP
45 //TODO: _WRAP_CREATE() - probably not, it's only accessible through PrintUnixDialog + GtkPrintBackend should be ignored
46 //TODO: I think these are not needed as well, and that Printer should generally be read-only - marko.
47 _IGNORE(gtk_printer_is_new, gtk_printer_set_state_message, gtk_printer_set_is_default)
48 _IGNORE(gtk_printer_set_is_active, gtk_printer_set_has_details, gtk_printer_set_description)
49 _IGNORE(gtk_printer_set_icon_name, gtk_printer_set_job_count, gtk_printer_set_is_new, gtk_printer_set_location)
51 bool equal(const Glib::RefPtr<Printer>& other) const;
53 //GtkPrintBackend is in a "semi-private" header.
54 //_WRAP_METHOD(Glib::RefPtr<PrintBackend> get_backend(), gtk_printer_get_backend, refreturn)
55 //_WRAP_METHOD(Glib::RefPtr<const PrintBackend> get_backend() const, gtk_printer_get_backend, refreturn, constversion)
56 _IGNORE(gtk_printer_new, gtk_printer_get_backend)
58 _WRAP_METHOD(Glib::ustring get_name() const, gtk_printer_get_name)
59 _WRAP_METHOD(Glib::ustring get_state_message() const, gtk_printer_get_state_message)
60 _WRAP_METHOD(Glib::ustring get_description() const, gtk_printer_get_description)
61 _WRAP_METHOD(Glib::ustring get_location() const, gtk_printer_get_location)
62 _WRAP_METHOD(Glib::ustring get_icon_name() const, gtk_printer_get_icon_name)
63 _WRAP_METHOD(int get_job_count() const, gtk_printer_get_job_count)
64 _WRAP_METHOD(bool is_active() const, gtk_printer_is_active)
65 _WRAP_METHOD(bool is_virtual() const, gtk_printer_is_virtual)
66 _WRAP_METHOD(bool is_default() const, gtk_printer_is_default)
67 _WRAP_METHOD(bool accepts_pdf() const, gtk_printer_accepts_pdf)
68 _WRAP_METHOD(bool accepts_ps() const, gtk_printer_accepts_ps)
70 #m4 _CONVERSION(`GList*', `Glib::ListHandle< Glib::RefPtr<PageSetup> >', __FL2H_DEEP)
71 _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<PageSetup> > list_papers(), gtk_printer_list_papers)
73 #m4 _CONVERSION(`GList*', `Glib::ListHandle< Glib::RefPtr<const PageSetup> >', __FL2H_DEEP)
74 _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<const PageSetup> > list_papers() const, gtk_printer_list_papers)
76 _IGNORE(gtk_printer_compare)
77 _IGNORE(gtk_enumerate_printers)
79 _WRAP_METHOD(bool has_details() const, gtk_printer_has_details)
80 _WRAP_METHOD(void request_details(), gtk_printer_request_details)
81 _WRAP_METHOD(PrintCapabilities get_capabilities() const, gtk_printer_get_capabilities)
84 _WRAP_SIGNAL(void details_acquired(bool success), "details_acquired")
86 _WRAP_PROPERTY("name", Glib::ustring)
88 //GtkPrintBackend is in a "semi-private" header:
89 //_WRAP_PROPERTY("backend", Glib::RefPtr<PrintBackend>)
91 _WRAP_PROPERTY("is_virtual", bool)
92 _WRAP_PROPERTY("state_message", Glib::ustring)
93 _WRAP_PROPERTY("location", Glib::ustring)
94 _WRAP_PROPERTY("icon_name", Glib::ustring)
95 _WRAP_PROPERTY("job_count", int)
96 _WRAP_PROPERTY("accepts-pdf", bool)
97 _WRAP_PROPERTY("accepts-ps", bool)
100 /** @relates Gtk::Printer */
101 inline bool operator==(const Glib::RefPtr<Printer>& lhs, const Glib::RefPtr<Printer>& rhs)
102 { return lhs->equal(rhs); }
104 /** @relates Gtk::Printer */
105 inline bool operator!=(const Glib::RefPtr<Printer>& lhs, const Glib::RefPtr<Printer>& rhs)
106 { return !lhs->equal(rhs); }
109 * bool on_enumerate_printers(const Glib::RefPtr<Printer>& printer);
110 * @param printer A printer.
111 * @param result true to stop the enumeration, false to continue.
113 * @relates Gtk::Printer
115 typedef sigc::slot< bool, const Glib::RefPtr<Printer>& > SlotPrinterEnumerator;
117 /** Calls a function for all Printers. If the callback returns true, the enumeration is stopped.
118 * @slot A function to call for each printer
119 * @parm wait If true, wait in a recursive mainloop until all printers are enumerated; otherwise return early.
121 * @relates Gtk::Printer
123 void enumerate_printers(const SlotPrinterEnumerator& slot, bool wait = true);