]> Pileus Git - ~andy/gtk/blob - gtk/gtkprinter.h
595db5230513b0855da7bce70315911b1883220a
[~andy/gtk] / gtk / gtkprinter.h
1 /* GtkPrinter
2  * Copyright (C) 2006 John (J5) Palmieri <johnp@redhat.com>
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, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #if !defined (__GTK_UNIX_PRINT_H_INSIDE__) && !defined (GTK_COMPILATION)
21 #error "Only <gtk/gtkunixprint.h> can be included directly."
22 #endif
23
24 #ifndef __GTK_PRINTER_H__
25 #define __GTK_PRINTER_H__
26
27 #include <cairo.h>
28 #include <gtk/gtk.h>
29
30 G_BEGIN_DECLS
31
32 #define GTK_TYPE_PRINT_CAPABILITIES (gtk_print_capabilities_get_type ())
33
34 /* Note, this type is manually registered with GObject in gtkprinter.c
35  * If you add any flags, update the registration as well!
36  */
37 /**
38  * GtkPrintCapabilities:
39  * @GTK_PRINT_CAPABILITY_PAGE_SET: Print dialog will offer printing even/odd pages.
40  * @GTK_PRINT_CAPABILITY_COPIES: Print dialog will allow to print multiple copies.
41  * @GTK_PRINT_CAPABILITY_COLLATE: Print dialog will allow to collate multiple copies.
42  * @GTK_PRINT_CAPABILITY_REVERSE: Print dialog will allow to print pages in reverse order.
43  * @GTK_PRINT_CAPABILITY_SCALE: Print dialog will allow to scale the output.
44  * @GTK_PRINT_CAPABILITY_GENERATE_PDF: The program will send the document to
45  *   the printer in PDF format
46  * @GTK_PRINT_CAPABILITY_GENERATE_PS: The program will send the document to
47  *   the printer in Postscript format
48  * @GTK_PRINT_CAPABILITY_PREVIEW: Print dialog will offer a preview
49  * @GTK_PRINT_CAPABILITY_NUMBER_UP: Print dialog will offer printing multiple
50  *   pages per sheet. Since 2.12
51  * @GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT: Print dialog will allow to rearrange
52  *   pages when printing multiple pages per sheet. Since 2.14
53  *
54  * An enum for specifying which features the print dialog should offer.
55  * If neither %GTK_PRINT_CAPABILITY_GENERATE_PDF nor
56  * %GTK_PRINT_CAPABILITY_GENERATE_PS is specified, GTK+ assumes that all
57  * formats are supported.
58  */
59 typedef enum
60 {
61   GTK_PRINT_CAPABILITY_PAGE_SET         = 1 << 0,
62   GTK_PRINT_CAPABILITY_COPIES           = 1 << 1,
63   GTK_PRINT_CAPABILITY_COLLATE          = 1 << 2,
64   GTK_PRINT_CAPABILITY_REVERSE          = 1 << 3,
65   GTK_PRINT_CAPABILITY_SCALE            = 1 << 4,
66   GTK_PRINT_CAPABILITY_GENERATE_PDF     = 1 << 5,
67   GTK_PRINT_CAPABILITY_GENERATE_PS      = 1 << 6,
68   GTK_PRINT_CAPABILITY_PREVIEW          = 1 << 7,
69   GTK_PRINT_CAPABILITY_NUMBER_UP        = 1 << 8,
70   GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT = 1 << 9
71 } GtkPrintCapabilities;
72
73 GType gtk_print_capabilities_get_type (void) G_GNUC_CONST;
74
75 #define GTK_TYPE_PRINTER                  (gtk_printer_get_type ())
76 #define GTK_PRINTER(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PRINTER, GtkPrinter))
77 #define GTK_PRINTER_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PRINTER, GtkPrinterClass))
78 #define GTK_IS_PRINTER(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PRINTER))
79 #define GTK_IS_PRINTER_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PRINTER))
80 #define GTK_PRINTER_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PRINTER, GtkPrinterClass))
81
82 typedef struct _GtkPrinter          GtkPrinter;
83 typedef struct _GtkPrinterClass     GtkPrinterClass;
84 typedef struct _GtkPrinterPrivate   GtkPrinterPrivate;
85 typedef struct _GtkPrintBackend     GtkPrintBackend;
86
87 struct _GtkPrintBackend;
88
89 struct _GtkPrinter
90 {
91   GObject parent_instance;
92
93   /*< private >*/
94   GtkPrinterPrivate *priv;
95 };
96
97 struct _GtkPrinterClass
98 {
99   GObjectClass parent_class;
100
101   void (*details_acquired) (GtkPrinter *printer,
102                             gboolean    success);
103
104   /* Padding for future expansion */
105   void (*_gtk_reserved1) (void);
106   void (*_gtk_reserved2) (void);
107   void (*_gtk_reserved3) (void);
108   void (*_gtk_reserved4) (void);
109   void (*_gtk_reserved5) (void);
110   void (*_gtk_reserved6) (void);
111   void (*_gtk_reserved7) (void);
112   void (*_gtk_reserved8) (void);
113 };
114
115 GType                    gtk_printer_get_type              (void) G_GNUC_CONST;
116 GtkPrinter              *gtk_printer_new                   (const gchar     *name,
117                                                             GtkPrintBackend *backend,
118                                                             gboolean         virtual_);
119 GtkPrintBackend         *gtk_printer_get_backend           (GtkPrinter      *printer);
120 const gchar *            gtk_printer_get_name              (GtkPrinter      *printer);
121 const gchar *            gtk_printer_get_state_message     (GtkPrinter      *printer);
122 const gchar *            gtk_printer_get_description       (GtkPrinter      *printer);
123 const gchar *            gtk_printer_get_location          (GtkPrinter      *printer);
124 const gchar *            gtk_printer_get_icon_name         (GtkPrinter      *printer);
125 gint                     gtk_printer_get_job_count         (GtkPrinter      *printer);
126 gboolean                 gtk_printer_is_active             (GtkPrinter      *printer);
127 gboolean                 gtk_printer_is_paused             (GtkPrinter      *printer);
128 gboolean                 gtk_printer_is_accepting_jobs     (GtkPrinter      *printer);
129 gboolean                 gtk_printer_is_virtual            (GtkPrinter      *printer);
130 gboolean                 gtk_printer_is_default            (GtkPrinter      *printer);
131 gboolean                 gtk_printer_accepts_pdf           (GtkPrinter      *printer);
132 gboolean                 gtk_printer_accepts_ps            (GtkPrinter      *printer);
133 GList                   *gtk_printer_list_papers           (GtkPrinter      *printer);
134 GtkPageSetup            *gtk_printer_get_default_page_size (GtkPrinter      *printer);
135 gint                     gtk_printer_compare               (GtkPrinter *a,
136                                                             GtkPrinter *b);
137 gboolean                 gtk_printer_has_details           (GtkPrinter       *printer);
138 void                     gtk_printer_request_details       (GtkPrinter       *printer);
139 GtkPrintCapabilities     gtk_printer_get_capabilities      (GtkPrinter       *printer);
140 gboolean                 gtk_printer_get_hard_margins      (GtkPrinter       *printer,
141                                                             gdouble          *top,
142                                                             gdouble          *bottom,
143                                                             gdouble          *left,
144                                                             gdouble          *right);
145
146 /**
147  * GtkPrinterFunc:
148  * @printer: a #GtkPrinter
149  * @data: (closure): user data passed to gtk_enumerate_printers()
150  *
151  * The type of function passed to gtk_enumerate_printers().
152  * Note that you need to ref @printer, if you want to keep
153  * a reference to it after the function has returned.
154  *
155  * Returns: %TRUE to stop the enumeration, %FALSE to continue
156  *
157  * Since: 2.10
158  */
159 typedef gboolean (*GtkPrinterFunc) (GtkPrinter *printer,
160                                     gpointer    data);
161
162 void                     gtk_enumerate_printers        (GtkPrinterFunc   func,
163                                                         gpointer         data,
164                                                         GDestroyNotify   destroy,
165                                                         gboolean         wait);
166
167 G_END_DECLS
168
169 #endif /* __GTK_PRINTER_H__ */