forked from AuroraMiddleware/gtk
27f746fbd0
2006-04-21 Alexander Larsson <alexl@redhat.com> Merge the gtk-printing branch. For more detailed ChangeLog entries, see the branch. * .cvsignore: * Makefile.am: * configure.in: * docs/tools/widgets.c: * gtk+-unix-print-2.0.pc.in: * gtk/Makefile.am: * gtk/gen-paper-names.c: * gtk/gtk.h: * gtk/gtk.symbols: * gtk/gtkenums.h: * gtk/gtkiconfactory.c: * gtk/gtkmarshalers.list: * gtk/gtkpagesetup.[ch]: * gtk/gtkpagesetupunixdialog.[ch]: * gtk/gtkpapersize.[ch]: * gtk/gtkprint-win32.[ch]: * gtk/gtkprintbackend.[ch]: * gtk/gtkprintcontext.[ch]: * gtk/gtkprinter-private.h: * gtk/gtkprinter.[ch]: * gtk/gtkprinteroption.[ch]: * gtk/gtkprinteroptionset.[ch]: * gtk/gtkprinteroptionwidget.[ch]: * gtk/gtkprintjob.[ch]: * gtk/gtkprintoperation-private.h: * gtk/gtkprintoperation-unix.c: * gtk/gtkprintoperation-win32.c: * gtk/gtkprintoperation.[ch]: * gtk/gtkprintsettings.[ch]: * gtk/gtkprintunixdialog.[ch]: * gtk/paper_names.c: * gtk/paper_names_offsets.c: Platform independent printing API and implementations for unix and windows. * gtk/gtkstock.h: * gtk/stock-icons/24/gtk-orientation-landscape.png: * gtk/stock-icons/24/gtk-orientation-portrait.png: * gtk/stock-icons/24/gtk-orientation-reverse-landscape.png: Add stock icons for page orientation. * modules/Makefile.am: * modules/printbackends/Makefile.am: * modules/printbackends/cups/Makefile.am: * modules/printbackends/cups/gtkcupsutils.[ch]: * modules/printbackends/cups/gtkprintbackendcups.[ch]: * modules/printbackends/cups/gtkprintercups.[ch]: Cups printing backend for unix. * modules/printbackends/lpr/Makefile.am: * modules/printbackends/lpr/gtkprintbackendlpr.[ch]: lpr printing backend for unix. * modules/printbackends/pdf/Makefile.am: * modules/printbackends/pdf/gtkprintbackendpdf.[ch]: print-to-pdf printing backend for unix. * tests/.cvsignore: * tests/Makefile.am: * tests/print-editor.c: Test application for printing. * gdk/gdk.symbols: * gdk/win32/gdkevents-win32.c: * gdk/win32/gdkwin32.h: Add gdk_win32_set_modal_dialog_libgtk_only so that we can pump the mainloop while displaying a win32 common dialog. * gdk/directfb/Makefile.am: Whitespace cleanup.
322 lines
5.5 KiB
Plaintext
322 lines
5.5 KiB
Plaintext
<!-- ##### SECTION Title ##### -->
|
|
GtkPrintOperation
|
|
|
|
<!-- ##### SECTION Short_Description ##### -->
|
|
High-level Printing API
|
|
|
|
<!-- ##### SECTION Long_Description ##### -->
|
|
<para>
|
|
GtkPrintOperation is the high-level, portable printing API. It looks
|
|
a bit different than other GTK+ dialogs such as the #GtkFileChooser,
|
|
since some platforms don't expose enough infrastructure to implement
|
|
a good print dialog. On such platforms, GtkPrintOperation uses the
|
|
native print dialog. On platforms which do not provide a native
|
|
print dialog, GTK+ uses its own, see #GtkPrintUnixDialog.
|
|
</para>
|
|
|
|
<para>
|
|
The typical way to use the high-level printing API is to create a
|
|
#GtkPrintOperation object with gtk_print_operation_new() when the user
|
|
selects to print. Then you set some properties on it, e.g. the page size,
|
|
any #GtkPrintSettings from previous print operations, the number of pages,
|
|
the current page, etc.
|
|
</para>
|
|
<para>
|
|
Then you start the print operation by calling gtk_print_operation_run().
|
|
It will then show a dialog, let the user select a printer and options.
|
|
When the user finished the dialog various signals will be emitted on the
|
|
#GtkPrintOperation, the main one being ::draw-page, which you are supposed
|
|
to catch and render the page on the provided #GtkPrintContext using Cairo.
|
|
</para>
|
|
|
|
<example>
|
|
<title>The high-level printing API</title>
|
|
<programlisting>
|
|
static GtkPrintSettings *settings = NULL;
|
|
|
|
static void
|
|
do_print (void)
|
|
{
|
|
GtkPrintOperation *print;
|
|
GtkPrintOperationResult res;
|
|
|
|
print = gtk_print_operation_new (<!-- -->);
|
|
|
|
if (settings != NULL)
|
|
gtk_print_operation_set_print_settings (print, settings);
|
|
|
|
g_signal_connect (print, "begin_print", G_CALLBACK (begin_print), NULL);
|
|
g_signal_connect (print, "draw_page", G_CALLBACK (draw_page), NULL);
|
|
|
|
res = gtk_print_operation_run (print, GTK_WINDOW (main_window), NULL);
|
|
|
|
if (res == GTK_PRINT_OPERATION_RESULT_APPLY)
|
|
{
|
|
if (settings != NULL)
|
|
g_object_unref (settings);
|
|
settings = g_object_ref (gtk_print_operation_get_print_settings (print));
|
|
}
|
|
|
|
g_object_unref (print);
|
|
}
|
|
|
|
</programlisting>
|
|
</example>
|
|
|
|
<para>
|
|
Printing support was added in GTK+ 2.10.
|
|
</para>
|
|
|
|
|
|
<!-- ##### SECTION See_Also ##### -->
|
|
<para>
|
|
#GtkPrintContext, #GtkPrintUnixDialog
|
|
</para>
|
|
|
|
<!-- ##### SECTION Stability_Level ##### -->
|
|
|
|
|
|
<!-- ##### STRUCT GtkPrintOperation ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
|
|
<!-- ##### SIGNAL GtkPrintOperation::begin-print ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@printoperation: the object which received the signal.
|
|
@arg1:
|
|
|
|
<!-- ##### SIGNAL GtkPrintOperation::draw-page ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@printoperation: the object which received the signal.
|
|
@arg1:
|
|
@arg2:
|
|
|
|
<!-- ##### SIGNAL GtkPrintOperation::end-print ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@printoperation: the object which received the signal.
|
|
@arg1:
|
|
|
|
<!-- ##### SIGNAL GtkPrintOperation::request-page-setup ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@printoperation: the object which received the signal.
|
|
@arg1:
|
|
@arg2:
|
|
@arg3:
|
|
|
|
<!-- ##### SIGNAL GtkPrintOperation::status-changed ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@printoperation: the object which received the signal.
|
|
|
|
<!-- ##### ENUM GtkPrintStatus ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@GTK_PRINT_STATUS_INITIAL:
|
|
@GTK_PRINT_STATUS_PREPARING:
|
|
@GTK_PRINT_STATUS_GENERATING_DATA:
|
|
@GTK_PRINT_STATUS_SENDING_DATA:
|
|
@GTK_PRINT_STATUS_PENDING:
|
|
@GTK_PRINT_STATUS_PENDING_ISSUE:
|
|
@GTK_PRINT_STATUS_PRINTING:
|
|
@GTK_PRINT_STATUS_FINISHED:
|
|
@GTK_PRINT_STATUS_FINISHED_ABORTED:
|
|
|
|
<!-- ##### ENUM GtkPrintOperationResult ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@GTK_PRINT_OPERATION_RESULT_ERROR:
|
|
@GTK_PRINT_OPERATION_RESULT_APPLY:
|
|
@GTK_PRINT_OPERATION_RESULT_CANCEL:
|
|
|
|
<!-- ##### ENUM GtkPrintError ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@GTK_PRINT_ERROR_GENERAL:
|
|
@GTK_PRINT_ERROR_INTERNAL_ERROR:
|
|
@GTK_PRINT_ERROR_NOMEM:
|
|
|
|
<!-- ##### MACRO GTK_PRINT_ERROR ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_print_error_quark ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@Returns:
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_print_operation_new ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@Returns:
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_print_operation_set_default_page_setup ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@op:
|
|
@default_page_setup:
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_print_operation_get_default_page_setup ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@op:
|
|
@Returns:
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_print_operation_set_print_settings ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@op:
|
|
@print_settings:
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_print_operation_get_print_settings ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@op:
|
|
@Returns:
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_print_operation_set_job_name ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@op:
|
|
@job_name:
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_print_operation_set_nr_of_pages ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@op:
|
|
@n_pages:
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_print_operation_set_current_page ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@op:
|
|
@current_page:
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_print_operation_set_use_full_page ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@op:
|
|
@full_page:
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_print_operation_set_unit ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@op:
|
|
@unit:
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_print_operation_set_show_dialog ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@op:
|
|
@show_dialog:
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_print_operation_set_pdf_target ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@op:
|
|
@filename:
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_print_operation_run ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@op:
|
|
@parent:
|
|
@error:
|
|
@Returns:
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_print_operation_get_status ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@op:
|
|
@Returns:
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_print_operation_is_finished ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@op:
|
|
@Returns:
|
|
|
|
|
|
<!-- ##### FUNCTION gtk_print_run_page_setup_dialog ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@parent:
|
|
@page_setup:
|
|
@settings:
|
|
@Returns:
|
|
|
|
|