Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
gtkprintoperation.h
Go to the documentation of this file.
1/* GTK - The GIMP Toolkit
2 * gtkprintoperation.h: Print Operation
3 * Copyright (C) 2006, Red Hat, Inc.
4 *
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.
9 *
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.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#pragma once
20
21
22#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
23#error "Only <gtk/gtk.h> can be included directly."
24#endif
25
26#include <cairo.h>
27#include <gtk/gtk.h>
28
33
34
36
37#define GTK_TYPE_PRINT_OPERATION (gtk_print_operation_get_type ())
38#define GTK_PRINT_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PRINT_OPERATION, GtkPrintOperation))
39#define GTK_PRINT_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PRINT_OPERATION, GtkPrintOperationClass))
40#define GTK_IS_PRINT_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PRINT_OPERATION))
41#define GTK_IS_PRINT_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PRINT_OPERATION))
42#define GTK_PRINT_OPERATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PRINT_OPERATION, GtkPrintOperationClass))
43
45typedef struct _GtkPrintOperationPrivate GtkPrintOperationPrivate;
47
48/**
49 * GtkPrintStatus:
50 * @GTK_PRINT_STATUS_INITIAL: The printing has not started yet; this
51 * status is set initially, and while the print dialog is shown.
52 * @GTK_PRINT_STATUS_PREPARING: This status is set while the begin-print
53 * signal is emitted and during pagination.
54 * @GTK_PRINT_STATUS_GENERATING_DATA: This status is set while the
55 * pages are being rendered.
56 * @GTK_PRINT_STATUS_SENDING_DATA: The print job is being sent off to the
57 * printer.
58 * @GTK_PRINT_STATUS_PENDING: The print job has been sent to the printer,
59 * but is not printed for some reason, e.g. the printer may be stopped.
60 * @GTK_PRINT_STATUS_PENDING_ISSUE: Some problem has occurred during
61 * printing, e.g. a paper jam.
62 * @GTK_PRINT_STATUS_PRINTING: The printer is processing the print job.
63 * @GTK_PRINT_STATUS_FINISHED: The printing has been completed successfully.
64 * @GTK_PRINT_STATUS_FINISHED_ABORTED: The printing has been aborted.
65 *
66 * The status gives a rough indication of the completion of a running
67 * print operation.
68 */
80
81/**
82 * GtkPrintOperationResult:
83 * @GTK_PRINT_OPERATION_RESULT_ERROR: An error has occurred.
84 * @GTK_PRINT_OPERATION_RESULT_APPLY: The print settings should be stored.
85 * @GTK_PRINT_OPERATION_RESULT_CANCEL: The print operation has been canceled,
86 * the print settings should not be stored.
87 * @GTK_PRINT_OPERATION_RESULT_IN_PROGRESS: The print operation is not complete
88 * yet. This value will only be returned when running asynchronously.
89 *
90 * The result of a print operation.
91 *
92 * A value of this type is returned by [method@Gtk.PrintOperation.run].
93 */
100
101/**
102 * GtkPrintOperationAction:
103 * @GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG: Show the print dialog.
104 * @GTK_PRINT_OPERATION_ACTION_PRINT: Start to print without showing
105 * the print dialog, based on the current print settings.
106 * @GTK_PRINT_OPERATION_ACTION_PREVIEW: Show the print preview.
107 * @GTK_PRINT_OPERATION_ACTION_EXPORT: Export to a file. This requires
108 * the export-filename property to be set.
109 *
110 * Determines what action the print operation should perform.
111 *
112 * A parameter of this typs is passed to [method@Gtk.PrintOperation.run].
113 */
120
121
129
130/**
131 * GtkPrintOperationClass:
132 * @parent_class: The parent class.
133 * @done: Signal emitted when the print operation run has finished
134 * doing everything required for printing.
135 * @begin_print: Signal emitted after the user has finished changing
136 * print settings in the dialog, before the actual rendering starts.
137 * @paginate: Signal emitted after the “begin-print” signal, but
138 * before the actual rendering starts.
139 * @request_page_setup: Emitted once for every page that is printed,
140 * to give the application a chance to modify the page setup.
141 * @draw_page: Signal emitted for every page that is printed.
142 * @end_print: Signal emitted after all pages have been rendered.
143 * @status_changed: Emitted at between the various phases of the print
144 * operation.
145 * @create_custom_widget: Signal emitted when displaying the print dialog.
146 * @custom_widget_apply: Signal emitted right before “begin-print” if
147 * you added a custom widget in the “create-custom-widget” handler.
148 * @preview: Signal emitted when a preview is requested from the
149 * native dialog.
150 * @update_custom_widget: Emitted after change of selected printer.
151 */
153{
155
156 /*< public >*/
157
158 void (*done) (GtkPrintOperation *operation,
160 void (*begin_print) (GtkPrintOperation *operation,
161 GtkPrintContext *context);
163 GtkPrintContext *context);
165 GtkPrintContext *context,
166 int page_nr,
167 GtkPageSetup *setup);
168 void (*draw_page) (GtkPrintOperation *operation,
169 GtkPrintContext *context,
170 int page_nr);
171 void (*end_print) (GtkPrintOperation *operation,
172 GtkPrintContext *context);
173 void (*status_changed) (GtkPrintOperation *operation);
174
175 GtkWidget *(*create_custom_widget) (GtkPrintOperation *operation);
177 GtkWidget *widget);
178
181 GtkPrintContext *context,
182 GtkWindow *parent);
183
185 GtkWidget *widget,
186 GtkPageSetup *setup,
187 GtkPrintSettings *settings);
188
189 /*< private >*/
190
192};
193
194/**
195 * GTK_PRINT_ERROR:
196 *
197 * The error domain for `GtkPrintError` errors.
198 */
199#define GTK_PRINT_ERROR gtk_print_error_quark ()
200
201/**
202 * GtkPrintError:
203 * @GTK_PRINT_ERROR_GENERAL: An unspecified error occurred.
204 * @GTK_PRINT_ERROR_INTERNAL_ERROR: An internal error occurred.
205 * @GTK_PRINT_ERROR_NOMEM: A memory allocation failed.
206 * @GTK_PRINT_ERROR_INVALID_FILE: An error occurred while loading a page setup
207 * or paper size from a key file.
208 *
209 * Error codes that identify various errors that can occur while
210 * using the GTK printing support.
211 */
219
222
229 GtkPageSetup *default_page_setup);
234 GtkPrintSettings *print_settings);
239 const char *job_name);
242 int n_pages);
245 int current_page);
248 gboolean full_page);
251 GtkUnit unit);
254 const char *filename);
257 gboolean track_status);
260 gboolean show_progress);
263 gboolean allow_async);
266 const char *label);
270 GtkWindow *parent,
271 GError **error);
274 GError **error);
289 gboolean support_selection);
294 gboolean has_selection);
299 gboolean embed);
304
307 GtkPageSetup *page_setup,
308 GtkPrintSettings *settings);
309
310/**
311 * GtkPageSetupDoneFunc:
312 * @page_setup: the `GtkPageSetup` that has been passed to
313 * gtk_print_run_page_setup_dialog_async()
314 * @data: (closure): user data that has been passed to
315 * gtk_print_run_page_setup_dialog_async()
316 *
317 * The type of function that is passed to
318 * gtk_print_run_page_setup_dialog_async().
319 *
320 * This function will be called when the page setup dialog
321 * is dismissed, and also serves as destroy notify for @data.
322 */
323typedef void (* GtkPageSetupDoneFunc) (GtkPageSetup *page_setup,
324 gpointer data);
325
328 GtkPageSetup *page_setup,
329 GtkPrintSettings *settings,
330 GtkPageSetupDoneFunc done_cb,
331 gpointer data);
332
334
336
#define GDK_AVAILABLE_IN_ALL
#define G_END_DECLS
Definition gmacros.h:910
#define G_BEGIN_DECLS
Definition gmacros.h:909
#define G_GNUC_CONST
Definition gmacros.h:637
#define G_DEFINE_AUTOPTR_CLEANUP_FUNC(TypeName, func)
Definition gmacros.h:1400
GOBJECT_AVAILABLE_IN_ALL void g_object_unref(gpointer object)
G_BEGIN_DECLS typedef guint32 GQuark
Definition gquark.h:38
GtkUnit
Definition gtkenums.h:759
typedefG_BEGIN_DECLS struct _GtkPageSetup GtkPageSetup
typedefG_BEGIN_DECLS struct _GtkPrintContext GtkPrintContext
GDK_AVAILABLE_IN_ALL void gtk_print_operation_set_use_full_page(GtkPrintOperation *op, gboolean full_page)
GDK_AVAILABLE_IN_ALL const char * gtk_print_operation_get_status_string(GtkPrintOperation *op)
GDK_AVAILABLE_IN_ALL void gtk_print_operation_set_show_progress(GtkPrintOperation *op, gboolean show_progress)
GDK_AVAILABLE_IN_ALL void gtk_print_operation_set_custom_tab_label(GtkPrintOperation *op, const char *label)
GDK_AVAILABLE_IN_ALL GtkPrintOperation * gtk_print_operation_new(void)
GDK_AVAILABLE_IN_ALL void gtk_print_operation_get_error(GtkPrintOperation *op, GError **error)
GDK_AVAILABLE_IN_ALL void gtk_print_operation_set_defer_drawing(GtkPrintOperation *op)
GDK_AVAILABLE_IN_ALL int gtk_print_operation_get_n_pages_to_print(GtkPrintOperation *op)
GDK_AVAILABLE_IN_ALL void gtk_print_operation_set_unit(GtkPrintOperation *op, GtkUnit unit)
struct _GtkPrintOperationPrivate GtkPrintOperationPrivate
GDK_AVAILABLE_IN_ALL void gtk_print_operation_set_allow_async(GtkPrintOperation *op, gboolean allow_async)
GDK_AVAILABLE_IN_ALL void gtk_print_operation_set_print_settings(GtkPrintOperation *op, GtkPrintSettings *print_settings)
GDK_AVAILABLE_IN_ALL GtkPrintStatus gtk_print_operation_get_status(GtkPrintOperation *op)
GDK_AVAILABLE_IN_ALL void gtk_print_operation_draw_page_finish(GtkPrintOperation *op)
GDK_AVAILABLE_IN_ALL GtkPrintSettings * gtk_print_operation_get_print_settings(GtkPrintOperation *op)
GDK_AVAILABLE_IN_ALL gboolean gtk_print_operation_is_finished(GtkPrintOperation *op)
GDK_AVAILABLE_IN_ALL void gtk_print_operation_set_embed_page_setup(GtkPrintOperation *op, gboolean embed)
GtkPrintStatus
@ GTK_PRINT_STATUS_PRINTING
@ GTK_PRINT_STATUS_PREPARING
@ GTK_PRINT_STATUS_SENDING_DATA
@ GTK_PRINT_STATUS_FINISHED
@ GTK_PRINT_STATUS_FINISHED_ABORTED
@ GTK_PRINT_STATUS_INITIAL
@ GTK_PRINT_STATUS_GENERATING_DATA
@ GTK_PRINT_STATUS_PENDING
@ GTK_PRINT_STATUS_PENDING_ISSUE
GDK_AVAILABLE_IN_ALL void gtk_print_operation_set_has_selection(GtkPrintOperation *op, gboolean has_selection)
GDK_AVAILABLE_IN_ALL gboolean gtk_print_operation_get_embed_page_setup(GtkPrintOperation *op)
GDK_AVAILABLE_IN_ALL GType gtk_print_operation_get_type(void) G_GNUC_CONST
GDK_AVAILABLE_IN_ALL GtkPageSetup * gtk_print_run_page_setup_dialog(GtkWindow *parent, GtkPageSetup *page_setup, GtkPrintSettings *settings)
GDK_AVAILABLE_IN_ALL GtkPrintOperationResult gtk_print_operation_run(GtkPrintOperation *op, GtkPrintOperationAction action, GtkWindow *parent, GError **error)
GDK_AVAILABLE_IN_ALL void gtk_print_operation_set_track_print_status(GtkPrintOperation *op, gboolean track_status)
GDK_AVAILABLE_IN_ALL void gtk_print_operation_set_support_selection(GtkPrintOperation *op, gboolean support_selection)
GDK_AVAILABLE_IN_ALL GtkPageSetup * gtk_print_operation_get_default_page_setup(GtkPrintOperation *op)
GDK_AVAILABLE_IN_ALL void gtk_print_run_page_setup_dialog_async(GtkWindow *parent, GtkPageSetup *page_setup, GtkPrintSettings *settings, GtkPageSetupDoneFunc done_cb, gpointer data)
GDK_AVAILABLE_IN_ALL void gtk_print_operation_set_export_filename(GtkPrintOperation *op, const char *filename)
GDK_AVAILABLE_IN_ALL GQuark gtk_print_error_quark(void)
GDK_AVAILABLE_IN_ALL void gtk_print_operation_set_n_pages(GtkPrintOperation *op, int n_pages)
GDK_AVAILABLE_IN_ALL void gtk_print_operation_set_current_page(GtkPrintOperation *op, int current_page)
GDK_AVAILABLE_IN_ALL void gtk_print_operation_cancel(GtkPrintOperation *op)
GDK_AVAILABLE_IN_ALL gboolean gtk_print_operation_get_support_selection(GtkPrintOperation *op)
GtkPrintOperationResult
@ GTK_PRINT_OPERATION_RESULT_IN_PROGRESS
@ GTK_PRINT_OPERATION_RESULT_APPLY
@ GTK_PRINT_OPERATION_RESULT_CANCEL
@ GTK_PRINT_OPERATION_RESULT_ERROR
GDK_AVAILABLE_IN_ALL void gtk_print_operation_set_job_name(GtkPrintOperation *op, const char *job_name)
GDK_AVAILABLE_IN_ALL gboolean gtk_print_operation_get_has_selection(GtkPrintOperation *op)
void(* GtkPageSetupDoneFunc)(GtkPageSetup *page_setup, gpointer data)
GtkPrintOperationAction
@ GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG
@ GTK_PRINT_OPERATION_ACTION_PRINT
@ GTK_PRINT_OPERATION_ACTION_EXPORT
@ GTK_PRINT_OPERATION_ACTION_PREVIEW
GtkPrintError
@ GTK_PRINT_ERROR_NOMEM
@ GTK_PRINT_ERROR_INVALID_FILE
@ GTK_PRINT_ERROR_INTERNAL_ERROR
@ GTK_PRINT_ERROR_GENERAL
GDK_AVAILABLE_IN_ALL void gtk_print_operation_set_default_page_setup(GtkPrintOperation *op, GtkPageSetup *default_page_setup)
struct _GtkPrintOperationPreview GtkPrintOperationPreview
typedefG_BEGIN_DECLS struct _GtkPrintSettings GtkPrintSettings
gsize GType
Definition gtype.h:427
gint gboolean
Definition gtypes.h:56
void * gpointer
Definition gtypes.h:109
static void error(LoadState *S, const char *why)
void(* update_custom_widget)(GtkPrintOperation *operation, GtkWidget *widget, GtkPageSetup *setup, GtkPrintSettings *settings)
void(* custom_widget_apply)(GtkPrintOperation *operation, GtkWidget *widget)
void(* begin_print)(GtkPrintOperation *operation, GtkPrintContext *context)
void(* end_print)(GtkPrintOperation *operation, GtkPrintContext *context)
gboolean(* paginate)(GtkPrintOperation *operation, GtkPrintContext *context)
void(* done)(GtkPrintOperation *operation, GtkPrintOperationResult result)
gboolean(* preview)(GtkPrintOperation *operation, GtkPrintOperationPreview *preview, GtkPrintContext *context, GtkWindow *parent)
void(* status_changed)(GtkPrintOperation *operation)
void(* request_page_setup)(GtkPrintOperation *operation, GtkPrintContext *context, int page_nr, GtkPageSetup *setup)
void(* draw_page)(GtkPrintOperation *operation, GtkPrintContext *context, int page_nr)
GtkPrintOperationPrivate * priv