]> Pileus Git - ~andy/gtk/blob - gtk/gtkprintbackend.h
Make symbol list mstch reality.
[~andy/gtk] / gtk / gtkprintbackend.h
1 /* GTK - The GIMP Toolkit
2  * gtkprintbackend.h: Abstract printer backend interfaces
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_BACKEND_H__
22 #define __GTK_PRINT_BACKEND_H__
23
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
27  */
28 #ifndef GTK_PRINT_BACKEND_ENABLE_UNSUPPORTED
29 #error "GtkPrintBackend is not supported API for general use"
30 #endif
31
32 #include <glib-object.h>
33 #include <cairo.h>
34
35 #include "gtkprinter-private.h"
36 #include "gtkprintsettings.h"
37 #include "gtkprinteroption.h"
38 #include "gtkprintjob.h"
39
40 G_BEGIN_DECLS
41
42 typedef struct _GtkPrintBackendIface  GtkPrintBackendIface;
43
44 #define GTK_PRINT_BACKEND_ERROR (gtk_print_backend_error_quark ())
45
46 typedef enum
47 {
48   /* TODO: add specific errors */
49   GTK_PRINT_BACKEND_ERROR_GENERIC
50 } GtkPrintBackendError;
51
52 GQuark     gtk_print_backend_error_quark      (void);
53
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))
58
59 struct _GtkPrintBackendIface
60 {
61   GTypeInterface base_iface;
62
63   /* Global backend methods: */
64   GList      * (*get_printer_list) (GtkPrintBackend *printer_backend);
65
66   GtkPrinter * (*find_printer) (GtkPrintBackend *print_backend,
67                                 const gchar *printer_name);
68   void         (*print_stream) (GtkPrintBackend *print_backend,
69                                 GtkPrintJob *job,
70                                 gint data_fd,
71                                 GtkPrintJobCompleteFunc callback,
72                                 gpointer user_data,
73                                 GDestroyNotify dnotify);
74
75   /* Printer methods: */
76   void                  (*printer_request_details)           (GtkPrinter *printer);
77   cairo_surface_t *     (*printer_create_cairo_surface)      (GtkPrinter *printer,
78                                                               gdouble height,
79                                                               gdouble width,
80                                                               gint cache_fd);
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,
95                                                               double     *top,
96                                                               double     *bottom,
97                                                               double     *left,
98                                                               double     *right);
99
100   /* Signals 
101    */
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);
106 };
107
108 GType   gtk_print_backend_get_type       (void) G_GNUC_CONST;
109
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,
114                                                 GtkPrintJob             *job,
115                                                 gint                     data_fd,
116                                                 GtkPrintJobCompleteFunc  callback,
117                                                 gpointer                 user_data,
118                                                 GDestroyNotify           dnotify);
119 GList *     gtk_print_backend_load_modules     (void);
120
121
122 /* Backend-only functions for GtkPrinter */
123
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,
131                                            gboolean         val);
132 void        gtk_printer_set_is_active     (GtkPrinter      *printer,
133                                            gboolean         val);
134 void        gtk_printer_set_has_details   (GtkPrinter      *printer,
135                                            gboolean         val);
136 void        gtk_printer_set_is_default    (GtkPrinter      *printer,
137                                            gboolean         val);
138 void        gtk_printer_set_icon_name     (GtkPrinter      *printer,
139                                            const gchar     *icon);
140 gboolean    gtk_printer_set_job_count     (GtkPrinter      *printer,
141                                            gint             count);
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,
149                                            gboolean         active);
150
151
152 G_END_DECLS
153
154 #endif /* __GTK_PRINT_BACKEND_H__ */