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 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
22 #error "Only <gtk/gtk.h> can be included directly."
25 #ifndef __GTK_PRINT_OPERATION_H__
26 #define __GTK_PRINT_OPERATION_H__
30 #include <gtk/gtkmain.h>
31 #include <gtk/gtkwindow.h>
32 #include <gtk/gtkpagesetup.h>
33 #include <gtk/gtkprintsettings.h>
34 #include <gtk/gtkprintcontext.h>
35 #include <gtk/gtkprintoperationpreview.h>
40 #define GTK_TYPE_PRINT_OPERATION (gtk_print_operation_get_type ())
41 #define GTK_PRINT_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PRINT_OPERATION, GtkPrintOperation))
42 #define GTK_PRINT_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PRINT_OPERATION, GtkPrintOperationClass))
43 #define GTK_IS_PRINT_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PRINT_OPERATION))
44 #define GTK_IS_PRINT_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PRINT_OPERATION))
45 #define GTK_PRINT_OPERATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PRINT_OPERATION, GtkPrintOperationClass))
47 typedef struct _GtkPrintOperationClass GtkPrintOperationClass;
48 typedef struct _GtkPrintOperationPrivate GtkPrintOperationPrivate;
49 typedef struct _GtkPrintOperation GtkPrintOperation;
52 GTK_PRINT_STATUS_INITIAL,
53 GTK_PRINT_STATUS_PREPARING,
54 GTK_PRINT_STATUS_GENERATING_DATA,
55 GTK_PRINT_STATUS_SENDING_DATA,
56 GTK_PRINT_STATUS_PENDING,
57 GTK_PRINT_STATUS_PENDING_ISSUE,
58 GTK_PRINT_STATUS_PRINTING,
59 GTK_PRINT_STATUS_FINISHED,
60 GTK_PRINT_STATUS_FINISHED_ABORTED
64 GTK_PRINT_OPERATION_RESULT_ERROR,
65 GTK_PRINT_OPERATION_RESULT_APPLY,
66 GTK_PRINT_OPERATION_RESULT_CANCEL,
67 GTK_PRINT_OPERATION_RESULT_IN_PROGRESS
68 } GtkPrintOperationResult;
71 GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
72 GTK_PRINT_OPERATION_ACTION_PRINT,
73 GTK_PRINT_OPERATION_ACTION_PREVIEW,
74 GTK_PRINT_OPERATION_ACTION_EXPORT
75 } GtkPrintOperationAction;
78 struct _GtkPrintOperation
80 GObject parent_instance;
83 GtkPrintOperationPrivate *priv;
86 struct _GtkPrintOperationClass
88 GObjectClass parent_class;
90 void (*done) (GtkPrintOperation *operation,
91 GtkPrintOperationResult result);
92 void (*begin_print) (GtkPrintOperation *operation,
93 GtkPrintContext *context);
94 gboolean (*paginate) (GtkPrintOperation *operation,
95 GtkPrintContext *context);
96 void (*request_page_setup) (GtkPrintOperation *operation,
97 GtkPrintContext *context,
100 void (*draw_page) (GtkPrintOperation *operation,
101 GtkPrintContext *context,
103 void (*end_print) (GtkPrintOperation *operation,
104 GtkPrintContext *context);
105 void (*status_changed) (GtkPrintOperation *operation);
107 GtkWidget *(*create_custom_widget) (GtkPrintOperation *operation);
108 void (*custom_widget_apply) (GtkPrintOperation *operation,
111 gboolean (*preview) (GtkPrintOperation *operation,
112 GtkPrintOperationPreview *preview,
113 GtkPrintContext *context,
116 void (*update_custom_widget) (GtkPrintOperation *operation,
119 GtkPrintSettings *settings);
121 /* Padding for future expansion */
122 void (*_gtk_reserved1) (void);
123 void (*_gtk_reserved2) (void);
124 void (*_gtk_reserved3) (void);
125 void (*_gtk_reserved4) (void);
126 void (*_gtk_reserved5) (void);
127 void (*_gtk_reserved6) (void);
128 void (*_gtk_reserved7) (void);
129 void (*_gtk_reserved8) (void);
132 #define GTK_PRINT_ERROR gtk_print_error_quark ()
136 GTK_PRINT_ERROR_GENERAL,
137 GTK_PRINT_ERROR_INTERNAL_ERROR,
138 GTK_PRINT_ERROR_NOMEM,
139 GTK_PRINT_ERROR_INVALID_FILE
142 GQuark gtk_print_error_quark (void);
144 GType gtk_print_operation_get_type (void) G_GNUC_CONST;
145 GtkPrintOperation * gtk_print_operation_new (void);
146 void gtk_print_operation_set_default_page_setup (GtkPrintOperation *op,
147 GtkPageSetup *default_page_setup);
148 GtkPageSetup * gtk_print_operation_get_default_page_setup (GtkPrintOperation *op);
149 void gtk_print_operation_set_print_settings (GtkPrintOperation *op,
150 GtkPrintSettings *print_settings);
151 GtkPrintSettings * gtk_print_operation_get_print_settings (GtkPrintOperation *op);
152 void gtk_print_operation_set_job_name (GtkPrintOperation *op,
153 const gchar *job_name);
154 void gtk_print_operation_set_n_pages (GtkPrintOperation *op,
156 void gtk_print_operation_set_current_page (GtkPrintOperation *op,
158 void gtk_print_operation_set_use_full_page (GtkPrintOperation *op,
160 void gtk_print_operation_set_unit (GtkPrintOperation *op,
162 void gtk_print_operation_set_export_filename (GtkPrintOperation *op,
163 const gchar *filename);
164 void gtk_print_operation_set_track_print_status (GtkPrintOperation *op,
165 gboolean track_status);
166 void gtk_print_operation_set_show_progress (GtkPrintOperation *op,
167 gboolean show_progress);
168 void gtk_print_operation_set_allow_async (GtkPrintOperation *op,
169 gboolean allow_async);
170 void gtk_print_operation_set_custom_tab_label (GtkPrintOperation *op,
172 GtkPrintOperationResult gtk_print_operation_run (GtkPrintOperation *op,
173 GtkPrintOperationAction action,
176 void gtk_print_operation_get_error (GtkPrintOperation *op,
178 GtkPrintStatus gtk_print_operation_get_status (GtkPrintOperation *op);
179 G_CONST_RETURN gchar * gtk_print_operation_get_status_string (GtkPrintOperation *op);
180 gboolean gtk_print_operation_is_finished (GtkPrintOperation *op);
181 void gtk_print_operation_cancel (GtkPrintOperation *op);
182 void gtk_print_operation_draw_page_finish (GtkPrintOperation *op);
183 void gtk_print_operation_set_defer_drawing (GtkPrintOperation *op);
184 void gtk_print_operation_set_support_selection (GtkPrintOperation *op,
185 gboolean support_selection);
186 gboolean gtk_print_operation_get_support_selection (GtkPrintOperation *op);
187 void gtk_print_operation_set_has_selection (GtkPrintOperation *op,
188 gboolean has_selection);
189 gboolean gtk_print_operation_get_has_selection (GtkPrintOperation *op);
190 void gtk_print_operation_set_embed_page_setup (GtkPrintOperation *op,
192 gboolean gtk_print_operation_get_embed_page_setup (GtkPrintOperation *op);
193 gint gtk_print_operation_get_n_pages_to_print (GtkPrintOperation *op);
195 GtkPageSetup *gtk_print_run_page_setup_dialog (GtkWindow *parent,
196 GtkPageSetup *page_setup,
197 GtkPrintSettings *settings);
200 * GtkPageSetupDoneFunc:
201 * @page_setup: the #GtkPageSetup that has been
202 * @data: (closure): user data that has been passed to
203 * gtk_print_run_page_setup_dialog_async().
205 * The type of function that is passed to
206 * gtk_print_run_page_setup_dialog_async(). This function will be
207 * called when the page setup dialog is dismissed, and also serves as
208 * destroy notify for @data.
210 typedef void (* GtkPageSetupDoneFunc) (GtkPageSetup *page_setup,
213 void gtk_print_run_page_setup_dialog_async (GtkWindow *parent,
214 GtkPageSetup *page_setup,
215 GtkPrintSettings *settings,
216 GtkPageSetupDoneFunc done_cb,
221 #endif /* __GTK_PRINT_OPERATION_H__ */