]> Pileus Git - ~andy/gtk/blob - gtk/gtkprinter.h
gtkprinter: unseal private pointer
[~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 typedef enum
38 {
39   GTK_PRINT_CAPABILITY_PAGE_SET         = 1 << 0,
40   GTK_PRINT_CAPABILITY_COPIES           = 1 << 1,
41   GTK_PRINT_CAPABILITY_COLLATE          = 1 << 2,
42   GTK_PRINT_CAPABILITY_REVERSE          = 1 << 3,
43   GTK_PRINT_CAPABILITY_SCALE            = 1 << 4,
44   GTK_PRINT_CAPABILITY_GENERATE_PDF     = 1 << 5,
45   GTK_PRINT_CAPABILITY_GENERATE_PS      = 1 << 6,
46   GTK_PRINT_CAPABILITY_PREVIEW          = 1 << 7,
47   GTK_PRINT_CAPABILITY_NUMBER_UP        = 1 << 8,
48   GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT = 1 << 9
49 } GtkPrintCapabilities;
50
51 GType gtk_print_capabilities_get_type (void) G_GNUC_CONST;
52
53 #define GTK_TYPE_PRINTER                  (gtk_printer_get_type ())
54 #define GTK_PRINTER(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PRINTER, GtkPrinter))
55 #define GTK_PRINTER_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PRINTER, GtkPrinterClass))
56 #define GTK_IS_PRINTER(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PRINTER))
57 #define GTK_IS_PRINTER_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PRINTER))
58 #define GTK_PRINTER_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PRINTER, GtkPrinterClass))
59
60 typedef struct _GtkPrinter          GtkPrinter;
61 typedef struct _GtkPrinterClass     GtkPrinterClass;
62 typedef struct _GtkPrinterPrivate   GtkPrinterPrivate;
63 typedef struct _GtkPrintBackend     GtkPrintBackend;
64
65 struct _GtkPrintBackend;
66
67 struct _GtkPrinter
68 {
69   GObject parent_instance;
70
71   /* <private> */
72   GtkPrinterPrivate *priv;
73 };
74
75 struct _GtkPrinterClass
76 {
77   GObjectClass parent_class;
78
79   void (*details_acquired) (GtkPrinter *printer,
80                             gboolean    success);
81
82   /* Padding for future expansion */
83   void (*_gtk_reserved1) (void);
84   void (*_gtk_reserved2) (void);
85   void (*_gtk_reserved3) (void);
86   void (*_gtk_reserved4) (void);
87   void (*_gtk_reserved5) (void);
88   void (*_gtk_reserved6) (void);
89   void (*_gtk_reserved7) (void);
90 };
91
92 GType                    gtk_printer_get_type              (void) G_GNUC_CONST;
93 GtkPrinter              *gtk_printer_new                   (const gchar     *name,
94                                                             GtkPrintBackend *backend,
95                                                             gboolean         virtual_);
96 GtkPrintBackend         *gtk_printer_get_backend           (GtkPrinter      *printer);
97 G_CONST_RETURN gchar    *gtk_printer_get_name              (GtkPrinter      *printer);
98 G_CONST_RETURN gchar    *gtk_printer_get_state_message     (GtkPrinter      *printer);
99 G_CONST_RETURN gchar    *gtk_printer_get_description       (GtkPrinter      *printer);
100 G_CONST_RETURN gchar    *gtk_printer_get_location          (GtkPrinter      *printer);
101 G_CONST_RETURN gchar    *gtk_printer_get_icon_name         (GtkPrinter      *printer);
102 gint                     gtk_printer_get_job_count         (GtkPrinter      *printer);
103 gboolean                 gtk_printer_is_active             (GtkPrinter      *printer);
104 gboolean                 gtk_printer_is_paused             (GtkPrinter      *printer);
105 gboolean                 gtk_printer_is_accepting_jobs     (GtkPrinter      *printer);
106 gboolean                 gtk_printer_is_virtual            (GtkPrinter      *printer);
107 gboolean                 gtk_printer_is_default            (GtkPrinter      *printer);
108 gboolean                 gtk_printer_accepts_pdf           (GtkPrinter      *printer);
109 gboolean                 gtk_printer_accepts_ps            (GtkPrinter      *printer);
110 GList                   *gtk_printer_list_papers           (GtkPrinter      *printer);
111 GtkPageSetup            *gtk_printer_get_default_page_size (GtkPrinter      *printer);
112 gint                     gtk_printer_compare               (GtkPrinter *a,
113                                                             GtkPrinter *b);
114 gboolean                 gtk_printer_has_details           (GtkPrinter       *printer);
115 void                     gtk_printer_request_details       (GtkPrinter       *printer);
116 GtkPrintCapabilities     gtk_printer_get_capabilities      (GtkPrinter       *printer);
117 gboolean                 gtk_printer_get_hard_margins      (GtkPrinter       *printer,
118                                                             gdouble          *top,
119                                                             gdouble          *bottom,
120                                                             gdouble          *left,
121                                                             gdouble          *right);
122
123 /**
124  * GtkPrinterFunc:
125  * @printer: a #GtkPrinter
126  * @data: user data passed to gtk_enumerate_printers()
127  *
128  * The type of function passed to gtk_enumerate_printers().
129  * Note that you need to ref @printer, if you want to keep
130  * a reference to it after the function has returned.
131  *
132  * Returns: %TRUE to stop the enumeration, %FALSE to continue
133  *
134  * Since: 2.10
135  */
136 typedef gboolean (*GtkPrinterFunc) (GtkPrinter *printer,
137                                     gpointer    data);
138
139 void                     gtk_enumerate_printers        (GtkPrinterFunc   func,
140                                                         gpointer         data,
141                                                         GDestroyNotify   destroy,
142                                                         gboolean         wait);
143
144 G_END_DECLS
145
146 #endif /* __GTK_PRINTER_H__ */