/* 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 #include #include #include #include _DEFS(gtkmm,gtk) _PINCLUDE(glibmm/private/object_p.h) namespace Gtk { /** A PrintJob object represents a job that is sent to a printer. You only need to deal * directly with print jobs if you use the non-portable PrintUnixDialog API. * * Use get_surface() to obtain the cairo surface onto which the pages must be drawn. * Use send() to send the finished job to the printer.If you don't use cairo then * PrintJob also supports printing of manually generated postscript, via set_source_file(). * * @newin{2,10} * * @ingroup Printing */ class GTKMM_API PrintJob : public Glib::Object { _CLASS_GOBJECT(PrintJob, GtkPrintJob, GTK_PRINT_JOB, Glib::Object, GObject, , , GTKMM_API) _GTKMMPROC_WIN32_NO_WRAP protected: _WRAP_CTOR(PrintJob(const Glib::ustring& title, const Glib::RefPtr& printer, const Glib::RefPtr& settings, const Glib::RefPtr& page_setup), gtk_print_job_new) public: _WRAP_CREATE(const Glib::ustring& title, const Glib::RefPtr& printer, const Glib::RefPtr& settings, const Glib::RefPtr& page_setup) _WRAP_METHOD(Glib::RefPtr get_settings(), gtk_print_job_get_settings, refreturn) _WRAP_METHOD(Glib::RefPtr get_settings() const, gtk_print_job_get_settings, refreturn, constversion) _WRAP_METHOD(Glib::RefPtr get_printer(), gtk_print_job_get_printer, refreturn) _WRAP_METHOD(Glib::RefPtr get_printer() const, gtk_print_job_get_printer, refreturn, constversion) _WRAP_METHOD(Glib::ustring get_title() const, gtk_print_job_get_title) _WRAP_METHOD(PrintStatus get_status() const, gtk_print_job_get_status) _WRAP_METHOD(void set_source_file(const std::string& filename), gtk_print_job_set_source_file, errthrow) #m4 _CONVERSION(`cairo_surface_t*',`Cairo::RefPtr',`Cairo::RefPtr(new Cairo::Surface($3, false /* take reference */))') #m4 _CONVERSION(`cairo_surface_t*',`Cairo::RefPtr',`Cairo::RefPtr(new Cairo::Surface($3, false /* take reference */))') _WRAP_METHOD(Cairo::RefPtr get_surface(), gtk_print_job_get_surface, errthrow) _WRAP_METHOD(Cairo::RefPtr get_surface() const, gtk_print_job_get_surface, errthrow) _WRAP_METHOD(void set_track_print_status(bool track_status = true), gtk_print_job_set_track_print_status) _WRAP_METHOD(bool get_track_print_status() const, gtk_print_job_get_track_print_status) /** For example, * void on_print_job_complete(const Glib::RefPtr& job); * * @throws exception */ typedef sigc::slot< void, const Glib::RefPtr& > SlotPrintJobComplete; /** Sends the print job off to the printer. * @param slot A function to call when the job completes or an error occurs. */ void send(const SlotPrintJobComplete& slot); _IGNORE(gtk_print_job_send) _WRAP_METHOD(PrintPages get_pages() const, gtk_print_job_get_pages) _WRAP_METHOD(void set_pages(PrintPages pages), gtk_print_job_set_pages) std::vector get_page_ranges() const; _IGNORE(gtk_print_job_get_page_ranges) void set_page_ranges(const std::vector& ranges); _IGNORE(gtk_print_job_set_page_ranges) _WRAP_METHOD(PageSet get_page_set() const, gtk_print_job_get_page_set) _WRAP_METHOD(void set_page_set(PageSet page_set), gtk_print_job_set_page_set) _WRAP_METHOD(int get_num_copies() const, gtk_print_job_get_num_copies) _WRAP_METHOD(void set_num_copies(int num_copies), gtk_print_job_set_num_copies) _WRAP_METHOD(double get_scale() const, gtk_print_job_get_scale) _WRAP_METHOD(void set_scale(double scale), gtk_print_job_set_scale) _WRAP_METHOD(guint get_n_up() const, gtk_print_job_get_n_up) _WRAP_METHOD(void set_n_up(guint n_up), gtk_print_job_set_n_up) _WRAP_METHOD(NumberUpLayout get_n_up_layout() const, gtk_print_job_get_n_up_layout) _WRAP_METHOD(void set_n_up_layout(NumberUpLayout layout), gtk_print_job_set_n_up_layout) _WRAP_METHOD(bool get_rotate() const, gtk_print_job_get_rotate) _WRAP_METHOD(void set_rotate(bool rotate = true), gtk_print_job_set_rotate) _WRAP_METHOD(bool get_collate() const, gtk_print_job_get_collate) _WRAP_METHOD(void set_collate(bool collate = true), gtk_print_job_set_collate) _WRAP_METHOD(bool get_reverse() const, gtk_print_job_get_reverse) _WRAP_METHOD(void set_reverse(bool reverse = true), gtk_print_job_set_reverse) _WRAP_SIGNAL(void status_changed(), "status_changed") _WRAP_PROPERTY("title", Glib::ustring) _WRAP_PROPERTY("printer", Glib::RefPtr) _WRAP_PROPERTY("settings", Glib::RefPtr) _WRAP_PROPERTY("page_setup", Glib::RefPtr) _WRAP_PROPERTY("track-print-status", bool) }; } // namespace Gtk