diff options
author | Matthias Clasen <mclasen@redhat.com> | 2011-01-30 02:34:59 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2011-01-30 02:34:59 -0500 |
commit | 837c504a118eeab9c820ce629ee9a128d49f08a5 (patch) | |
tree | 362e6b327a371f2ad4da4a6c89607b48bd01f664 /gtk/gtkprintoperation.c | |
parent | 701075b2c891d0199e04ebff13d5b5845ff5c652 (diff) | |
download | gtk+-837c504a118eeab9c820ce629ee9a128d49f08a5.tar.gz |
Move GtkPrintOperation docs inline
Diffstat (limited to 'gtk/gtkprintoperation.c')
-rw-r--r-- | gtk/gtkprintoperation.c | 72 |
1 files changed, 71 insertions, 1 deletions
diff --git a/gtk/gtkprintoperation.c b/gtk/gtkprintoperation.c index 15eadf1c38..ff95003570 100644 --- a/gtk/gtkprintoperation.c +++ b/gtk/gtkprintoperation.c @@ -35,10 +35,80 @@ #include "gtkmessagedialog.h" #include "gtktypebuiltins.h" +/** + * SECTION:gtkprintoperation + * @Title: GtkPrintOperation + * @Short_description: High-level Printing API + * @See_also: #GtkPrintContext, #GtkPrintUnixDialog + * + * 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. + * + * 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. + * + * 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 + * #GtkPrintOperation::draw-page, which you are supposed to catch + * and render the page on the provided #GtkPrintContext using Cairo. + * + * <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_PRINT_OPERATION_ACTION_PRINT_DIALOG, + * 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> + * + * By default GtkPrintOperation uses an external application to do + * print preview. To implement a custom print preview, an application + * must connect to the preview signal. The functions + * gtk_print_operation_print_preview_render_page(), + * gtk_print_operation_preview_end_preview() and + * gtk_print_operation_preview_is_selected() + * are useful when implementing a print preview. + */ + #define SHOW_PROGRESS_TIME 1200 -enum +enum { DONE, BEGIN_PRINT, |