]> Pileus Git - ~andy/gtk/blob - gtk/gtkprintoperation.h
New function to cancel a running print operation.
[~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   /* Padding for future expansion */
85   void (*_gtk_reserved1) (void);
86   void (*_gtk_reserved2) (void);
87   void (*_gtk_reserved3) (void);
88   void (*_gtk_reserved4) (void);
89   void (*_gtk_reserved5) (void);
90   void (*_gtk_reserved6) (void);
91   void (*_gtk_reserved7) (void);
92 };
93
94 typedef enum {
95   GTK_PRINT_OPERATION_RESULT_ERROR,
96   GTK_PRINT_OPERATION_RESULT_APPLY,
97   GTK_PRINT_OPERATION_RESULT_CANCEL
98 } GtkPrintOperationResult;
99
100 #define GTK_PRINT_ERROR gtk_print_error_quark ()
101
102 typedef enum
103 {
104   GTK_PRINT_ERROR_GENERAL,
105   GTK_PRINT_ERROR_INTERNAL_ERROR,
106   GTK_PRINT_ERROR_NOMEM
107 } GtkPrintError;
108
109 GQuark gtk_print_error_quark (void);
110
111 GType                   gtk_print_operation_get_type               (void) G_GNUC_CONST;
112 GtkPrintOperation *     gtk_print_operation_new                    (void);
113 void                    gtk_print_operation_set_default_page_setup (GtkPrintOperation  *op,
114                                                                     GtkPageSetup       *default_page_setup);
115 GtkPageSetup *          gtk_print_operation_get_default_page_setup (GtkPrintOperation  *op);
116 void                    gtk_print_operation_set_print_settings     (GtkPrintOperation  *op,
117                                                                     GtkPrintSettings   *print_settings);
118 GtkPrintSettings *      gtk_print_operation_get_print_settings     (GtkPrintOperation  *op);
119 void                    gtk_print_operation_set_job_name           (GtkPrintOperation  *op,
120                                                                     const gchar        *job_name);
121 void                    gtk_print_operation_set_n_pages            (GtkPrintOperation  *op,
122                                                                     gint                n_pages);
123 void                    gtk_print_operation_set_current_page       (GtkPrintOperation  *op,
124                                                                     gint                current_page);
125 void                    gtk_print_operation_set_use_full_page      (GtkPrintOperation  *op,
126                                                                     gboolean            full_page);
127 void                    gtk_print_operation_set_unit               (GtkPrintOperation  *op,
128                                                                     GtkUnit             unit);
129 void                    gtk_print_operation_set_show_dialog        (GtkPrintOperation  *op,
130                                                                     gboolean            show_dialog);
131 void                    gtk_print_operation_set_pdf_target         (GtkPrintOperation  *op,
132                                                                     const gchar        *filename);
133 void                    gtk_print_operation_set_track_print_status (GtkPrintOperation  *op,
134                                                                     gboolean            track_status);
135 GtkPrintOperationResult gtk_print_operation_run                    (GtkPrintOperation  *op,
136                                                                     GtkWindow          *parent,
137                                                                     GError            **error);
138 GtkPrintStatus          gtk_print_operation_get_status             (GtkPrintOperation  *op);
139 G_CONST_RETURN gchar *  gtk_print_operation_get_status_string      (GtkPrintOperation  *op);
140 gboolean                gtk_print_operation_is_finished            (GtkPrintOperation  *op);
141 void                    gtk_print_operation_cancel                 (GtkPrintOperation  *op);
142
143 GtkPageSetup           *gtk_print_run_page_setup_dialog            (GtkWindow          *parent,
144                                                                     GtkPageSetup       *page_setup,
145                                                                     GtkPrintSettings   *settings);
146
147 typedef void  (* GtkPageSetupDoneFunc) (GtkPageSetup *page_setup, 
148                                         gpointer      data);
149
150 void                    gtk_print_operation_run_async              (GtkPrintOperation    *op,
151                                                                     GtkWindow            *parent);
152 void                    gtk_print_run_page_setup_dialog_async      (GtkWindow            *parent,
153                                                                     GtkPageSetup         *page_setup,
154                                                                     GtkPrintSettings     *settings,
155                                                                     GtkPageSetupDoneFunc  done_cb,
156                                                                     gpointer              data);
157
158 G_END_DECLS
159
160 #endif /* __GTK_PRINT_OPERATION_H__ */