1/* GtkPrinter
2 * Copyright (C) 2006 John (J5) Palmieri <[email protected]>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __GTK_PRINTER_H__
19#define __GTK_PRINTER_H__
20
21#if !defined (__GTK_UNIX_PRINT_H_INSIDE__) && !defined (GTK_COMPILATION)
22#error "Only <gtk/gtkunixprint.h> can be included directly."
23#endif
24
25#include <cairo.h>
26#include <gtk/gtk.h>
27
28G_BEGIN_DECLS
29
30#define GTK_TYPE_PRINT_CAPABILITIES (gtk_print_capabilities_get_type ())
31
32/* Note, this type is manually registered with GObject in gtkprinter.c
33 * If you add any flags, update the registration as well!
34 */
35/**
36 * GtkPrintCapabilities:
37 * @GTK_PRINT_CAPABILITY_PAGE_SET: Print dialog will offer printing even/odd pages.
38 * @GTK_PRINT_CAPABILITY_COPIES: Print dialog will allow to print multiple copies.
39 * @GTK_PRINT_CAPABILITY_COLLATE: Print dialog will allow to collate multiple copies.
40 * @GTK_PRINT_CAPABILITY_REVERSE: Print dialog will allow to print pages in reverse order.
41 * @GTK_PRINT_CAPABILITY_SCALE: Print dialog will allow to scale the output.
42 * @GTK_PRINT_CAPABILITY_GENERATE_PDF: The program will send the document to
43 * the printer in PDF format
44 * @GTK_PRINT_CAPABILITY_GENERATE_PS: The program will send the document to
45 * the printer in Postscript format
46 * @GTK_PRINT_CAPABILITY_PREVIEW: Print dialog will offer a preview
47 * @GTK_PRINT_CAPABILITY_NUMBER_UP: Print dialog will offer printing multiple
48 * pages per sheet. Since 2.12
49 * @GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT: Print dialog will allow to rearrange
50 * pages when printing multiple pages per sheet. Since 2.14
51 *
52 * An enum for specifying which features the print dialog should offer.
53 * If neither %GTK_PRINT_CAPABILITY_GENERATE_PDF nor
54 * %GTK_PRINT_CAPABILITY_GENERATE_PS is specified, GTK+ assumes that all
55 * formats are supported.
56 */
57typedef enum
58{
59 GTK_PRINT_CAPABILITY_PAGE_SET = 1 << 0,
60 GTK_PRINT_CAPABILITY_COPIES = 1 << 1,
61 GTK_PRINT_CAPABILITY_COLLATE = 1 << 2,
62 GTK_PRINT_CAPABILITY_REVERSE = 1 << 3,
63 GTK_PRINT_CAPABILITY_SCALE = 1 << 4,
64 GTK_PRINT_CAPABILITY_GENERATE_PDF = 1 << 5,
65 GTK_PRINT_CAPABILITY_GENERATE_PS = 1 << 6,
66 GTK_PRINT_CAPABILITY_PREVIEW = 1 << 7,
67 GTK_PRINT_CAPABILITY_NUMBER_UP = 1 << 8,
68 GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT = 1 << 9
69} GtkPrintCapabilities;
70
71GDK_AVAILABLE_IN_ALL
72GType gtk_print_capabilities_get_type (void) G_GNUC_CONST;
73
74#define GTK_TYPE_PRINTER (gtk_printer_get_type ())
75#define GTK_PRINTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PRINTER, GtkPrinter))
76#define GTK_PRINTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PRINTER, GtkPrinterClass))
77#define GTK_IS_PRINTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PRINTER))
78#define GTK_IS_PRINTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PRINTER))
79#define GTK_PRINTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PRINTER, GtkPrinterClass))
80
81typedef struct _GtkPrinter GtkPrinter;
82typedef struct _GtkPrinterClass GtkPrinterClass;
83typedef struct _GtkPrinterPrivate GtkPrinterPrivate;
84typedef struct _GtkPrintBackend GtkPrintBackend;
85
86struct _GtkPrintBackend;
87
88struct _GtkPrinter
89{
90 GObject parent_instance;
91
92 /*< private >*/
93 GtkPrinterPrivate *priv;
94};
95
96struct _GtkPrinterClass
97{
98 GObjectClass parent_class;
99
100 void (*details_acquired) (GtkPrinter *printer,
101 gboolean success);
102
103 /* Padding for future expansion */
104 void (*_gtk_reserved1) (void);
105 void (*_gtk_reserved2) (void);
106 void (*_gtk_reserved3) (void);
107 void (*_gtk_reserved4) (void);
108 void (*_gtk_reserved5) (void);
109 void (*_gtk_reserved6) (void);
110 void (*_gtk_reserved7) (void);
111 void (*_gtk_reserved8) (void);
112};
113
114GDK_AVAILABLE_IN_ALL
115GType gtk_printer_get_type (void) G_GNUC_CONST;
116GDK_AVAILABLE_IN_ALL
117GtkPrinter *gtk_printer_new (const gchar *name,
118 GtkPrintBackend *backend,
119 gboolean virtual_);
120GDK_AVAILABLE_IN_ALL
121GtkPrintBackend *gtk_printer_get_backend (GtkPrinter *printer);
122GDK_AVAILABLE_IN_ALL
123const gchar * gtk_printer_get_name (GtkPrinter *printer);
124GDK_AVAILABLE_IN_ALL
125const gchar * gtk_printer_get_state_message (GtkPrinter *printer);
126GDK_AVAILABLE_IN_ALL
127const gchar * gtk_printer_get_description (GtkPrinter *printer);
128GDK_AVAILABLE_IN_ALL
129const gchar * gtk_printer_get_location (GtkPrinter *printer);
130GDK_AVAILABLE_IN_ALL
131const gchar * gtk_printer_get_icon_name (GtkPrinter *printer);
132GDK_AVAILABLE_IN_ALL
133gint gtk_printer_get_job_count (GtkPrinter *printer);
134GDK_AVAILABLE_IN_ALL
135gboolean gtk_printer_is_active (GtkPrinter *printer);
136GDK_AVAILABLE_IN_ALL
137gboolean gtk_printer_is_paused (GtkPrinter *printer);
138GDK_AVAILABLE_IN_ALL
139gboolean gtk_printer_is_accepting_jobs (GtkPrinter *printer);
140GDK_AVAILABLE_IN_ALL
141gboolean gtk_printer_is_virtual (GtkPrinter *printer);
142GDK_AVAILABLE_IN_ALL
143gboolean gtk_printer_is_default (GtkPrinter *printer);
144GDK_AVAILABLE_IN_ALL
145gboolean gtk_printer_accepts_pdf (GtkPrinter *printer);
146GDK_AVAILABLE_IN_ALL
147gboolean gtk_printer_accepts_ps (GtkPrinter *printer);
148GDK_AVAILABLE_IN_ALL
149GList *gtk_printer_list_papers (GtkPrinter *printer);
150GDK_AVAILABLE_IN_ALL
151GtkPageSetup *gtk_printer_get_default_page_size (GtkPrinter *printer);
152GDK_AVAILABLE_IN_ALL
153gint gtk_printer_compare (GtkPrinter *a,
154 GtkPrinter *b);
155GDK_AVAILABLE_IN_ALL
156gboolean gtk_printer_has_details (GtkPrinter *printer);
157GDK_AVAILABLE_IN_ALL
158void gtk_printer_request_details (GtkPrinter *printer);
159GDK_AVAILABLE_IN_ALL
160GtkPrintCapabilities gtk_printer_get_capabilities (GtkPrinter *printer);
161GDK_AVAILABLE_IN_ALL
162gboolean gtk_printer_get_hard_margins (GtkPrinter *printer,
163 gdouble *top,
164 gdouble *bottom,
165 gdouble *left,
166 gdouble *right);
167
168/**
169 * GtkPrinterFunc:
170 * @printer: a #GtkPrinter
171 * @data: (closure): user data passed to gtk_enumerate_printers()
172 *
173 * The type of function passed to gtk_enumerate_printers().
174 * Note that you need to ref @printer, if you want to keep
175 * a reference to it after the function has returned.
176 *
177 * Returns: %TRUE to stop the enumeration, %FALSE to continue
178 *
179 * Since: 2.10
180 */
181typedef gboolean (*GtkPrinterFunc) (GtkPrinter *printer,
182 gpointer data);
183
184GDK_AVAILABLE_IN_ALL
185void gtk_enumerate_printers (GtkPrinterFunc func,
186 gpointer data,
187 GDestroyNotify destroy,
188 gboolean wait);
189
190G_END_DECLS
191
192#endif /* __GTK_PRINTER_H__ */
193