| 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 <gtkmm/dialog.h> |
| 18 |
#include <gtkmm/pagesetup.h> |
| 19 |
#include <gtkmm/printer.h> |
| 20 |
#include <gtkmm/printjob.h> |
| 21 |
#include <gtkmm/printsettings.h> |
| 22 |
|
| 23 |
_DEFS(gtkmm,gtk) |
| 24 |
_PINCLUDE(gtkmm/private/dialog_p.h) |
| 25 |
|
| 26 |
namespace Gtk |
| 27 |
{ |
| 28 |
|
| 29 |
/** PrintUnixDialog implements a print dialog for platforms |
| 30 |
* which don't provide a native print dialog, like Unix. It can |
| 31 |
* be used very much like any other GTK+ dialog, at the cost of |
| 32 |
* the portability offered by the high-level printing API exposed |
| 33 |
* through PrintOperation. |
| 34 |
* |
| 35 |
* In order to print something with PrintUnixDialog, you need |
| 36 |
* to use get_selected_printer() to obtain a Printer object and |
| 37 |
* use it to construct a PrintJob using PrintJob::create(). |
| 38 |
* |
| 39 |
* PrintUnixDialog uses the following response values: |
| 40 |
* - RESPONSE_OK for the "Print" button |
| 41 |
* - RESPONSE_APPLY for the "Preview" button |
| 42 |
* - RESPONSE_CANCEL for the "Cancel" button |
| 43 |
* |
| 44 |
* @newin{2,10} |
| 45 |
* |
| 46 |
* @ingroup Printing |
| 47 |
*/ |
| 48 |
class GTKMM_API PrintUnixDialog : public Dialog |
| 49 |
{ |
| 50 |
_CLASS_GTKOBJECT(PrintUnixDialog, GtkPrintUnixDialog, GTK_PRINT_UNIX_DIALOG, Gtk::Dialog, GtkDialog, , , GTKMM_API) |
| 51 |
_UNMANAGEABLE |
| 52 |
_GTKMMPROC_WIN32_NO_WRAP |
| 53 |
|
| 54 |
public: |
| 55 |
explicit PrintUnixDialog(Gtk::Window& parent, const Glib::ustring& title); |
| 56 |
explicit PrintUnixDialog(const Glib::ustring& title); |
| 57 |
|
| 58 |
_WRAP_METHOD(void set_page_setup(const Glib::RefPtr<PageSetup>& page_setup), gtk_print_unix_dialog_set_page_setup) |
| 59 |
_WRAP_METHOD(Glib::RefPtr<PageSetup> get_page_setup(), gtk_print_unix_dialog_get_page_setup, refreturn) |
| 60 |
_WRAP_METHOD(Glib::RefPtr<const PageSetup> get_page_setup() const, gtk_print_unix_dialog_get_page_setup, refreturn, constversion) |
| 61 |
|
| 62 |
_WRAP_METHOD(void set_current_page(int current_page), gtk_print_unix_dialog_set_current_page) |
| 63 |
_WRAP_METHOD(int get_current_page() const, gtk_print_unix_dialog_get_current_page) |
| 64 |
|
| 65 |
_WRAP_METHOD(void set_settings(const Glib::RefPtr<PrintSettings>& settings), gtk_print_unix_dialog_set_settings) |
| 66 |
_WRAP_METHOD(Glib::RefPtr<PrintSettings> get_settings(), gtk_print_unix_dialog_get_settings, refreturn) |
| 67 |
_WRAP_METHOD(Glib::RefPtr<const PrintSettings> get_settings() const, gtk_print_unix_dialog_get_settings, refreturn, constversion) |
| 68 |
|
| 69 |
#m4 _CONVERSION(`GtkPrinter*',`Glib::RefPtr<Printer>',`Glib::wrap($3)') |
| 70 |
#m4 _CONVERSION(`GtkPrinter*',`Glib::RefPtr<const Printer>',`Glib::wrap($3)') |
| 71 |
|
| 72 |
_WRAP_METHOD(Glib::RefPtr<Printer> get_selected_printer(), gtk_print_unix_dialog_get_selected_printer, refreturn) |
| 73 |
_WRAP_METHOD(Glib::RefPtr<const Printer> get_selected_printer() const, gtk_print_unix_dialog_get_selected_printer, refreturn, constversion) |
| 74 |
|
| 75 |
void add_custom_tab(const Widget& child, const Glib::ustring& tab_label); |
| 76 |
_WRAP_METHOD(void add_custom_tab(const Widget& child, const Widget& tab_label), gtk_print_unix_dialog_add_custom_tab) |
| 77 |
_WRAP_METHOD(void set_manual_capabilities(PrintCapabilities capabilities), gtk_print_unix_dialog_set_manual_capabilities) |
| 78 |
_WRAP_METHOD(PrintCapabilities get_manual_capabilities() const, gtk_print_unix_dialog_get_manual_capabilities) |
| 79 |
|
| 80 |
_WRAP_METHOD(void get_support_selection(bool support_selection = true), gtk_print_unix_dialog_set_support_selection) |
| 81 |
_WRAP_METHOD(bool get_support_selection() const, gtk_print_unix_dialog_get_support_selection) |
| 82 |
_WRAP_METHOD(void set_has_selection(bool has_selection = true), gtk_print_unix_dialog_set_has_selection) |
| 83 |
_WRAP_METHOD(bool get_has_selection() const, gtk_print_unix_dialog_get_has_selection) |
| 84 |
_WRAP_METHOD(void set_embed_page_setup(bool embed = true), gtk_print_unix_dialog_set_embed_page_setup) |
| 85 |
_WRAP_METHOD(bool get_embed_page_setup() const, gtk_print_unix_dialog_get_embed_page_setup) |
| 86 |
_WRAP_METHOD(bool get_page_setup_set() const, gtk_print_unix_dialog_get_page_setup_set) |
| 87 |
|
| 88 |
_WRAP_PROPERTY("page_setup", Glib::RefPtr<PageSetup>) |
| 89 |
_WRAP_PROPERTY("current_page", int) |
| 90 |
_WRAP_PROPERTY("print_settings", Glib::RefPtr<PrintSettings>) |
| 91 |
_WRAP_PROPERTY("selected_printer", Glib::RefPtr<Printer>) |
| 92 |
_WRAP_PROPERTY("manual-capabilities", bool) |
| 93 |
_WRAP_PROPERTY("support-selection", bool) |
| 94 |
_WRAP_PROPERTY("has-selection", bool) |
| 95 |
_WRAP_PROPERTY("embed-page-setup", bool) |
| 96 |
|
| 97 |
}; |
| 98 |
|
| 99 |
} // namespace Gtk |