1 /* GTK - The GIMP Toolkit
2 * gtkprintbackend.h: Abstract printer backend interfaces
3 * Copyright (C) 2006, Red Hat, Inc.
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.
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.
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.
21 #ifndef __GTK_PRINT_BACKEND_H__
22 #define __GTK_PRINT_BACKEND_H__
24 /* This is a "semi-private" header; it is meant only for
25 * alternate GtkPrintDialog backend modules; no stability guarantees
26 * are made at this point
28 #ifndef GTK_PRINT_BACKEND_ENABLE_UNSUPPORTED
29 #error "GtkPrintBackend is not supported API for general use"
32 #include <glib-object.h>
35 #include "gtkprinter-private.h"
36 #include "gtkprintsettings.h"
37 #include "gtkprinteroption.h"
38 #include "gtkprintjob.h"
42 typedef struct _GtkPrintBackendIface GtkPrintBackendIface;
44 #define GTK_PRINT_BACKEND_ERROR (gtk_print_backend_error_quark ())
48 /* TODO: add specific errors */
49 GTK_PRINT_BACKEND_ERROR_GENERIC
50 } GtkPrintBackendError;
52 GQuark gtk_print_backend_error_quark (void);
54 #define GTK_TYPE_PRINT_BACKEND (gtk_print_backend_get_type ())
55 #define GTK_PRINT_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PRINT_BACKEND, GtkPrintBackend))
56 #define GTK_IS_PRINT_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PRINT_BACKEND))
57 #define GTK_PRINT_BACKEND_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GTK_TYPE_PRINT_BACKEND, GtkPrintBackendIface))
59 struct _GtkPrintBackendIface
61 GTypeInterface base_iface;
63 /* Global backend methods: */
64 GList * (*get_printer_list) (GtkPrintBackend *printer_backend);
66 GtkPrinter * (*find_printer) (GtkPrintBackend *print_backend,
67 const gchar *printer_name);
68 void (*print_stream) (GtkPrintBackend *print_backend,
71 GtkPrintJobCompleteFunc callback,
73 GDestroyNotify dnotify);
75 /* Printer methods: */
76 void (*printer_request_details) (GtkPrinter *printer);
77 cairo_surface_t * (*printer_create_cairo_surface) (GtkPrinter *printer,
81 GtkPrinterOptionSet * (*printer_get_options) (GtkPrinter *printer,
82 GtkPrintSettings *settings,
83 GtkPageSetup *page_setup);
84 gboolean (*printer_mark_conflicts) (GtkPrinter *printer,
85 GtkPrinterOptionSet *options);
86 void (*printer_get_settings_from_options) (GtkPrinter *printer,
87 GtkPrinterOptionSet *options,
88 GtkPrintSettings *settings);
89 void (*printer_prepare_for_print) (GtkPrinter *printer,
90 GtkPrintJob *print_job,
91 GtkPrintSettings *settings,
92 GtkPageSetup *page_setup);
93 GList * (*printer_list_papers) (GtkPrinter *printer);
94 void (*printer_get_hard_margins) (GtkPrinter *printer,
102 void (*printer_list_changed) (void);
103 void (*printer_added) (GtkPrinter *printer);
104 void (*printer_removed) (GtkPrinter *printer);
105 void (*printer_status_changed) (GtkPrinter *printer);
108 GType gtk_print_backend_get_type (void) G_GNUC_CONST;
110 GList *gtk_print_backend_get_printer_list (GtkPrintBackend *print_backend);
111 GtkPrinter *gtk_print_backend_find_printer (GtkPrintBackend *print_backend,
112 const gchar *printer_name);
113 void gtk_print_backend_print_stream (GtkPrintBackend *print_backend,
116 GtkPrintJobCompleteFunc callback,
118 GDestroyNotify dnotify);
119 GList * gtk_print_backend_load_modules (void);
122 /* Backend-only functions for GtkPrinter */
124 GtkPrinter *gtk_printer_new (const char *name,
125 GtkPrintBackend *backend,
126 gboolean is_virtual);
127 void gtk_printer_set_backend (GtkPrinter *printer,
128 GtkPrintBackend *backend);
129 gboolean gtk_printer_is_new (GtkPrinter *printer);
130 void gtk_printer_set_is_new (GtkPrinter *printer,
132 void gtk_printer_set_is_active (GtkPrinter *printer,
134 void gtk_printer_set_has_details (GtkPrinter *printer,
136 void gtk_printer_set_is_default (GtkPrinter *printer,
138 void gtk_printer_set_icon_name (GtkPrinter *printer,
140 gboolean gtk_printer_set_job_count (GtkPrinter *printer,
142 gboolean gtk_printer_set_location (GtkPrinter *printer,
143 const gchar *location);
144 gboolean gtk_printer_set_description (GtkPrinter *printer,
145 const gchar *description);
146 gboolean gtk_printer_set_state_message (GtkPrinter *printer,
147 const gchar *message);
148 void gtk_printer_set_is_active (GtkPrinter *printer,
154 #endif /* __GTK_PRINT_BACKEND_H__ */