1 /* GTK - The GIMP Toolkit
2 * gtkprintoperation.h: Print Operation
3 * Copyright (C) 2006, Red Hat, Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
21 #ifndef __GTK_PRINT_OPERATION_H__
22 #define __GTK_PRINT_OPERATION_H__
24 #include <glib-object.h>
28 #include "gtkwindow.h"
29 #include "gtkpagesetup.h"
30 #include "gtkprintsettings.h"
31 #include "gtkprintcontext.h"
32 #include "gtkprintoperationpreview.h"
36 #define GTK_TYPE_PRINT_OPERATION (gtk_print_operation_get_type ())
37 #define GTK_PRINT_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PRINT_OPERATION, GtkPrintOperation))
38 #define GTK_PRINT_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PRINT_OPERATION, GtkPrintOperationClass))
39 #define GTK_IS_PRINT_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PRINT_OPERATION))
40 #define GTK_IS_PRINT_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PRINT_OPERATION))
41 #define GTK_PRINT_OPERATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PRINT_OPERATION, GtkPrintOperationClass))
43 typedef struct _GtkPrintOperationClass GtkPrintOperationClass;
44 typedef struct _GtkPrintOperationPrivate GtkPrintOperationPrivate;
45 typedef struct _GtkPrintOperation GtkPrintOperation;
48 GTK_PRINT_STATUS_INITIAL,
49 GTK_PRINT_STATUS_PREPARING,
50 GTK_PRINT_STATUS_GENERATING_DATA,
51 GTK_PRINT_STATUS_SENDING_DATA,
52 GTK_PRINT_STATUS_PENDING,
53 GTK_PRINT_STATUS_PENDING_ISSUE,
54 GTK_PRINT_STATUS_PRINTING,
55 GTK_PRINT_STATUS_FINISHED,
56 GTK_PRINT_STATUS_FINISHED_ABORTED
59 struct _GtkPrintOperation
61 GObject parent_instance;
63 GtkPrintOperationPrivate *priv;
66 struct _GtkPrintOperationClass
68 GObjectClass parent_class;
70 void (*begin_print) (GtkPrintOperation *operation,
71 GtkPrintContext *context);
72 gboolean (*paginate) (GtkPrintOperation *operation,
73 GtkPrintContext *context);
74 void (*request_page_setup) (GtkPrintOperation *operation,
75 GtkPrintContext *context,
78 void (*draw_page) (GtkPrintOperation *operation,
79 GtkPrintContext *context,
81 void (*end_print) (GtkPrintOperation *operation,
82 GtkPrintContext *context);
83 void (*status_changed) (GtkPrintOperation *operation);
85 GtkWidget *(*create_custom_widget) (GtkPrintOperation *operation);
86 void (*custom_widget_apply) (GtkPrintOperation *operation,
90 gboolean (*preview) (GtkPrintOperation *operation,
91 GtkPrintOperationPreview *preview,
92 GtkPrintContext *context,
95 /* Padding for future expansion */
96 void (*_gtk_reserved1) (void);
97 void (*_gtk_reserved2) (void);
98 void (*_gtk_reserved3) (void);
99 void (*_gtk_reserved4) (void);
100 void (*_gtk_reserved5) (void);
101 void (*_gtk_reserved6) (void);
102 void (*_gtk_reserved7) (void);
106 GTK_PRINT_OPERATION_RESULT_ERROR,
107 GTK_PRINT_OPERATION_RESULT_APPLY,
108 GTK_PRINT_OPERATION_RESULT_CANCEL,
109 GTK_PRINT_OPERATION_RESULT_PREVIEW
110 } GtkPrintOperationResult;
112 #define GTK_PRINT_ERROR gtk_print_error_quark ()
116 GTK_PRINT_ERROR_GENERAL,
117 GTK_PRINT_ERROR_INTERNAL_ERROR,
118 GTK_PRINT_ERROR_NOMEM
121 GQuark gtk_print_error_quark (void);
123 GType gtk_print_operation_get_type (void) G_GNUC_CONST;
124 GtkPrintOperation * gtk_print_operation_new (void);
125 void gtk_print_operation_set_default_page_setup (GtkPrintOperation *op,
126 GtkPageSetup *default_page_setup);
127 GtkPageSetup * gtk_print_operation_get_default_page_setup (GtkPrintOperation *op);
128 void gtk_print_operation_set_print_settings (GtkPrintOperation *op,
129 GtkPrintSettings *print_settings);
130 GtkPrintSettings * gtk_print_operation_get_print_settings (GtkPrintOperation *op);
131 void gtk_print_operation_set_job_name (GtkPrintOperation *op,
132 const gchar *job_name);
133 void gtk_print_operation_set_n_pages (GtkPrintOperation *op,
135 void gtk_print_operation_set_current_page (GtkPrintOperation *op,
137 void gtk_print_operation_set_use_full_page (GtkPrintOperation *op,
139 void gtk_print_operation_set_unit (GtkPrintOperation *op,
141 void gtk_print_operation_set_show_dialog (GtkPrintOperation *op,
142 gboolean show_dialog);
143 void gtk_print_operation_set_show_preview (GtkPrintOperation *op,
144 gboolean show_preview);
145 void gtk_print_operation_set_pdf_target (GtkPrintOperation *op,
146 const gchar *filename);
147 void gtk_print_operation_set_track_print_status (GtkPrintOperation *op,
148 gboolean track_status);
149 void gtk_print_operation_set_show_progress (GtkPrintOperation *op,
150 gboolean show_progress);
151 void gtk_print_operation_set_custom_tab_label (GtkPrintOperation *op,
153 GtkPrintOperationResult gtk_print_operation_run (GtkPrintOperation *op,
156 void gtk_print_operation_run_preview (GtkPrintOperation *op,
158 GtkPrintStatus gtk_print_operation_get_status (GtkPrintOperation *op);
159 G_CONST_RETURN gchar * gtk_print_operation_get_status_string (GtkPrintOperation *op);
160 gboolean gtk_print_operation_is_finished (GtkPrintOperation *op);
161 void gtk_print_operation_cancel (GtkPrintOperation *op);
163 GtkPageSetup *gtk_print_run_page_setup_dialog (GtkWindow *parent,
164 GtkPageSetup *page_setup,
165 GtkPrintSettings *settings);
167 typedef void (* GtkPageSetupDoneFunc) (GtkPageSetup *page_setup,
170 void gtk_print_operation_run_async (GtkPrintOperation *op,
172 void gtk_print_run_page_setup_dialog_async (GtkWindow *parent,
173 GtkPageSetup *page_setup,
174 GtkPrintSettings *settings,
175 GtkPageSetupDoneFunc done_cb,
180 #endif /* __GTK_PRINT_OPERATION_H__ */