]> Pileus Git - ~andy/gtk/blob - gtk/gtkprintoperation.h
whitespace cleanup: remove trailing whitespace and excess newlines and
[~andy/gtk] / gtk / gtkprintoperation.h
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, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
22 #error "Only <gtk/gtk.h> can be included directly."
23 #endif
24
25 #ifndef __GTK_PRINT_OPERATION_H__
26 #define __GTK_PRINT_OPERATION_H__
27
28 #include <glib-object.h>
29 #include <cairo.h>
30 #include "gtkmain.h"
31 #include "gtkenums.h"
32 #include "gtkwindow.h"
33 #include "gtkpagesetup.h"
34 #include "gtkprintsettings.h"
35 #include "gtkprintcontext.h"
36 #include "gtkprintoperationpreview.h"
37
38 G_BEGIN_DECLS
39
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))
46
47 typedef struct _GtkPrintOperationClass   GtkPrintOperationClass;
48 typedef struct _GtkPrintOperationPrivate GtkPrintOperationPrivate;
49 typedef struct _GtkPrintOperation        GtkPrintOperation;
50
51 typedef enum {
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
61 } GtkPrintStatus;
62
63 typedef enum {
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;
69
70 typedef enum {
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;
76
77
78 struct _GtkPrintOperation
79 {
80   GObject parent_instance;
81
82   GtkPrintOperationPrivate *priv;
83 };
84
85 struct _GtkPrintOperationClass
86 {
87   GObjectClass parent_class;
88
89   void     (*done)               (GtkPrintOperation *operation,
90                                   GtkPrintOperationResult result);
91   void     (*begin_print)        (GtkPrintOperation *operation,
92                                   GtkPrintContext   *context);
93   gboolean (*paginate)           (GtkPrintOperation *operation,
94                                   GtkPrintContext   *context);
95   void     (*request_page_setup) (GtkPrintOperation *operation,
96                                   GtkPrintContext   *context,
97                                   gint               page_nr,
98                                   GtkPageSetup      *setup);
99   void     (*draw_page)          (GtkPrintOperation *operation,
100                                   GtkPrintContext   *context,
101                                   gint               page_nr);
102   void     (*end_print)          (GtkPrintOperation *operation,
103                                   GtkPrintContext   *context);
104   void     (*status_changed)     (GtkPrintOperation *operation);
105
106   GtkWidget *(*create_custom_widget) (GtkPrintOperation *operation);
107   void       (*custom_widget_apply)  (GtkPrintOperation *operation,
108                                       GtkWidget *widget);
109
110   gboolean (*preview)        (GtkPrintOperation        *operation,
111                               GtkPrintOperationPreview *preview,
112                               GtkPrintContext          *context,
113                               GtkWindow                *parent);
114
115   /* Padding for future expansion */
116   void (*_gtk_reserved1) (void);
117   void (*_gtk_reserved2) (void);
118   void (*_gtk_reserved3) (void);
119   void (*_gtk_reserved4) (void);
120   void (*_gtk_reserved5) (void);
121   void (*_gtk_reserved6) (void);
122   void (*_gtk_reserved7) (void);
123 };
124
125 #define GTK_PRINT_ERROR gtk_print_error_quark ()
126
127 typedef enum
128 {
129   GTK_PRINT_ERROR_GENERAL,
130   GTK_PRINT_ERROR_INTERNAL_ERROR,
131   GTK_PRINT_ERROR_NOMEM,
132   GTK_PRINT_ERROR_INVALID_FILE
133 } GtkPrintError;
134
135 GQuark gtk_print_error_quark (void);
136
137 GType                   gtk_print_operation_get_type               (void) G_GNUC_CONST;
138 GtkPrintOperation *     gtk_print_operation_new                    (void);
139 void                    gtk_print_operation_set_default_page_setup (GtkPrintOperation  *op,
140                                                                     GtkPageSetup       *default_page_setup);
141 GtkPageSetup *          gtk_print_operation_get_default_page_setup (GtkPrintOperation  *op);
142 void                    gtk_print_operation_set_print_settings     (GtkPrintOperation  *op,
143                                                                     GtkPrintSettings   *print_settings);
144 GtkPrintSettings *      gtk_print_operation_get_print_settings     (GtkPrintOperation  *op);
145 void                    gtk_print_operation_set_job_name           (GtkPrintOperation  *op,
146                                                                     const gchar        *job_name);
147 void                    gtk_print_operation_set_n_pages            (GtkPrintOperation  *op,
148                                                                     gint                n_pages);
149 void                    gtk_print_operation_set_current_page       (GtkPrintOperation  *op,
150                                                                     gint                current_page);
151 void                    gtk_print_operation_set_use_full_page      (GtkPrintOperation  *op,
152                                                                     gboolean            full_page);
153 void                    gtk_print_operation_set_unit               (GtkPrintOperation  *op,
154                                                                     GtkUnit             unit);
155 void                    gtk_print_operation_set_export_filename    (GtkPrintOperation  *op,
156                                                                     const gchar        *filename);
157 void                    gtk_print_operation_set_track_print_status (GtkPrintOperation  *op,
158                                                                     gboolean            track_status);
159 void                    gtk_print_operation_set_show_progress      (GtkPrintOperation  *op,
160                                                                     gboolean            show_progress);
161 void                    gtk_print_operation_set_allow_async        (GtkPrintOperation  *op,
162                                                                     gboolean            allow_async);
163 void                    gtk_print_operation_set_custom_tab_label   (GtkPrintOperation  *op,
164                                                                     const gchar        *label);
165 GtkPrintOperationResult gtk_print_operation_run                    (GtkPrintOperation  *op,
166                                                                     GtkPrintOperationAction action,
167                                                                     GtkWindow          *parent,
168                                                                     GError            **error);
169 void                    gtk_print_operation_get_error              (GtkPrintOperation  *op,
170                                                                     GError            **error);
171 GtkPrintStatus          gtk_print_operation_get_status             (GtkPrintOperation  *op);
172 G_CONST_RETURN gchar *  gtk_print_operation_get_status_string      (GtkPrintOperation  *op);
173 gboolean                gtk_print_operation_is_finished            (GtkPrintOperation  *op);
174 void                    gtk_print_operation_cancel                 (GtkPrintOperation  *op);
175
176 GtkPageSetup           *gtk_print_run_page_setup_dialog            (GtkWindow          *parent,
177                                                                     GtkPageSetup       *page_setup,
178                                                                     GtkPrintSettings   *settings);
179
180 typedef void  (* GtkPageSetupDoneFunc) (GtkPageSetup *page_setup,
181                                         gpointer      data);
182
183 void                    gtk_print_run_page_setup_dialog_async      (GtkWindow            *parent,
184                                                                     GtkPageSetup         *page_setup,
185                                                                     GtkPrintSettings     *settings,
186                                                                     GtkPageSetupDoneFunc  done_cb,
187                                                                     gpointer              data);
188
189 G_END_DECLS
190
191 #endif /* __GTK_PRINT_OPERATION_H__ */