]> Pileus Git - ~andy/gtk/blob - gtk/gtkprintoperation.h
Add a GtkPrintOperation::show-preview property
[~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 struct _GtkPrintOperation
60 {
61   GObject parent_instance;
62   
63   GtkPrintOperationPrivate *priv;
64 };
65
66 struct _GtkPrintOperationClass
67 {
68   GObjectClass parent_class;
69   
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,
76                                   gint               page_nr,
77                                   GtkPageSetup      *setup);
78   void     (*draw_page)          (GtkPrintOperation *operation,
79                                   GtkPrintContext   *context,
80                                   gint               page_nr);
81   void     (*end_print)          (GtkPrintOperation *operation,
82                                   GtkPrintContext   *context);
83   void     (*status_changed)     (GtkPrintOperation *operation);
84
85   GtkWidget *(*create_custom_widget) (GtkPrintOperation *operation);
86   void       (*custom_widget_apply)  (GtkPrintOperation *operation,
87                                       GtkWidget *widget);
88
89   
90   gboolean (*preview)        (GtkPrintOperation        *operation,
91                               GtkPrintOperationPreview *preview, 
92                               GtkPrintContext          *context,
93                               GtkWindow                *parent);  
94
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);
103 };
104
105 typedef enum {
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;
111
112 #define GTK_PRINT_ERROR gtk_print_error_quark ()
113
114 typedef enum
115 {
116   GTK_PRINT_ERROR_GENERAL,
117   GTK_PRINT_ERROR_INTERNAL_ERROR,
118   GTK_PRINT_ERROR_NOMEM
119 } GtkPrintError;
120
121 GQuark gtk_print_error_quark (void);
122
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,
134                                                                     gint                n_pages);
135 void                    gtk_print_operation_set_current_page       (GtkPrintOperation  *op,
136                                                                     gint                current_page);
137 void                    gtk_print_operation_set_use_full_page      (GtkPrintOperation  *op,
138                                                                     gboolean            full_page);
139 void                    gtk_print_operation_set_unit               (GtkPrintOperation  *op,
140                                                                     GtkUnit             unit);
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,
152                                                                     const gchar        *label);
153 GtkPrintOperationResult gtk_print_operation_run                    (GtkPrintOperation  *op,
154                                                                     GtkWindow          *parent,
155                                                                     GError            **error);
156 void                    gtk_print_operation_run_preview            (GtkPrintOperation  *op,
157                                                                     GtkWindow          *parent);
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);
162
163 GtkPageSetup           *gtk_print_run_page_setup_dialog            (GtkWindow          *parent,
164                                                                     GtkPageSetup       *page_setup,
165                                                                     GtkPrintSettings   *settings);
166
167 typedef void  (* GtkPageSetupDoneFunc) (GtkPageSetup *page_setup, 
168                                         gpointer      data);
169
170 void                    gtk_print_operation_run_async              (GtkPrintOperation    *op,
171                                                                     GtkWindow            *parent);
172 void                    gtk_print_run_page_setup_dialog_async      (GtkWindow            *parent,
173                                                                     GtkPageSetup         *page_setup,
174                                                                     GtkPrintSettings     *settings,
175                                                                     GtkPageSetupDoneFunc  done_cb,
176                                                                     gpointer              data);
177
178 G_END_DECLS
179
180 #endif /* __GTK_PRINT_OPERATION_H__ */