Debian Codegraph @

gtk/src/printer.hg

raw
1 /* Copyright (C) 2006 The gtkmm Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
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 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
15 */
16
17 #include <vector>
18
19 #include <gtkmm/pagesetup.h>
20
21 _DEFS(gtkmm,gtk)
22 _PINCLUDE(glibmm/private/object_p.h)
23
24 namespace Gtk
25 {
26
27 _WRAP_ENUM(PrintCapabilities, GtkPrintCapabilities)
28
29 /** A Printer object represents a printer. You only need to deal directly with printers if you use the
30 * non-portable PrintUnixDialog API.
31 *
32 * A Printer object allows to get status information about the printer, such as its description, its location,
33 * the number of queued jobs, etc. Most importantly, a Printer object can be used to create a PrintJob object,
34 * which lets you print to the printer.
35 *
36 * @newin{2,10}
37 *
38 * @ingroup Printing
39 */
40 class GTKMM_API Printer : public Glib::Object
41 {
42 _CLASS_GOBJECT(Printer, GtkPrinter, GTK_PRINTER, Glib::Object, GObject, , , GTKMM_API)
43 _GTKMMPROC_WIN32_NO_WRAP
44
45 public:
46 //TODO: _WRAP_CREATE() - probably not, it's only accessible through PrintUnixDialog + GtkPrintBackend should be ignored
47 //TODO: I think these are not needed as well, and that Printer should generally be read-only - marko.
48 _IGNORE(gtk_printer_is_new, gtk_printer_set_state_message, gtk_printer_set_is_default,
49 gtk_printer_set_is_accepting_jobs, gtk_printer_set_is_paused)
50 _IGNORE(gtk_printer_set_is_active, gtk_printer_set_has_details, gtk_printer_set_description)
51 _IGNORE(gtk_printer_set_icon_name, gtk_printer_set_job_count, gtk_printer_set_is_new, gtk_printer_set_location)
52
53 bool equal(const Glib::RefPtr<Printer>& other) const;
54
55 //GtkPrintBackend is in a "semi-private" header.
56 //_WRAP_METHOD(Glib::RefPtr<PrintBackend> get_backend(), gtk_printer_get_backend, refreturn)
57 //_WRAP_METHOD(Glib::RefPtr<const PrintBackend> get_backend() const, gtk_printer_get_backend, refreturn, constversion)
58 _IGNORE(gtk_printer_new, gtk_printer_get_backend)
59
60 _WRAP_METHOD(Glib::ustring get_name() const, gtk_printer_get_name)
61 _WRAP_METHOD(Glib::ustring get_state_message() const, gtk_printer_get_state_message)
62 _WRAP_METHOD(Glib::ustring get_description() const, gtk_printer_get_description)
63 _WRAP_METHOD(Glib::ustring get_location() const, gtk_printer_get_location)
64 _WRAP_METHOD(Glib::ustring get_icon_name() const, gtk_printer_get_icon_name)
65 _WRAP_METHOD(int get_job_count() const, gtk_printer_get_job_count)
66 _WRAP_METHOD(bool is_active() const, gtk_printer_is_active)
67 _WRAP_METHOD(bool is_paused() const, gtk_printer_is_paused)
68 _WRAP_METHOD(bool is_accepting_jobs() const, gtk_printer_is_accepting_jobs)
69 _WRAP_METHOD(bool is_virtual() const, gtk_printer_is_virtual)
70 _WRAP_METHOD(bool is_default() const, gtk_printer_is_default)
71 _WRAP_METHOD(bool accepts_pdf() const, gtk_printer_accepts_pdf)
72 _WRAP_METHOD(bool accepts_ps() const, gtk_printer_accepts_ps)
73 _IGNORE(gtk_printer_set_accepts_pdf, gtk_printer_set_accepts_ps)
74
75 #m4 _CONVERSION(`GList*', `std::vector< Glib::RefPtr<PageSetup> >', `Glib::ListHandler< Glib::RefPtr<PageSetup> >::list_to_vector($3, Glib::OWNERSHIP_DEEP)')
76 _WRAP_METHOD(std::vector< Glib::RefPtr<PageSetup> > list_papers(), gtk_printer_list_papers)
77
78 _WRAP_METHOD(Glib::RefPtr<PageSetup> get_default_page_size() const, gtk_printer_get_default_page_size, refreturn)
79
80 #m4 _CONVERSION(`GList*', `std::vector< Glib::RefPtr<const PageSetup> >', `Glib::ListHandler< Glib::RefPtr<const PageSetup> >::list_to_vector($3, Glib::OWNERSHIP_DEEP)')
81 _WRAP_METHOD(std::vector< Glib::RefPtr<const PageSetup> > list_papers() const, gtk_printer_list_papers)
82
83 _IGNORE(gtk_printer_compare)
84 _IGNORE(gtk_enumerate_printers)
85
86 _WRAP_METHOD(bool has_details() const, gtk_printer_has_details)
87 _WRAP_METHOD(void request_details(), gtk_printer_request_details)
88 _WRAP_METHOD(PrintCapabilities get_capabilities() const, gtk_printer_get_capabilities)
89 _WRAP_METHOD(bool get_hard_margins(double& top, double& bottom, double& left, double& right) const, gtk_printer_get_hard_margins)
90
91 _WRAP_SIGNAL(void details_acquired(bool success), "details_acquired")
92
93 _WRAP_PROPERTY("name", Glib::ustring)
94
95 //GtkPrintBackend is in a "semi-private" header:
96 //_WRAP_PROPERTY("backend", Glib::RefPtr<PrintBackend>)
97
98 _WRAP_PROPERTY("is_virtual", bool)
99 _WRAP_PROPERTY("state_message", Glib::ustring)
100 _WRAP_PROPERTY("location", Glib::ustring)
101 _WRAP_PROPERTY("icon_name", Glib::ustring)
102 _WRAP_PROPERTY("job_count", int)
103 _WRAP_PROPERTY("accepts-pdf", bool)
104 _WRAP_PROPERTY("accepts-ps", bool)
105 _WRAP_PROPERTY("paused", bool)
106 _WRAP_PROPERTY("accepting-jobs", bool)
107 };
108
109 /** @relates Gtk::Printer */
110 inline bool operator==(const Glib::RefPtr<Printer>& lhs, const Glib::RefPtr<Printer>& rhs)
111 { return lhs->equal(rhs); }
112
113 /** @relates Gtk::Printer */
114 inline bool operator!=(const Glib::RefPtr<Printer>& lhs, const Glib::RefPtr<Printer>& rhs)
115 { return !lhs->equal(rhs); }
116
117 /** For example,
118 * bool on_enumerate_printers(const Glib::RefPtr<Printer>& printer);
119 * @param printer A printer.
120 * @param result true to stop the enumeration, false to continue.
121 *
122 * @relates Gtk::Printer
123 */
124 typedef sigc::slot< bool, const Glib::RefPtr<Printer>& > SlotPrinterEnumerator;
125
126 /** Calls a function for all Printers. If the callback returns true, the enumeration is stopped.
127 * @param slot A function to call for each printer
128 * @param wait If true, wait in a recursive mainloop until all printers are enumerated; otherwise return early.
129 *
130 * @relates Gtk::Printer
131 */
132 GTKMM_API
133 void enumerate_printers(const SlotPrinterEnumerator& slot, bool wait = true);
134
135 } // namespace Gtk