]> Pileus Git - ~andy/gtk/blob - gtk/gtkprintoperation.h
8f430850fafb95ff9b571fa77c8a513df7926321
[~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
33 G_BEGIN_DECLS
34
35 #define GTK_TYPE_PRINT_OPERATION                (gtk_print_operation_get_type ())
36 #define GTK_PRINT_OPERATION(obj)                (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PRINT_OPERATION, GtkPrintOperation))
37 #define GTK_PRINT_OPERATION_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PRINT_OPERATION, GtkPrintOperationClass))
38 #define GTK_IS_PRINT_OPERATION(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PRINT_OPERATION))
39 #define GTK_IS_PRINT_OPERATION_CLASS(klass)     (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PRINT_OPERATION))
40 #define GTK_PRINT_OPERATION_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PRINT_OPERATION, GtkPrintOperationClass))
41
42 typedef struct _GtkPrintOperationClass   GtkPrintOperationClass;
43 typedef struct _GtkPrintOperationPrivate GtkPrintOperationPrivate;
44 typedef struct _GtkPrintOperation        GtkPrintOperation;
45
46 typedef enum {
47   GTK_PRINT_STATUS_INITIAL,
48   GTK_PRINT_STATUS_PREPARING,
49   GTK_PRINT_STATUS_GENERATING_DATA,
50   GTK_PRINT_STATUS_SENDING_DATA,
51   GTK_PRINT_STATUS_PENDING,
52   GTK_PRINT_STATUS_PENDING_ISSUE,
53   GTK_PRINT_STATUS_PRINTING,
54   GTK_PRINT_STATUS_FINISHED,
55   GTK_PRINT_STATUS_FINISHED_ABORTED
56 } GtkPrintStatus;
57
58 struct _GtkPrintOperation
59 {
60   GObject parent_instance;
61   
62   GtkPrintOperationPrivate *priv;
63 };
64
65 struct _GtkPrintOperationClass
66 {
67   GObjectClass parent_class;
68   
69   void     (*begin_print)        (GtkPrintOperation *operation, 
70                                   GtkPrintContext   *context);
71   gboolean (*paginate)           (GtkPrintOperation *operation, 
72                                   GtkPrintContext   *context);
73   void     (*request_page_setup) (GtkPrintOperation *operation,
74                                   GtkPrintContext   *context,
75                                   gint               page_nr,
76                                   GtkPageSetup      *setup);
77   void     (*draw_page)          (GtkPrintOperation *operation,
78                                   GtkPrintContext   *context,
79                                   gint               page_nr);
80   void     (*end_print)          (GtkPrintOperation *operation,
81                                   GtkPrintContext   *context);
82   void     (*status_changed)     (GtkPrintOperation *operation);
83
84   GtkWidget *(*create_custom_widget) (GtkPrintOperation *operation);
85   void       (*custom_widget_apply)  (GtkPrintOperation *operation,
86                                       GtkWidget *widget);
87   
88   /* Padding for future expansion */
89   void (*_gtk_reserved1) (void);
90   void (*_gtk_reserved2) (void);
91   void (*_gtk_reserved3) (void);
92   void (*_gtk_reserved4) (void);
93   void (*_gtk_reserved5) (void);
94   void (*_gtk_reserved6) (void);
95   void (*_gtk_reserved7) (void);
96 };
97
98 typedef enum {
99   GTK_PRINT_OPERATION_RESULT_ERROR,
100   GTK_PRINT_OPERATION_RESULT_APPLY,
101   GTK_PRINT_OPERATION_RESULT_CANCEL
102 } GtkPrintOperationResult;
103
104 #define GTK_PRINT_ERROR gtk_print_error_quark ()
105
106 typedef enum
107 {
108   GTK_PRINT_ERROR_GENERAL,
109   GTK_PRINT_ERROR_INTERNAL_ERROR,
110   GTK_PRINT_ERROR_NOMEM
111 } GtkPrintError;
112
113 GQuark gtk_print_error_quark (void);
114
115 GType                   gtk_print_operation_get_type               (void) G_GNUC_CONST;
116 GtkPrintOperation *     gtk_print_operation_new                    (void);
117 void                    gtk_print_operation_set_default_page_setup (GtkPrintOperation  *op,
118                                                                     GtkPageSetup       *default_page_setup);
119 GtkPageSetup *          gtk_print_operation_get_default_page_setup (GtkPrintOperation  *op);
120 void                    gtk_print_operation_set_print_settings     (GtkPrintOperation  *op,
121                                                                     GtkPrintSettings   *print_settings);
122 GtkPrintSettings *      gtk_print_operation_get_print_settings     (GtkPrintOperation  *op);
123 void                    gtk_print_operation_set_job_name           (GtkPrintOperation  *op,
124                                                                     const gchar        *job_name);
125 void                    gtk_print_operation_set_n_pages            (GtkPrintOperation  *op,
126                                                                     gint                n_pages);
127 void                    gtk_print_operation_set_current_page       (GtkPrintOperation  *op,
128                                                                     gint                current_page);
129 void                    gtk_print_operation_set_use_full_page      (GtkPrintOperation  *op,
130                                                                     gboolean            full_page);
131 void                    gtk_print_operation_set_unit               (GtkPrintOperation  *op,
132                                                                     GtkUnit             unit);
133 void                    gtk_print_operation_set_show_dialog        (GtkPrintOperation  *op,
134                                                                     gboolean            show_dialog);
135 void                    gtk_print_operation_set_pdf_target         (GtkPrintOperation  *op,
136                                                                     const gchar        *filename);
137 void                    gtk_print_operation_set_track_print_status (GtkPrintOperation  *op,
138                                                                     gboolean            track_status);
139 void                    gtk_print_operation_set_show_progress      (GtkPrintOperation  *op,
140                                                                     gboolean            show_progress);
141 void                    gtk_print_operation_set_custom_tab_label   (GtkPrintOperation  *op,
142                                                                     const gchar        *label);
143 GtkPrintOperationResult gtk_print_operation_run                    (GtkPrintOperation  *op,
144                                                                     GtkWindow          *parent,
145                                                                     GError            **error);
146 GtkPrintStatus          gtk_print_operation_get_status             (GtkPrintOperation  *op);
147 G_CONST_RETURN gchar *  gtk_print_operation_get_status_string      (GtkPrintOperation  *op);
148 gboolean                gtk_print_operation_is_finished            (GtkPrintOperation  *op);
149 void                    gtk_print_operation_cancel                 (GtkPrintOperation  *op);
150
151 GtkPageSetup           *gtk_print_run_page_setup_dialog            (GtkWindow          *parent,
152                                                                     GtkPageSetup       *page_setup,
153                                                                     GtkPrintSettings   *settings);
154
155 typedef void  (* GtkPageSetupDoneFunc) (GtkPageSetup *page_setup, 
156                                         gpointer      data);
157
158 void                    gtk_print_operation_run_async              (GtkPrintOperation    *op,
159                                                                     GtkWindow            *parent);
160 void                    gtk_print_run_page_setup_dialog_async      (GtkWindow            *parent,
161                                                                     GtkPageSetup         *page_setup,
162                                                                     GtkPrintSettings     *settings,
163                                                                     GtkPageSetupDoneFunc  done_cb,
164                                                                     gpointer              data);
165
166 G_END_DECLS
167
168 #endif /* __GTK_PRINT_OPERATION_H__ */