]> Pileus Git - ~andy/gtk/blob - gtk/gtkprintoperation.h
Rename pdf_target to export_filename
[~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 #ifndef __GTK_PRINT_OPERATION_H__
22 #define __GTK_PRINT_OPERATION_H__
23
24 #include <glib-object.h>
25 #include <cairo.h>
26 #include "gtkmain.h"
27 #include "gtkenums.h"
28 #include "gtkwindow.h"
29 #include "gtkpagesetup.h"
30 #include "gtkprintsettings.h"
31 #include "gtkprintcontext.h"
32 #include "gtkprintoperationpreview.h"
33
34 G_BEGIN_DECLS
35
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))
42
43 typedef struct _GtkPrintOperationClass   GtkPrintOperationClass;
44 typedef struct _GtkPrintOperationPrivate GtkPrintOperationPrivate;
45 typedef struct _GtkPrintOperation        GtkPrintOperation;
46
47 typedef enum {
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
57 } GtkPrintStatus;
58
59 typedef enum {
60   GTK_PRINT_OPERATION_RESULT_ERROR,
61   GTK_PRINT_OPERATION_RESULT_APPLY,
62   GTK_PRINT_OPERATION_RESULT_CANCEL,
63   GTK_PRINT_OPERATION_RESULT_IN_PROGRESS
64 } GtkPrintOperationResult;
65
66 typedef enum {
67   GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
68   GTK_PRINT_OPERATION_ACTION_PRINT,
69   GTK_PRINT_OPERATION_ACTION_PREVIEW,
70   GTK_PRINT_OPERATION_ACTION_EXPORT,
71 } GtkPrintOperationAction;
72
73
74 struct _GtkPrintOperation
75 {
76   GObject parent_instance;
77   
78   GtkPrintOperationPrivate *priv;
79 };
80
81 struct _GtkPrintOperationClass
82 {
83   GObjectClass parent_class;
84   
85   void     (*done)               (GtkPrintOperation *operation,
86                                   GtkPrintOperationResult result);
87   void     (*begin_print)        (GtkPrintOperation *operation, 
88                                   GtkPrintContext   *context);
89   gboolean (*paginate)           (GtkPrintOperation *operation, 
90                                   GtkPrintContext   *context);
91   void     (*request_page_setup) (GtkPrintOperation *operation,
92                                   GtkPrintContext   *context,
93                                   gint               page_nr,
94                                   GtkPageSetup      *setup);
95   void     (*draw_page)          (GtkPrintOperation *operation,
96                                   GtkPrintContext   *context,
97                                   gint               page_nr);
98   void     (*end_print)          (GtkPrintOperation *operation,
99                                   GtkPrintContext   *context);
100   void     (*status_changed)     (GtkPrintOperation *operation);
101
102   GtkWidget *(*create_custom_widget) (GtkPrintOperation *operation);
103   void       (*custom_widget_apply)  (GtkPrintOperation *operation,
104                                       GtkWidget *widget);
105
106   
107   gboolean (*preview)        (GtkPrintOperation        *operation,
108                               GtkPrintOperationPreview *preview, 
109                               GtkPrintContext          *context,
110                               GtkWindow                *parent);  
111
112   /* Padding for future expansion */
113   void (*_gtk_reserved1) (void);
114   void (*_gtk_reserved2) (void);
115   void (*_gtk_reserved3) (void);
116   void (*_gtk_reserved4) (void);
117   void (*_gtk_reserved5) (void);
118   void (*_gtk_reserved6) (void);
119   void (*_gtk_reserved7) (void);
120 };
121
122 #define GTK_PRINT_ERROR gtk_print_error_quark ()
123
124 typedef enum
125 {
126   GTK_PRINT_ERROR_GENERAL,
127   GTK_PRINT_ERROR_INTERNAL_ERROR,
128   GTK_PRINT_ERROR_NOMEM
129 } GtkPrintError;
130
131 GQuark gtk_print_error_quark (void);
132
133 GType                   gtk_print_operation_get_type               (void) G_GNUC_CONST;
134 GtkPrintOperation *     gtk_print_operation_new                    (void);
135 void                    gtk_print_operation_set_default_page_setup (GtkPrintOperation  *op,
136                                                                     GtkPageSetup       *default_page_setup);
137 GtkPageSetup *          gtk_print_operation_get_default_page_setup (GtkPrintOperation  *op);
138 void                    gtk_print_operation_set_print_settings     (GtkPrintOperation  *op,
139                                                                     GtkPrintSettings   *print_settings);
140 GtkPrintSettings *      gtk_print_operation_get_print_settings     (GtkPrintOperation  *op);
141 void                    gtk_print_operation_set_job_name           (GtkPrintOperation  *op,
142                                                                     const gchar        *job_name);
143 void                    gtk_print_operation_set_n_pages            (GtkPrintOperation  *op,
144                                                                     gint                n_pages);
145 void                    gtk_print_operation_set_current_page       (GtkPrintOperation  *op,
146                                                                     gint                current_page);
147 void                    gtk_print_operation_set_use_full_page      (GtkPrintOperation  *op,
148                                                                     gboolean            full_page);
149 void                    gtk_print_operation_set_unit               (GtkPrintOperation  *op,
150                                                                     GtkUnit             unit);
151 void                    gtk_print_operation_set_export_filename    (GtkPrintOperation  *op,
152                                                                     const gchar        *filename);
153 void                    gtk_print_operation_set_track_print_status (GtkPrintOperation  *op,
154                                                                     gboolean            track_status);
155 void                    gtk_print_operation_set_show_progress      (GtkPrintOperation  *op,
156                                                                     gboolean            show_progress);
157 void                    gtk_print_operation_set_allow_async        (GtkPrintOperation  *op,
158                                                                     gboolean            allow_async);
159 void                    gtk_print_operation_set_custom_tab_label   (GtkPrintOperation  *op,
160                                                                     const gchar        *label);
161 GtkPrintOperationResult gtk_print_operation_run                    (GtkPrintOperation  *op,
162                                                                     GtkPrintOperationAction action,
163                                                                     GtkWindow          *parent,
164                                                                     GError            **error);
165 GError *                gtk_print_operation_get_error              (GtkPrintOperation  *op);
166 GtkPrintStatus          gtk_print_operation_get_status             (GtkPrintOperation  *op);
167 G_CONST_RETURN gchar *  gtk_print_operation_get_status_string      (GtkPrintOperation  *op);
168 gboolean                gtk_print_operation_is_finished            (GtkPrintOperation  *op);
169 void                    gtk_print_operation_cancel                 (GtkPrintOperation  *op);
170
171 GtkPageSetup           *gtk_print_run_page_setup_dialog            (GtkWindow          *parent,
172                                                                     GtkPageSetup       *page_setup,
173                                                                     GtkPrintSettings   *settings);
174
175 typedef void  (* GtkPageSetupDoneFunc) (GtkPageSetup *page_setup, 
176                                         gpointer      data);
177
178 void                    gtk_print_run_page_setup_dialog_async      (GtkWindow            *parent,
179                                                                     GtkPageSetup         *page_setup,
180                                                                     GtkPrintSettings     *settings,
181                                                                     GtkPageSetupDoneFunc  done_cb,
182                                                                     gpointer              data);
183
184 G_END_DECLS
185
186 #endif /* __GTK_PRINT_OPERATION_H__ */