2008-07-01 22:57:50 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
2006-04-21 15:09:32 +00:00
|
|
|
* gtkprintoperation.h: Print Operation
|
|
|
|
* Copyright (C) 2006, Red Hat, Inc.
|
|
|
|
*
|
|
|
|
* 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 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, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2009-10-21 18:30:04 +00:00
|
|
|
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
2008-05-28 15:07:04 +00:00
|
|
|
#error "Only <gtk/gtk.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
2006-04-21 15:09:32 +00:00
|
|
|
#ifndef __GTK_PRINT_OPERATION_H__
|
|
|
|
#define __GTK_PRINT_OPERATION_H__
|
|
|
|
|
2008-10-30 16:34:16 +00:00
|
|
|
|
2006-04-21 15:09:32 +00:00
|
|
|
#include <cairo.h>
|
2008-06-13 14:26:44 +00:00
|
|
|
#include <gtk/gtkmain.h>
|
|
|
|
#include <gtk/gtkwindow.h>
|
|
|
|
#include <gtk/gtkpagesetup.h>
|
|
|
|
#include <gtk/gtkprintsettings.h>
|
|
|
|
#include <gtk/gtkprintcontext.h>
|
|
|
|
#include <gtk/gtkprintoperationpreview.h>
|
2006-04-21 15:09:32 +00:00
|
|
|
|
2008-10-30 16:34:16 +00:00
|
|
|
|
2006-04-21 15:09:32 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2011-01-30 07:36:17 +00:00
|
|
|
#define GTK_TYPE_PRINT_OPERATION (gtk_print_operation_get_type ())
|
|
|
|
#define GTK_PRINT_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PRINT_OPERATION, GtkPrintOperation))
|
|
|
|
#define GTK_PRINT_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PRINT_OPERATION, GtkPrintOperationClass))
|
|
|
|
#define GTK_IS_PRINT_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PRINT_OPERATION))
|
|
|
|
#define GTK_IS_PRINT_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PRINT_OPERATION))
|
|
|
|
#define GTK_PRINT_OPERATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PRINT_OPERATION, GtkPrintOperationClass))
|
2006-04-21 15:09:32 +00:00
|
|
|
|
|
|
|
typedef struct _GtkPrintOperationClass GtkPrintOperationClass;
|
|
|
|
typedef struct _GtkPrintOperationPrivate GtkPrintOperationPrivate;
|
|
|
|
typedef struct _GtkPrintOperation GtkPrintOperation;
|
|
|
|
|
2011-01-30 07:34:59 +00:00
|
|
|
/**
|
|
|
|
* GtkPrintStatus:
|
|
|
|
* @GTK_PRINT_STATUS_INITIAL: The printing has not started yet; this
|
|
|
|
* status is set initially, and while the print dialog is shown.
|
|
|
|
* @GTK_PRINT_STATUS_PREPARING: This status is set while the begin-print
|
|
|
|
* signal is emitted and during pagination.
|
|
|
|
* @GTK_PRINT_STATUS_GENERATING_DATA: This status is set while the
|
|
|
|
* pages are being rendered.
|
|
|
|
* @GTK_PRINT_STATUS_SENDING_DATA: The print job is being sent off to the
|
|
|
|
* printer.
|
|
|
|
* @GTK_PRINT_STATUS_PENDING: The print job has been sent to the printer,
|
|
|
|
* but is not printed for some reason, e.g. the printer may be stopped.
|
|
|
|
* @GTK_PRINT_STATUS_PENDING_ISSUE: Some problem has occurred during
|
|
|
|
* printing, e.g. a paper jam.
|
|
|
|
* @GTK_PRINT_STATUS_PRINTING: The printer is processing the print job.
|
|
|
|
* @GTK_PRINT_STATUS_FINISHED: The printing has been completed successfully.
|
|
|
|
* @GTK_PRINT_STATUS_FINISHED_ABORTED: The printing has been aborted.
|
|
|
|
*
|
|
|
|
* The status gives a rough indication of the completion of a running
|
|
|
|
* print operation.
|
|
|
|
*/
|
2006-04-21 15:09:32 +00:00
|
|
|
typedef enum {
|
|
|
|
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
|
|
|
|
} GtkPrintStatus;
|
|
|
|
|
2011-01-30 07:34:59 +00:00
|
|
|
/**
|
|
|
|
* GtkPrintOperationResult:
|
|
|
|
* @GTK_PRINT_OPERATION_RESULT_ERROR: An error has occured.
|
|
|
|
* @GTK_PRINT_OPERATION_RESULT_APPLY: The print settings should be stored.
|
|
|
|
* @GTK_PRINT_OPERATION_RESULT_CANCEL: The print operation has been canceled,
|
|
|
|
* the print settings should not be stored.
|
|
|
|
* @GTK_PRINT_OPERATION_RESULT_IN_PROGRESS: The print operation is not complete
|
|
|
|
* yet. This value will only be returned when running asynchronously.
|
|
|
|
*
|
|
|
|
* A value of this type is returned by gtk_print_operation_run().
|
|
|
|
*/
|
2006-06-07 15:09:03 +00:00
|
|
|
typedef enum {
|
|
|
|
GTK_PRINT_OPERATION_RESULT_ERROR,
|
|
|
|
GTK_PRINT_OPERATION_RESULT_APPLY,
|
|
|
|
GTK_PRINT_OPERATION_RESULT_CANCEL,
|
|
|
|
GTK_PRINT_OPERATION_RESULT_IN_PROGRESS
|
|
|
|
} GtkPrintOperationResult;
|
|
|
|
|
2011-01-30 07:34:59 +00:00
|
|
|
/**
|
|
|
|
* GtkPrintOperationAction:
|
|
|
|
* @GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG: Show the print dialog.
|
|
|
|
* @GTK_PRINT_OPERATION_ACTION_PRINT: Start to print without showing
|
|
|
|
* the print dialog, based on the current print settings.
|
|
|
|
* @GTK_PRINT_OPERATION_ACTION_PREVIEW: Show the print preview.
|
|
|
|
* @GTK_PRINT_OPERATION_ACTION_EXPORT: Export to a file. This requires
|
|
|
|
* the export-filename property to be set.
|
|
|
|
*
|
|
|
|
* The @action parameter to gtk_print_operation_run()
|
|
|
|
* determines what action the print operation should perform.
|
|
|
|
*/
|
2006-06-07 15:09:03 +00:00
|
|
|
typedef enum {
|
|
|
|
GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
|
|
|
|
GTK_PRINT_OPERATION_ACTION_PRINT,
|
|
|
|
GTK_PRINT_OPERATION_ACTION_PREVIEW,
|
2006-06-11 02:45:49 +00:00
|
|
|
GTK_PRINT_OPERATION_ACTION_EXPORT
|
2006-06-07 15:09:03 +00:00
|
|
|
} GtkPrintOperationAction;
|
|
|
|
|
|
|
|
|
2006-04-21 15:09:32 +00:00
|
|
|
struct _GtkPrintOperation
|
|
|
|
{
|
|
|
|
GObject parent_instance;
|
2008-05-28 15:35:43 +00:00
|
|
|
|
2010-10-26 04:35:10 +00:00
|
|
|
/*< private >*/
|
2010-07-14 00:07:04 +00:00
|
|
|
GtkPrintOperationPrivate *priv;
|
2006-04-21 15:09:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GtkPrintOperationClass
|
|
|
|
{
|
|
|
|
GObjectClass parent_class;
|
2008-05-28 15:35:43 +00:00
|
|
|
|
2006-06-07 15:09:03 +00:00
|
|
|
void (*done) (GtkPrintOperation *operation,
|
2011-01-30 07:36:17 +00:00
|
|
|
GtkPrintOperationResult result);
|
2008-05-28 15:35:43 +00:00
|
|
|
void (*begin_print) (GtkPrintOperation *operation,
|
2011-01-30 07:36:17 +00:00
|
|
|
GtkPrintContext *context);
|
2008-05-28 15:35:43 +00:00
|
|
|
gboolean (*paginate) (GtkPrintOperation *operation,
|
2011-01-30 07:36:17 +00:00
|
|
|
GtkPrintContext *context);
|
2006-05-18 20:09:05 +00:00
|
|
|
void (*request_page_setup) (GtkPrintOperation *operation,
|
2011-01-30 07:36:17 +00:00
|
|
|
GtkPrintContext *context,
|
|
|
|
gint page_nr,
|
|
|
|
GtkPageSetup *setup);
|
2006-05-18 20:09:05 +00:00
|
|
|
void (*draw_page) (GtkPrintOperation *operation,
|
2011-01-30 07:36:17 +00:00
|
|
|
GtkPrintContext *context,
|
|
|
|
gint page_nr);
|
2006-05-18 20:09:05 +00:00
|
|
|
void (*end_print) (GtkPrintOperation *operation,
|
2011-01-30 07:36:17 +00:00
|
|
|
GtkPrintContext *context);
|
2006-05-18 20:09:05 +00:00
|
|
|
void (*status_changed) (GtkPrintOperation *operation);
|
2006-05-22 17:19:10 +00:00
|
|
|
|
|
|
|
GtkWidget *(*create_custom_widget) (GtkPrintOperation *operation);
|
|
|
|
void (*custom_widget_apply) (GtkPrintOperation *operation,
|
2011-01-30 07:36:17 +00:00
|
|
|
GtkWidget *widget);
|
2006-06-02 15:16:13 +00:00
|
|
|
|
2011-01-30 07:36:17 +00:00
|
|
|
gboolean (*preview) (GtkPrintOperation *operation,
|
|
|
|
GtkPrintOperationPreview *preview,
|
|
|
|
GtkPrintContext *context,
|
|
|
|
GtkWindow *parent);
|
2006-06-02 15:16:13 +00:00
|
|
|
|
2009-04-21 11:06:49 +00:00
|
|
|
void (*update_custom_widget) (GtkPrintOperation *operation,
|
|
|
|
GtkWidget *widget,
|
|
|
|
GtkPageSetup *setup,
|
|
|
|
GtkPrintSettings *settings);
|
|
|
|
|
2006-04-21 15:09:32 +00:00
|
|
|
/* Padding for future expansion */
|
|
|
|
void (*_gtk_reserved1) (void);
|
|
|
|
void (*_gtk_reserved2) (void);
|
|
|
|
void (*_gtk_reserved3) (void);
|
|
|
|
void (*_gtk_reserved4) (void);
|
|
|
|
void (*_gtk_reserved5) (void);
|
|
|
|
void (*_gtk_reserved6) (void);
|
2010-10-19 17:07:36 +00:00
|
|
|
void (*_gtk_reserved7) (void);
|
|
|
|
void (*_gtk_reserved8) (void);
|
2006-04-21 15:09:32 +00:00
|
|
|
};
|
|
|
|
|
2011-01-30 07:34:59 +00:00
|
|
|
/**
|
|
|
|
* GTK_PRINT_ERROR:
|
|
|
|
*
|
|
|
|
* The error domain for #GtkPrintError errors.
|
|
|
|
*/
|
2006-04-21 15:09:32 +00:00
|
|
|
#define GTK_PRINT_ERROR gtk_print_error_quark ()
|
|
|
|
|
2011-01-30 07:34:59 +00:00
|
|
|
/**
|
|
|
|
* GtkPrintError:
|
|
|
|
* @GTK_PRINT_ERROR_GENERAL: An unspecified error occurred.
|
|
|
|
* @GTK_PRINT_ERROR_INTERNAL_ERROR: An internal error occurred.
|
|
|
|
* @GTK_PRINT_ERROR_NOMEM: A memory allocation failed.
|
|
|
|
* @GTK_PRINT_ERROR_INVALID_FILE: An error occurred while loading a page setup
|
|
|
|
* or paper size from a key file.
|
|
|
|
*
|
|
|
|
* Error codes that identify various errors that can occur while
|
|
|
|
* using the GTK+ printing support.
|
|
|
|
*/
|
2006-04-21 15:09:32 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GTK_PRINT_ERROR_GENERAL,
|
|
|
|
GTK_PRINT_ERROR_INTERNAL_ERROR,
|
2007-04-29 06:23:58 +00:00
|
|
|
GTK_PRINT_ERROR_NOMEM,
|
|
|
|
GTK_PRINT_ERROR_INVALID_FILE
|
2006-04-21 15:09:32 +00:00
|
|
|
} GtkPrintError;
|
|
|
|
|
|
|
|
GQuark gtk_print_error_quark (void);
|
|
|
|
|
|
|
|
GType gtk_print_operation_get_type (void) G_GNUC_CONST;
|
|
|
|
GtkPrintOperation * gtk_print_operation_new (void);
|
|
|
|
void gtk_print_operation_set_default_page_setup (GtkPrintOperation *op,
|
2011-01-30 07:36:17 +00:00
|
|
|
GtkPageSetup *default_page_setup);
|
2006-04-21 15:09:32 +00:00
|
|
|
GtkPageSetup * gtk_print_operation_get_default_page_setup (GtkPrintOperation *op);
|
|
|
|
void gtk_print_operation_set_print_settings (GtkPrintOperation *op,
|
2011-01-30 07:36:17 +00:00
|
|
|
GtkPrintSettings *print_settings);
|
2006-04-21 15:09:32 +00:00
|
|
|
GtkPrintSettings * gtk_print_operation_get_print_settings (GtkPrintOperation *op);
|
|
|
|
void gtk_print_operation_set_job_name (GtkPrintOperation *op,
|
2011-01-30 07:36:17 +00:00
|
|
|
const gchar *job_name);
|
2006-05-12 09:47:58 +00:00
|
|
|
void gtk_print_operation_set_n_pages (GtkPrintOperation *op,
|
2011-01-30 07:36:17 +00:00
|
|
|
gint n_pages);
|
2006-04-21 15:09:32 +00:00
|
|
|
void gtk_print_operation_set_current_page (GtkPrintOperation *op,
|
2011-01-30 07:36:17 +00:00
|
|
|
gint current_page);
|
2006-04-21 15:09:32 +00:00
|
|
|
void gtk_print_operation_set_use_full_page (GtkPrintOperation *op,
|
2011-01-30 07:36:17 +00:00
|
|
|
gboolean full_page);
|
2006-04-21 15:09:32 +00:00
|
|
|
void gtk_print_operation_set_unit (GtkPrintOperation *op,
|
2011-01-30 07:36:17 +00:00
|
|
|
GtkUnit unit);
|
2006-06-08 16:37:39 +00:00
|
|
|
void gtk_print_operation_set_export_filename (GtkPrintOperation *op,
|
2011-01-30 07:36:17 +00:00
|
|
|
const gchar *filename);
|
2006-05-15 16:22:38 +00:00
|
|
|
void gtk_print_operation_set_track_print_status (GtkPrintOperation *op,
|
2011-01-30 07:36:17 +00:00
|
|
|
gboolean track_status);
|
2006-05-23 16:30:45 +00:00
|
|
|
void gtk_print_operation_set_show_progress (GtkPrintOperation *op,
|
2011-01-30 07:36:17 +00:00
|
|
|
gboolean show_progress);
|
2006-06-07 15:09:03 +00:00
|
|
|
void gtk_print_operation_set_allow_async (GtkPrintOperation *op,
|
2011-01-30 07:36:17 +00:00
|
|
|
gboolean allow_async);
|
2006-05-24 16:15:15 +00:00
|
|
|
void gtk_print_operation_set_custom_tab_label (GtkPrintOperation *op,
|
2011-01-30 07:36:17 +00:00
|
|
|
const gchar *label);
|
2006-04-21 15:09:32 +00:00
|
|
|
GtkPrintOperationResult gtk_print_operation_run (GtkPrintOperation *op,
|
2011-01-30 07:36:17 +00:00
|
|
|
GtkPrintOperationAction action,
|
|
|
|
GtkWindow *parent,
|
|
|
|
GError **error);
|
2006-06-08 17:01:28 +00:00
|
|
|
void gtk_print_operation_get_error (GtkPrintOperation *op,
|
2011-01-30 07:36:17 +00:00
|
|
|
GError **error);
|
2006-04-21 15:09:32 +00:00
|
|
|
GtkPrintStatus gtk_print_operation_get_status (GtkPrintOperation *op);
|
2011-06-06 18:13:44 +00:00
|
|
|
const gchar * gtk_print_operation_get_status_string (GtkPrintOperation *op);
|
2006-04-21 15:09:32 +00:00
|
|
|
gboolean gtk_print_operation_is_finished (GtkPrintOperation *op);
|
2006-05-19 19:25:51 +00:00
|
|
|
void gtk_print_operation_cancel (GtkPrintOperation *op);
|
2008-12-19 16:42:05 +00:00
|
|
|
void gtk_print_operation_draw_page_finish (GtkPrintOperation *op);
|
|
|
|
void gtk_print_operation_set_defer_drawing (GtkPrintOperation *op);
|
2009-06-08 13:37:32 +00:00
|
|
|
void gtk_print_operation_set_support_selection (GtkPrintOperation *op,
|
|
|
|
gboolean support_selection);
|
|
|
|
gboolean gtk_print_operation_get_support_selection (GtkPrintOperation *op);
|
|
|
|
void gtk_print_operation_set_has_selection (GtkPrintOperation *op,
|
|
|
|
gboolean has_selection);
|
|
|
|
gboolean gtk_print_operation_get_has_selection (GtkPrintOperation *op);
|
2009-07-10 09:28:31 +00:00
|
|
|
void gtk_print_operation_set_embed_page_setup (GtkPrintOperation *op,
|
2011-01-30 07:36:17 +00:00
|
|
|
gboolean embed);
|
2009-07-10 09:28:31 +00:00
|
|
|
gboolean gtk_print_operation_get_embed_page_setup (GtkPrintOperation *op);
|
2009-08-05 18:20:05 +00:00
|
|
|
gint gtk_print_operation_get_n_pages_to_print (GtkPrintOperation *op);
|
2006-04-21 15:09:32 +00:00
|
|
|
|
|
|
|
GtkPageSetup *gtk_print_run_page_setup_dialog (GtkWindow *parent,
|
2011-01-30 07:36:17 +00:00
|
|
|
GtkPageSetup *page_setup,
|
|
|
|
GtkPrintSettings *settings);
|
2006-04-21 15:09:32 +00:00
|
|
|
|
2011-01-18 05:28:24 +00:00
|
|
|
/**
|
|
|
|
* GtkPageSetupDoneFunc:
|
|
|
|
* @page_setup: the #GtkPageSetup that has been
|
2011-01-30 07:36:17 +00:00
|
|
|
* @data: (closure): user data that has been passed to
|
|
|
|
* gtk_print_run_page_setup_dialog_async()
|
2011-01-18 05:28:24 +00:00
|
|
|
*
|
|
|
|
* The type of function that is passed to
|
2011-01-30 07:36:17 +00:00
|
|
|
* gtk_print_run_page_setup_dialog_async().
|
|
|
|
*
|
|
|
|
* This function will be called when the page setup dialog
|
|
|
|
* is dismissed, and also serves as destroy notify for @data.
|
2011-01-18 05:28:24 +00:00
|
|
|
*/
|
2008-05-28 15:35:43 +00:00
|
|
|
typedef void (* GtkPageSetupDoneFunc) (GtkPageSetup *page_setup,
|
2011-01-30 07:36:17 +00:00
|
|
|
gpointer data);
|
2006-04-24 20:44:22 +00:00
|
|
|
|
|
|
|
void gtk_print_run_page_setup_dialog_async (GtkWindow *parent,
|
2011-01-30 07:36:17 +00:00
|
|
|
GtkPageSetup *page_setup,
|
|
|
|
GtkPrintSettings *settings,
|
2006-04-24 20:44:22 +00:00
|
|
|
GtkPageSetupDoneFunc done_cb,
|
|
|
|
gpointer data);
|
|
|
|
|
2006-04-21 15:09:32 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GTK_PRINT_OPERATION_H__ */
|