gtkprinter.h 7.87 KB
Newer Older
1
/* GtkPrinter
2 3 4 5 6 7 8 9 10 11 12 13 14
 * Copyright (C) 2006 John (J5) Palmieri <johnp@redhat.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
Javier Jardón's avatar
Javier Jardón committed
15
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16
 */
17

18 19 20
#ifndef __GTK_PRINTER_H__
#define __GTK_PRINTER_H__

21
#if !defined (__GTK_UNIX_PRINT_H_INSIDE__) && !defined (GTK_COMPILATION)
22 23 24
#error "Only <gtk/gtkunixprint.h> can be included directly."
#endif

25
#include <cairo.h>
26
#include <gtk/gtk.h>
27 28 29

G_BEGIN_DECLS

30
#define GTK_TYPE_PRINT_CAPABILITIES (gtk_print_capabilities_get_type ())
31

32 33 34
/* Note, this type is manually registered with GObject in gtkprinter.c
 * If you add any flags, update the registration as well!
 */
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
/**
 * GtkPrintCapabilities:
 * @GTK_PRINT_CAPABILITY_PAGE_SET: Print dialog will offer printing even/odd pages.
 * @GTK_PRINT_CAPABILITY_COPIES: Print dialog will allow to print multiple copies.
 * @GTK_PRINT_CAPABILITY_COLLATE: Print dialog will allow to collate multiple copies.
 * @GTK_PRINT_CAPABILITY_REVERSE: Print dialog will allow to print pages in reverse order.
 * @GTK_PRINT_CAPABILITY_SCALE: Print dialog will allow to scale the output.
 * @GTK_PRINT_CAPABILITY_GENERATE_PDF: The program will send the document to
 *   the printer in PDF format
 * @GTK_PRINT_CAPABILITY_GENERATE_PS: The program will send the document to
 *   the printer in Postscript format
 * @GTK_PRINT_CAPABILITY_PREVIEW: Print dialog will offer a preview
 * @GTK_PRINT_CAPABILITY_NUMBER_UP: Print dialog will offer printing multiple
 *   pages per sheet. Since 2.12
 * @GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT: Print dialog will allow to rearrange
 *   pages when printing multiple pages per sheet. Since 2.14
 *
 * An enum for specifying which features the print dialog should offer.
 * If neither %GTK_PRINT_CAPABILITY_GENERATE_PDF nor
 * %GTK_PRINT_CAPABILITY_GENERATE_PS is specified, GTK+ assumes that all
 * formats are supported.
 */
57 58
typedef enum
{
59 60 61 62 63 64 65 66 67 68
  GTK_PRINT_CAPABILITY_PAGE_SET         = 1 << 0,
  GTK_PRINT_CAPABILITY_COPIES           = 1 << 1,
  GTK_PRINT_CAPABILITY_COLLATE          = 1 << 2,
  GTK_PRINT_CAPABILITY_REVERSE          = 1 << 3,
  GTK_PRINT_CAPABILITY_SCALE            = 1 << 4,
  GTK_PRINT_CAPABILITY_GENERATE_PDF     = 1 << 5,
  GTK_PRINT_CAPABILITY_GENERATE_PS      = 1 << 6,
  GTK_PRINT_CAPABILITY_PREVIEW          = 1 << 7,
  GTK_PRINT_CAPABILITY_NUMBER_UP        = 1 << 8,
  GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT = 1 << 9
69 70
} GtkPrintCapabilities;

71
GDK_AVAILABLE_IN_ALL
72 73 74 75 76 77 78 79 80
GType gtk_print_capabilities_get_type (void) G_GNUC_CONST;

#define GTK_TYPE_PRINTER                  (gtk_printer_get_type ())
#define GTK_PRINTER(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PRINTER, GtkPrinter))
#define GTK_PRINTER_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PRINTER, GtkPrinterClass))
#define GTK_IS_PRINTER(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PRINTER))
#define GTK_IS_PRINTER_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PRINTER))
#define GTK_PRINTER_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PRINTER, GtkPrinterClass))

81 82 83 84 85 86 87 88 89 90 91
typedef struct _GtkPrinter          GtkPrinter;
typedef struct _GtkPrinterClass     GtkPrinterClass;
typedef struct _GtkPrinterPrivate   GtkPrinterPrivate;
typedef struct _GtkPrintBackend     GtkPrintBackend;

struct _GtkPrintBackend;

struct _GtkPrinter
{
  GObject parent_instance;

92
  /*< private >*/
93
  GtkPrinterPrivate *priv;
94 95 96 97 98 99
};

struct _GtkPrinterClass
{
  GObjectClass parent_class;

100 101 102
  void (*details_acquired) (GtkPrinter *printer,
                            gboolean    success);

103 104 105 106 107 108 109 110
  /* Padding for future expansion */
  void (*_gtk_reserved1) (void);
  void (*_gtk_reserved2) (void);
  void (*_gtk_reserved3) (void);
  void (*_gtk_reserved4) (void);
  void (*_gtk_reserved5) (void);
  void (*_gtk_reserved6) (void);
  void (*_gtk_reserved7) (void);
111
  void (*_gtk_reserved8) (void);
112 113
};

114
GDK_AVAILABLE_IN_ALL
115
GType                    gtk_printer_get_type              (void) G_GNUC_CONST;
116
GDK_AVAILABLE_IN_ALL
117 118 119
GtkPrinter              *gtk_printer_new                   (const gchar     *name,
							    GtkPrintBackend *backend,
							    gboolean         virtual_);
120
GDK_AVAILABLE_IN_ALL
121
GtkPrintBackend         *gtk_printer_get_backend           (GtkPrinter      *printer);
122
GDK_AVAILABLE_IN_ALL
123
const gchar *            gtk_printer_get_name              (GtkPrinter      *printer);
124
GDK_AVAILABLE_IN_ALL
125
const gchar *            gtk_printer_get_state_message     (GtkPrinter      *printer);
126
GDK_AVAILABLE_IN_ALL
127
const gchar *            gtk_printer_get_description       (GtkPrinter      *printer);
128
GDK_AVAILABLE_IN_ALL
129
const gchar *            gtk_printer_get_location          (GtkPrinter      *printer);
130
GDK_AVAILABLE_IN_ALL
131
const gchar *            gtk_printer_get_icon_name         (GtkPrinter      *printer);
132
GDK_AVAILABLE_IN_ALL
133
gint                     gtk_printer_get_job_count         (GtkPrinter      *printer);
134
GDK_AVAILABLE_IN_ALL
135
gboolean                 gtk_printer_is_active             (GtkPrinter      *printer);
136
GDK_AVAILABLE_IN_ALL
137
gboolean                 gtk_printer_is_paused             (GtkPrinter      *printer);
138
GDK_AVAILABLE_IN_ALL
139
gboolean                 gtk_printer_is_accepting_jobs     (GtkPrinter      *printer);
140
GDK_AVAILABLE_IN_ALL
141
gboolean                 gtk_printer_is_virtual            (GtkPrinter      *printer);
142
GDK_AVAILABLE_IN_ALL
143
gboolean                 gtk_printer_is_default            (GtkPrinter      *printer);
144
GDK_AVAILABLE_IN_ALL
145
gboolean                 gtk_printer_accepts_pdf           (GtkPrinter      *printer);
146
GDK_AVAILABLE_IN_ALL
147
gboolean                 gtk_printer_accepts_ps            (GtkPrinter      *printer);
148
GDK_AVAILABLE_IN_ALL
149
GList                   *gtk_printer_list_papers           (GtkPrinter      *printer);
150
GDK_AVAILABLE_IN_ALL
151
GtkPageSetup            *gtk_printer_get_default_page_size (GtkPrinter      *printer);
152
GDK_AVAILABLE_IN_ALL
153 154
gint                     gtk_printer_compare               (GtkPrinter *a,
						    	    GtkPrinter *b);
155
GDK_AVAILABLE_IN_ALL
156
gboolean                 gtk_printer_has_details           (GtkPrinter       *printer);
157
GDK_AVAILABLE_IN_ALL
158
void                     gtk_printer_request_details       (GtkPrinter       *printer);
159
GDK_AVAILABLE_IN_ALL
160
GtkPrintCapabilities     gtk_printer_get_capabilities      (GtkPrinter       *printer);
161
GDK_AVAILABLE_IN_ALL
162 163 164 165 166
gboolean                 gtk_printer_get_hard_margins      (GtkPrinter       *printer,
                                                            gdouble          *top,
                                                            gdouble          *bottom,
                                                            gdouble          *left,
                                                            gdouble          *right);
167

168 169 170
/**
 * GtkPrinterFunc:
 * @printer: a #GtkPrinter
171
 * @data: (closure): user data passed to gtk_enumerate_printers()
172 173 174 175 176 177 178 179 180
 *
 * The type of function passed to gtk_enumerate_printers().
 * Note that you need to ref @printer, if you want to keep
 * a reference to it after the function has returned.
 *
 * Returns: %TRUE to stop the enumeration, %FALSE to continue
 *
 * Since: 2.10
 */
Matthias Clasen's avatar
Matthias Clasen committed
181 182 183
typedef gboolean (*GtkPrinterFunc) (GtkPrinter *printer,
				    gpointer    data);

184
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
185 186 187 188
void                     gtk_enumerate_printers        (GtkPrinterFunc   func,
							gpointer         data,
							GDestroyNotify   destroy,
							gboolean         wait);
189

190 191 192
G_END_DECLS

#endif /* __GTK_PRINTER_H__ */