2 /* Copyright (C) 2006 The gtkmm Development Team
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the Free
16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #include <gtk/gtkprintoperation.h>
21 // This Signal Proxy allows the C++ coder to specify a sigc::slot instead of a static function.
24 SignalProxy_PrintSetupDone_gtk_callback(GtkPageSetup* page_setup, gpointer data)
26 const Gtk::SlotPrintSetupDone* the_slot = static_cast<Gtk::SlotPrintSetupDone*>(data);
28 #ifdef GLIBMM_EXCEPTIONS_ENABLED
31 #endif //GLIBMM_EXCEPTIONS_ENABLED
32 Glib::RefPtr<Gtk::PageSetup> ps = Glib::wrap(page_setup);
34 #ifdef GLIBMM_EXCEPTIONS_ENABLED
38 Glib::exception_handlers_invoke();
40 #endif //GLIBMM_EXCEPTIONS_ENABLED
49 #ifdef GLIBMM_EXCEPTIONS_ENABLED
50 PrintOperation::run(PrintOperationAction action)
52 PrintOperation::run(PrintOperationAction action, std::auto_ptr<Glib::Error>& error)
53 #endif //GLIBMM_EXCEPTIONS_ENABLED
56 PrintOperationResult res =
57 (PrintOperationResult)gtk_print_operation_run(this->gobj(), (GtkPrintOperationAction)action, 0, &gerror);
59 #ifdef GLIBMM_EXCEPTIONS_ENABLED
60 if (res == PRINT_OPERATION_RESULT_ERROR)
62 gtk_print_operation_get_error(this->gobj(), &gerror);
63 ::Glib::Error::throw_exception(gerror);
66 if (res == PRINT_OPERATION_RESULT_ERROR)
68 gtk_print_operation_get_error(this->gobj(), &gerror);
69 error = ::Glib::Error::throw_exception(gerror);
71 #endif //GLIBMM_EXCEPTIONS_ENABLED
76 Glib::RefPtr<PageSetup>
77 run_page_setup_dialog(Window& parent,
78 const Glib::RefPtr<const PageSetup>& page_setup,
79 const Glib::RefPtr<const PrintSettings>& print_settings)
81 // Specify the exact type with template specialization, to avoid possible
82 // ambiguities between the const and non-const versions of unwrap() reported
83 // by Sun's compiler (specifying unwrap<const Object> was reported
86 gtk_print_run_page_setup_dialog(
88 const_cast<GtkPageSetup*>(Glib::unwrap<PageSetup>(page_setup)),
89 const_cast<GtkPrintSettings*>(Glib::unwrap<PrintSettings>(print_settings))));
94 run_page_setup_dialog_async(Window& parent,
95 const Glib::RefPtr<const PageSetup>& page_setup,
96 const Glib::RefPtr<const PrintSettings>& print_settings,
97 const SlotPrintSetupDone& slot)
99 SlotPrintSetupDone* slot_copy = new SlotPrintSetupDone(slot);
101 // Specify the exact type with template specialization, to avoid possible
102 // ambiguities between the const and non-const versions of unwrap() reported
103 // by Sun's compiler (specifying unwrap<const Object> was reported
105 gtk_print_run_page_setup_dialog_async(
107 const_cast<GtkPageSetup*>(Glib::unwrap<PageSetup>(page_setup)),
108 const_cast<GtkPrintSettings*>(Glib::unwrap<PrintSettings>(print_settings)),
109 &SignalProxy_PrintSetupDone_gtk_callback,