]> Pileus Git - ~andy/gtk/blob - gtk/gtkprinter.h
stylecontext: Do invalidation on first resize container
[~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, 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
28 G_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  */
57 typedef 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
71 GType gtk_print_capabilities_get_type (void) G_GNUC_CONST;
72
73 #define GTK_TYPE_PRINTER                  (gtk_printer_get_type ())
74 #define GTK_PRINTER(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PRINTER, GtkPrinter))
75 #define GTK_PRINTER_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PRINTER, GtkPrinterClass))
76 #define GTK_IS_PRINTER(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PRINTER))
77 #define GTK_IS_PRINTER_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PRINTER))
78 #define GTK_PRINTER_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PRINTER, GtkPrinterClass))
79
80 typedef struct _GtkPrinter          GtkPrinter;
81 typedef struct _GtkPrinterClass     GtkPrinterClass;
82 typedef struct _GtkPrinterPrivate   GtkPrinterPrivate;
83 typedef struct _GtkPrintBackend     GtkPrintBackend;
84
85 struct _GtkPrintBackend;
86
87 struct _GtkPrinter
88 {
89   GObject parent_instance;
90
91   /*< private >*/
92   GtkPrinterPrivate *priv;
93 };
94
95 struct _GtkPrinterClass
96 {
97   GObjectClass parent_class;
98
99   void (*details_acquired) (GtkPrinter *printer,
100                             gboolean    success);
101
102   /* Padding for future expansion */
103   void (*_gtk_reserved1) (void);
104   void (*_gtk_reserved2) (void);
105   void (*_gtk_reserved3) (void);
106   void (*_gtk_reserved4) (void);
107   void (*_gtk_reserved5) (void);
108   void (*_gtk_reserved6) (void);
109   void (*_gtk_reserved7) (void);
110   void (*_gtk_reserved8) (void);
111 };
112
113 GType                    gtk_printer_get_type              (void) G_GNUC_CONST;
114 GtkPrinter              *gtk_printer_new                   (const gchar     *name,
115                                                             GtkPrintBackend *backend,
116                                                             gboolean         virtual_);
117 GtkPrintBackend         *gtk_printer_get_backend           (GtkPrinter      *printer);
118 const gchar *            gtk_printer_get_name              (GtkPrinter      *printer);
119 const gchar *            gtk_printer_get_state_message     (GtkPrinter      *printer);
120 const gchar *            gtk_printer_get_description       (GtkPrinter      *printer);
121 const gchar *            gtk_printer_get_location          (GtkPrinter      *printer);
122 const gchar *            gtk_printer_get_icon_name         (GtkPrinter      *printer);
123 gint                     gtk_printer_get_job_count         (GtkPrinter      *printer);
124 gboolean                 gtk_printer_is_active             (GtkPrinter      *printer);
125 gboolean                 gtk_printer_is_paused             (GtkPrinter      *printer);
126 gboolean                 gtk_printer_is_accepting_jobs     (GtkPrinter      *printer);
127 gboolean                 gtk_printer_is_virtual            (GtkPrinter      *printer);
128 gboolean                 gtk_printer_is_default            (GtkPrinter      *printer);
129 gboolean                 gtk_printer_accepts_pdf           (GtkPrinter      *printer);
130 gboolean                 gtk_printer_accepts_ps            (GtkPrinter      *printer);
131 GList                   *gtk_printer_list_papers           (GtkPrinter      *printer);
132 GtkPageSetup            *gtk_printer_get_default_page_size (GtkPrinter      *printer);
133 gint                     gtk_printer_compare               (GtkPrinter *a,
134                                                             GtkPrinter *b);
135 gboolean                 gtk_printer_has_details           (GtkPrinter       *printer);
136 void                     gtk_printer_request_details       (GtkPrinter       *printer);
137 GtkPrintCapabilities     gtk_printer_get_capabilities      (GtkPrinter       *printer);
138 gboolean                 gtk_printer_get_hard_margins      (GtkPrinter       *printer,
139                                                             gdouble          *top,
140                                                             gdouble          *bottom,
141                                                             gdouble          *left,
142                                                             gdouble          *right);
143
144 /**
145  * GtkPrinterFunc:
146  * @printer: a #GtkPrinter
147  * @data: (closure): user data passed to gtk_enumerate_printers()
148  *
149  * The type of function passed to gtk_enumerate_printers().
150  * Note that you need to ref @printer, if you want to keep
151  * a reference to it after the function has returned.
152  *
153  * Returns: %TRUE to stop the enumeration, %FALSE to continue
154  *
155  * Since: 2.10
156  */
157 typedef gboolean (*GtkPrinterFunc) (GtkPrinter *printer,
158                                     gpointer    data);
159
160 void                     gtk_enumerate_printers        (GtkPrinterFunc   func,
161                                                         gpointer         data,
162                                                         GDestroyNotify   destroy,
163                                                         gboolean         wait);
164
165 G_END_DECLS
166
167 #endif /* __GTK_PRINTER_H__ */