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