1 /*
2  * xed-print-job.h
3  * This file is part of xed
4  *
5  * Copyright (C) 2000-2001 Chema Celorio, Paolo Maggi
6  * Copyright (C) 2002-2008 Paolo Maggi
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  */
23 
24 /*
25  * Modified by the xed Team, 1998-2005. See the AUTHORS file for a
26  * list of people on the xed Team.
27  * See the ChangeLog files for a list of changes.
28  *
29  * $Id$
30  */
31 
32 #ifndef __XED_PRINT_JOB_H__
33 #define __XED_PRINT_JOB_H__
34 
35 #include <gtk/gtk.h>
36 #include <xed/xed-view.h>
37 
38 G_BEGIN_DECLS
39 
40 /*
41  * Type checking and casting macros
42  */
43 #define XED_TYPE_PRINT_JOB              (xed_print_job_get_type())
44 #define XED_PRINT_JOB(obj)              (G_TYPE_CHECK_INSTANCE_CAST((obj), XED_TYPE_PRINT_JOB, XedPrintJob))
45 #define XED_PRINT_JOB_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST((klass), XED_TYPE_PRINT_JOB, XedPrintJobClass))
46 #define XED_IS_PRINT_JOB(obj)           (G_TYPE_CHECK_INSTANCE_TYPE((obj), XED_TYPE_PRINT_JOB))
47 #define XED_IS_PRINT_JOB_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), XED_TYPE_PRINT_JOB))
48 #define XED_PRINT_JOB_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS((obj), XED_TYPE_PRINT_JOB, XedPrintJobClass))
49 
50 
51 typedef enum
52 {
53 	XED_PRINT_JOB_STATUS_INIT,
54 	XED_PRINT_JOB_STATUS_PAGINATING,
55 	XED_PRINT_JOB_STATUS_DRAWING,
56 	XED_PRINT_JOB_STATUS_DONE
57 } XedPrintJobStatus;
58 
59 typedef enum
60 {
61 	XED_PRINT_JOB_RESULT_OK,
62 	XED_PRINT_JOB_RESULT_CANCEL,
63 	XED_PRINT_JOB_RESULT_ERROR
64 } XedPrintJobResult;
65 
66 /* Private structure type */
67 typedef struct _XedPrintJobPrivate XedPrintJobPrivate;
68 
69 /*
70  * Main object structure
71  */
72 typedef struct _XedPrintJob XedPrintJob;
73 
74 
75 struct _XedPrintJob
76 {
77 	GObject parent;
78 
79 	/* <private> */
80 	XedPrintJobPrivate *priv;
81 };
82 
83 /*
84  * Class definition
85  */
86 typedef struct _XedPrintJobClass XedPrintJobClass;
87 
88 struct _XedPrintJobClass
89 {
90 	GObjectClass parent_class;
91 
92         /* Signals */
93 	void (* printing) (XedPrintJob       *job,
94 	                   XedPrintJobStatus  status);
95 
96 	void (* show_preview) (XedPrintJob   *job,
97 	                       GtkWidget       *preview);
98 
99         void (*done)      (XedPrintJob       *job,
100 		           XedPrintJobResult  result,
101                            const GError        *error);
102 };
103 
104 /*
105  * Public methods
106  */
107 GType			 xed_print_job_get_type		(void) G_GNUC_CONST;
108 
109 XedPrintJob		*xed_print_job_new			(XedView                *view);
110 
111 void			 xed_print_job_set_export_filename	(XedPrintJob            *job,
112 								 const gchar              *filename);
113 
114 GtkPrintOperationResult	 xed_print_job_print			(XedPrintJob            *job,
115 								 GtkPrintOperationAction   action,
116 								 GtkPageSetup             *page_setup,
117 								 GtkPrintSettings         *settings,
118 								 GtkWindow                *parent,
119 								 GError                  **error);
120 
121 void			 xed_print_job_cancel			(XedPrintJob            *job);
122 
123 const gchar		*xed_print_job_get_status_string	(XedPrintJob            *job);
124 
125 gdouble			 xed_print_job_get_progress		(XedPrintJob            *job);
126 
127 GtkPrintSettings	*xed_print_job_get_print_settings	(XedPrintJob            *job);
128 
129 GtkPageSetup		*xed_print_job_get_page_setup		(XedPrintJob            *job);
130 
131 G_END_DECLS
132 
133 #endif /* __XED_PRINT_JOB_H__ */
134