/* Copyright (C) 2006 The gtkmm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see . */ #include #include _DEFS(gtkmm,gtk) _PINCLUDE(glibmm/private/object_p.h) namespace Gtk { _WRAP_ENUM(PrintCapabilities, GtkPrintCapabilities) /** A Printer object represents a printer. You only need to deal directly with printers if you use the * non-portable PrintUnixDialog API. * * A Printer object allows to get status information about the printer, such as its description, its location, * the number of queued jobs, etc. Most importantly, a Printer object can be used to create a PrintJob object, * which lets you print to the printer. * * @newin{2,10} * * @ingroup Printing */ class GTKMM_API Printer : public Glib::Object { _CLASS_GOBJECT(Printer, GtkPrinter, GTK_PRINTER, Glib::Object, GObject, , , GTKMM_API) _GTKMMPROC_WIN32_NO_WRAP public: //TODO: _WRAP_CREATE() - probably not, it's only accessible through PrintUnixDialog + GtkPrintBackend should be ignored //TODO: I think these are not needed as well, and that Printer should generally be read-only - marko. _IGNORE(gtk_printer_is_new, gtk_printer_set_state_message, gtk_printer_set_is_default, gtk_printer_set_is_accepting_jobs, gtk_printer_set_is_paused) _IGNORE(gtk_printer_set_is_active, gtk_printer_set_has_details, gtk_printer_set_description) _IGNORE(gtk_printer_set_icon_name, gtk_printer_set_job_count, gtk_printer_set_is_new, gtk_printer_set_location) bool equal(const Glib::RefPtr& other) const; //GtkPrintBackend is in a "semi-private" header. //_WRAP_METHOD(Glib::RefPtr get_backend(), gtk_printer_get_backend, refreturn) //_WRAP_METHOD(Glib::RefPtr get_backend() const, gtk_printer_get_backend, refreturn, constversion) _IGNORE(gtk_printer_new, gtk_printer_get_backend) _WRAP_METHOD(Glib::ustring get_name() const, gtk_printer_get_name) _WRAP_METHOD(Glib::ustring get_state_message() const, gtk_printer_get_state_message) _WRAP_METHOD(Glib::ustring get_description() const, gtk_printer_get_description) _WRAP_METHOD(Glib::ustring get_location() const, gtk_printer_get_location) _WRAP_METHOD(Glib::ustring get_icon_name() const, gtk_printer_get_icon_name) _WRAP_METHOD(int get_job_count() const, gtk_printer_get_job_count) _WRAP_METHOD(bool is_active() const, gtk_printer_is_active) _WRAP_METHOD(bool is_paused() const, gtk_printer_is_paused) _WRAP_METHOD(bool is_accepting_jobs() const, gtk_printer_is_accepting_jobs) _WRAP_METHOD(bool is_virtual() const, gtk_printer_is_virtual) _WRAP_METHOD(bool is_default() const, gtk_printer_is_default) _WRAP_METHOD(bool accepts_pdf() const, gtk_printer_accepts_pdf) _WRAP_METHOD(bool accepts_ps() const, gtk_printer_accepts_ps) _IGNORE(gtk_printer_set_accepts_pdf, gtk_printer_set_accepts_ps) #m4 _CONVERSION(`GList*', `std::vector< Glib::RefPtr >', `Glib::ListHandler< Glib::RefPtr >::list_to_vector($3, Glib::OWNERSHIP_DEEP)') _WRAP_METHOD(std::vector< Glib::RefPtr > list_papers(), gtk_printer_list_papers) _WRAP_METHOD(Glib::RefPtr get_default_page_size() const, gtk_printer_get_default_page_size, refreturn) #m4 _CONVERSION(`GList*', `std::vector< Glib::RefPtr >', `Glib::ListHandler< Glib::RefPtr >::list_to_vector($3, Glib::OWNERSHIP_DEEP)') _WRAP_METHOD(std::vector< Glib::RefPtr > list_papers() const, gtk_printer_list_papers) _IGNORE(gtk_printer_compare) _IGNORE(gtk_enumerate_printers) _WRAP_METHOD(bool has_details() const, gtk_printer_has_details) _WRAP_METHOD(void request_details(), gtk_printer_request_details) _WRAP_METHOD(PrintCapabilities get_capabilities() const, gtk_printer_get_capabilities) _WRAP_METHOD(bool get_hard_margins(double& top, double& bottom, double& left, double& right) const, gtk_printer_get_hard_margins) _WRAP_SIGNAL(void details_acquired(bool success), "details_acquired") _WRAP_PROPERTY("name", Glib::ustring) //GtkPrintBackend is in a "semi-private" header: //_WRAP_PROPERTY("backend", Glib::RefPtr) _WRAP_PROPERTY("is_virtual", bool) _WRAP_PROPERTY("state_message", Glib::ustring) _WRAP_PROPERTY("location", Glib::ustring) _WRAP_PROPERTY("icon_name", Glib::ustring) _WRAP_PROPERTY("job_count", int) _WRAP_PROPERTY("accepts-pdf", bool) _WRAP_PROPERTY("accepts-ps", bool) _WRAP_PROPERTY("paused", bool) _WRAP_PROPERTY("accepting-jobs", bool) }; /** @relates Gtk::Printer */ inline bool operator==(const Glib::RefPtr& lhs, const Glib::RefPtr& rhs) { return lhs->equal(rhs); } /** @relates Gtk::Printer */ inline bool operator!=(const Glib::RefPtr& lhs, const Glib::RefPtr& rhs) { return !lhs->equal(rhs); } /** For example, * bool on_enumerate_printers(const Glib::RefPtr& printer); * @param printer A printer. * @param result true to stop the enumeration, false to continue. * * @relates Gtk::Printer */ typedef sigc::slot< bool, const Glib::RefPtr& > SlotPrinterEnumerator; /** Calls a function for all Printers. If the callback returns true, the enumeration is stopped. * @param slot A function to call for each printer * @param wait If true, wait in a recursive mainloop until all printers are enumerated; otherwise return early. * * @relates Gtk::Printer */ GTKMM_API void enumerate_printers(const SlotPrinterEnumerator& slot, bool wait = true); } // namespace Gtk