gtkprintsettings.h 15.7 KB
Newer Older
Cody Russell's avatar
Cody Russell committed
1
/* GTK - The GIMP Toolkit
2 3 4 5 6 7 8 9 10 11 12 13 14 15
 * gtkprintsettings.h: Print Settings
 * Copyright (C) 2006, Red Hat, Inc.
 *
 * 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
16
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
17
 */
18

19 20 21
#ifndef __GTK_PRINT_SETTINGS_H__
#define __GTK_PRINT_SETTINGS_H__

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

26
#include <gtk/gtkpapersize.h>
27 28 29 30 31 32 33 34 35

G_BEGIN_DECLS

typedef struct _GtkPrintSettings GtkPrintSettings;

#define GTK_TYPE_PRINT_SETTINGS    (gtk_print_settings_get_type ())
#define GTK_PRINT_SETTINGS(obj)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PRINT_SETTINGS, GtkPrintSettings))
#define GTK_IS_PRINT_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PRINT_SETTINGS))

Benjamin Otte's avatar
Benjamin Otte committed
36 37
typedef void  (*GtkPrintSettingsFunc)  (const char *key,
					const char *value,
38 39
					gpointer     user_data);

40
typedef struct _GtkPageRange GtkPageRange;
Matthias Clasen's avatar
Matthias Clasen committed
41

42 43 44 45 46
/**
 * GtkPageRange:
 * @start: start of page range.
 * @end: end of page range.
 *
Matthias Clasen's avatar
Matthias Clasen committed
47 48 49
 * A range of pages to print.
 *
 * See also [method@Gtk.PrintSettings.set_page_ranges].
50
 */
51
struct _GtkPageRange
52
{
Benjamin Otte's avatar
Benjamin Otte committed
53 54
  int start;
  int end;
55
};
56

57
GDK_AVAILABLE_IN_ALL
58
GType             gtk_print_settings_get_type                (void) G_GNUC_CONST;
59
GDK_AVAILABLE_IN_ALL
60
GtkPrintSettings *gtk_print_settings_new                     (void);
61

62
GDK_AVAILABLE_IN_ALL
63
GtkPrintSettings *gtk_print_settings_copy                    (GtkPrintSettings     *other);
Matthias Clasen's avatar
Matthias Clasen committed
64

65
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
66
GtkPrintSettings *gtk_print_settings_new_from_file           (const char           *file_name,
Matthias Clasen's avatar
Matthias Clasen committed
67
							      GError              **error);
68
GDK_AVAILABLE_IN_ALL
69
gboolean          gtk_print_settings_load_file               (GtkPrintSettings     *settings,
Benjamin Otte's avatar
Benjamin Otte committed
70
							      const char           *file_name,
71
							      GError              **error);
72
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
73
gboolean          gtk_print_settings_to_file                 (GtkPrintSettings     *settings,
Benjamin Otte's avatar
Benjamin Otte committed
74
							      const char           *file_name,
Matthias Clasen's avatar
Matthias Clasen committed
75
							      GError              **error);
76
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
77
GtkPrintSettings *gtk_print_settings_new_from_key_file       (GKeyFile             *key_file,
Benjamin Otte's avatar
Benjamin Otte committed
78
							      const char           *group_name,
79
							      GError              **error);
80
GDK_AVAILABLE_IN_ALL
81 82
gboolean          gtk_print_settings_load_key_file           (GtkPrintSettings     *settings,
							      GKeyFile             *key_file,
Benjamin Otte's avatar
Benjamin Otte committed
83
							      const char           *group_name,
Matthias Clasen's avatar
Matthias Clasen committed
84
							      GError              **error);
85
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
86 87
void              gtk_print_settings_to_key_file             (GtkPrintSettings     *settings,
							      GKeyFile             *key_file,
Benjamin Otte's avatar
Benjamin Otte committed
88
							      const char           *group_name);
89
GDK_AVAILABLE_IN_ALL
90
gboolean          gtk_print_settings_has_key                 (GtkPrintSettings     *settings,
Benjamin Otte's avatar
Benjamin Otte committed
91
							      const char           *key);
92
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
93 94
const char *     gtk_print_settings_get                     (GtkPrintSettings     *settings,
							      const char           *key);
95
GDK_AVAILABLE_IN_ALL
96
void              gtk_print_settings_set                     (GtkPrintSettings     *settings,
Benjamin Otte's avatar
Benjamin Otte committed
97 98
							      const char           *key,
							      const char           *value);
99
GDK_AVAILABLE_IN_ALL
100
void              gtk_print_settings_unset                   (GtkPrintSettings     *settings,
Benjamin Otte's avatar
Benjamin Otte committed
101
							      const char           *key);
102
GDK_AVAILABLE_IN_ALL
103 104 105
void              gtk_print_settings_foreach                 (GtkPrintSettings     *settings,
							      GtkPrintSettingsFunc  func,
							      gpointer              user_data);
106
GDK_AVAILABLE_IN_ALL
107
gboolean          gtk_print_settings_get_bool                (GtkPrintSettings     *settings,
Benjamin Otte's avatar
Benjamin Otte committed
108
							      const char           *key);
109
GDK_AVAILABLE_IN_ALL
110
void              gtk_print_settings_set_bool                (GtkPrintSettings     *settings,
Benjamin Otte's avatar
Benjamin Otte committed
111
							      const char           *key,
112
							      gboolean              value);
113
GDK_AVAILABLE_IN_ALL
114
double            gtk_print_settings_get_double              (GtkPrintSettings     *settings,
Benjamin Otte's avatar
Benjamin Otte committed
115
							      const char           *key);
116
GDK_AVAILABLE_IN_ALL
117
double            gtk_print_settings_get_double_with_default (GtkPrintSettings     *settings,
Benjamin Otte's avatar
Benjamin Otte committed
118
							      const char           *key,
119
							      double                def);
120
GDK_AVAILABLE_IN_ALL
121
void              gtk_print_settings_set_double              (GtkPrintSettings     *settings,
Benjamin Otte's avatar
Benjamin Otte committed
122
							      const char           *key,
123
							      double                value);
124
GDK_AVAILABLE_IN_ALL
125
double            gtk_print_settings_get_length              (GtkPrintSettings     *settings,
Benjamin Otte's avatar
Benjamin Otte committed
126
							      const char           *key,
127
							      GtkUnit               unit);
128
GDK_AVAILABLE_IN_ALL
129
void              gtk_print_settings_set_length              (GtkPrintSettings     *settings,
Benjamin Otte's avatar
Benjamin Otte committed
130
							      const char           *key,
131
							      double                value,
132
							      GtkUnit               unit);
133
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
134
int               gtk_print_settings_get_int                 (GtkPrintSettings     *settings,
Benjamin Otte's avatar
Benjamin Otte committed
135
							      const char           *key);
136
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
137
int               gtk_print_settings_get_int_with_default    (GtkPrintSettings     *settings,
Benjamin Otte's avatar
Benjamin Otte committed
138
							      const char           *key,
Benjamin Otte's avatar
Benjamin Otte committed
139
							      int                   def);
140
GDK_AVAILABLE_IN_ALL
141
void              gtk_print_settings_set_int                 (GtkPrintSettings     *settings,
Benjamin Otte's avatar
Benjamin Otte committed
142
							      const char           *key,
Benjamin Otte's avatar
Benjamin Otte committed
143
							      int                   value);
144

145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
#define GTK_PRINT_SETTINGS_PRINTER          "printer"
#define GTK_PRINT_SETTINGS_ORIENTATION      "orientation"
#define GTK_PRINT_SETTINGS_PAPER_FORMAT     "paper-format"
#define GTK_PRINT_SETTINGS_PAPER_WIDTH      "paper-width"
#define GTK_PRINT_SETTINGS_PAPER_HEIGHT     "paper-height"
#define GTK_PRINT_SETTINGS_N_COPIES         "n-copies"
#define GTK_PRINT_SETTINGS_DEFAULT_SOURCE   "default-source"
#define GTK_PRINT_SETTINGS_QUALITY          "quality"
#define GTK_PRINT_SETTINGS_RESOLUTION       "resolution"
#define GTK_PRINT_SETTINGS_USE_COLOR        "use-color"
#define GTK_PRINT_SETTINGS_DUPLEX           "duplex"
#define GTK_PRINT_SETTINGS_COLLATE          "collate"
#define GTK_PRINT_SETTINGS_REVERSE          "reverse"
#define GTK_PRINT_SETTINGS_MEDIA_TYPE       "media-type"
#define GTK_PRINT_SETTINGS_DITHER           "dither"
#define GTK_PRINT_SETTINGS_SCALE            "scale"
#define GTK_PRINT_SETTINGS_PRINT_PAGES      "print-pages"
#define GTK_PRINT_SETTINGS_PAGE_RANGES      "page-ranges"
#define GTK_PRINT_SETTINGS_PAGE_SET         "page-set"
#define GTK_PRINT_SETTINGS_FINISHINGS       "finishings"
#define GTK_PRINT_SETTINGS_NUMBER_UP        "number-up"
#define GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT "number-up-layout"
#define GTK_PRINT_SETTINGS_OUTPUT_BIN       "output-bin"
168 169 170
#define GTK_PRINT_SETTINGS_RESOLUTION_X     "resolution-x"
#define GTK_PRINT_SETTINGS_RESOLUTION_Y     "resolution-y"
#define GTK_PRINT_SETTINGS_PRINTER_LPI      "printer-lpi"
171 172 173 174

/**
 * GTK_PRINT_SETTINGS_OUTPUT_DIR:
 *
William Jon McCann's avatar
William Jon McCann committed
175
 * The key used by the “Print to file” printer to store the
176 177
 * directory to which the output should be written.
 */
Timothy Arceri's avatar
Timothy Arceri committed
178
#define GTK_PRINT_SETTINGS_OUTPUT_DIR       "output-dir"
179 180 181 182

/**
 * GTK_PRINT_SETTINGS_OUTPUT_BASENAME:
 *
William Jon McCann's avatar
William Jon McCann committed
183
 * The key used by the “Print to file” printer to store the file
184 185 186
 * name of the output without the path to the directory and the
 * file extension.
 */
Timothy Arceri's avatar
Timothy Arceri committed
187
#define GTK_PRINT_SETTINGS_OUTPUT_BASENAME  "output-basename"
188

189 190 191
/**
 * GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT:
 *
William Jon McCann's avatar
William Jon McCann committed
192 193
 * The key used by the “Print to file” printer to store the format
 * of the output. The supported values are “PS” and “PDF”.
194
 */
195
#define GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT  "output-file-format"
196 197 198 199

/**
 * GTK_PRINT_SETTINGS_OUTPUT_URI:
 *
William Jon McCann's avatar
William Jon McCann committed
200
 * The key used by the “Print to file” printer to store the URI
Matthias Clasen's avatar
Matthias Clasen committed
201
 * to which the output should be written. GTK itself supports
William Jon McCann's avatar
William Jon McCann committed
202
 * only “file://” URIs.
203
 */
204 205
#define GTK_PRINT_SETTINGS_OUTPUT_URI          "output-uri"

206 207 208 209 210
#define GTK_PRINT_SETTINGS_WIN32_DRIVER_VERSION "win32-driver-version"
#define GTK_PRINT_SETTINGS_WIN32_DRIVER_EXTRA   "win32-driver-extra"

/* Helpers: */

211
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
212
const char *         gtk_print_settings_get_printer           (GtkPrintSettings   *settings);
213
GDK_AVAILABLE_IN_ALL
214
void                  gtk_print_settings_set_printer           (GtkPrintSettings   *settings,
Benjamin Otte's avatar
Benjamin Otte committed
215
								const char         *printer);
216
GDK_AVAILABLE_IN_ALL
217
GtkPageOrientation    gtk_print_settings_get_orientation       (GtkPrintSettings   *settings);
218
GDK_AVAILABLE_IN_ALL
219 220
void                  gtk_print_settings_set_orientation       (GtkPrintSettings   *settings,
								GtkPageOrientation  orientation);
221
GDK_AVAILABLE_IN_ALL
222
GtkPaperSize *        gtk_print_settings_get_paper_size        (GtkPrintSettings   *settings);
223
GDK_AVAILABLE_IN_ALL
224 225
void                  gtk_print_settings_set_paper_size        (GtkPrintSettings   *settings,
								GtkPaperSize       *paper_size);
226
GDK_AVAILABLE_IN_ALL
227
double                gtk_print_settings_get_paper_width       (GtkPrintSettings   *settings,
228
								GtkUnit             unit);
229
GDK_AVAILABLE_IN_ALL
230
void                  gtk_print_settings_set_paper_width       (GtkPrintSettings   *settings,
231
								double              width,
232
								GtkUnit             unit);
233
GDK_AVAILABLE_IN_ALL
234
double                gtk_print_settings_get_paper_height      (GtkPrintSettings   *settings,
235
								GtkUnit             unit);
236
GDK_AVAILABLE_IN_ALL
237
void                  gtk_print_settings_set_paper_height      (GtkPrintSettings   *settings,
238
								double              height,
239
								GtkUnit             unit);
240
GDK_AVAILABLE_IN_ALL
241
gboolean              gtk_print_settings_get_use_color         (GtkPrintSettings   *settings);
242
GDK_AVAILABLE_IN_ALL
243 244
void                  gtk_print_settings_set_use_color         (GtkPrintSettings   *settings,
								gboolean            use_color);
245
GDK_AVAILABLE_IN_ALL
246
gboolean              gtk_print_settings_get_collate           (GtkPrintSettings   *settings);
247
GDK_AVAILABLE_IN_ALL
248 249
void                  gtk_print_settings_set_collate           (GtkPrintSettings   *settings,
								gboolean            collate);
250
GDK_AVAILABLE_IN_ALL
251
gboolean              gtk_print_settings_get_reverse           (GtkPrintSettings   *settings);
252
GDK_AVAILABLE_IN_ALL
253 254
void                  gtk_print_settings_set_reverse           (GtkPrintSettings   *settings,
								gboolean            reverse);
255
GDK_AVAILABLE_IN_ALL
256
GtkPrintDuplex        gtk_print_settings_get_duplex            (GtkPrintSettings   *settings);
257
GDK_AVAILABLE_IN_ALL
258 259
void                  gtk_print_settings_set_duplex            (GtkPrintSettings   *settings,
								GtkPrintDuplex      duplex);
260
GDK_AVAILABLE_IN_ALL
261
GtkPrintQuality       gtk_print_settings_get_quality           (GtkPrintSettings   *settings);
262
GDK_AVAILABLE_IN_ALL
263 264
void                  gtk_print_settings_set_quality           (GtkPrintSettings   *settings,
								GtkPrintQuality     quality);
265
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
266
int                   gtk_print_settings_get_n_copies          (GtkPrintSettings   *settings);
267
GDK_AVAILABLE_IN_ALL
268
void                  gtk_print_settings_set_n_copies          (GtkPrintSettings   *settings,
Benjamin Otte's avatar
Benjamin Otte committed
269
								int                 num_copies);
270
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
271
int                   gtk_print_settings_get_number_up         (GtkPrintSettings   *settings);
272
GDK_AVAILABLE_IN_ALL
273
void                  gtk_print_settings_set_number_up         (GtkPrintSettings   *settings,
Benjamin Otte's avatar
Benjamin Otte committed
274
								int                 number_up);
275
GDK_AVAILABLE_IN_ALL
276
GtkNumberUpLayout     gtk_print_settings_get_number_up_layout  (GtkPrintSettings   *settings);
277
GDK_AVAILABLE_IN_ALL
278 279
void                  gtk_print_settings_set_number_up_layout  (GtkPrintSettings   *settings,
								GtkNumberUpLayout   number_up_layout);
280
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
281
int                   gtk_print_settings_get_resolution        (GtkPrintSettings   *settings);
282
GDK_AVAILABLE_IN_ALL
283
void                  gtk_print_settings_set_resolution        (GtkPrintSettings   *settings,
Benjamin Otte's avatar
Benjamin Otte committed
284
								int                 resolution);
285
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
286
int                   gtk_print_settings_get_resolution_x      (GtkPrintSettings   *settings);
287
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
288
int                   gtk_print_settings_get_resolution_y      (GtkPrintSettings   *settings);
289
GDK_AVAILABLE_IN_ALL
290
void                  gtk_print_settings_set_resolution_xy     (GtkPrintSettings   *settings,
Benjamin Otte's avatar
Benjamin Otte committed
291 292
								int                 resolution_x,
								int                 resolution_y);
293
GDK_AVAILABLE_IN_ALL
294
double                gtk_print_settings_get_printer_lpi       (GtkPrintSettings   *settings);
295
GDK_AVAILABLE_IN_ALL
296
void                  gtk_print_settings_set_printer_lpi       (GtkPrintSettings   *settings,
297
								double              lpi);
298
GDK_AVAILABLE_IN_ALL
299
double                gtk_print_settings_get_scale             (GtkPrintSettings   *settings);
300
GDK_AVAILABLE_IN_ALL
301
void                  gtk_print_settings_set_scale             (GtkPrintSettings   *settings,
302
								double              scale);
303
GDK_AVAILABLE_IN_ALL
304
GtkPrintPages         gtk_print_settings_get_print_pages       (GtkPrintSettings   *settings);
305
GDK_AVAILABLE_IN_ALL
306 307
void                  gtk_print_settings_set_print_pages       (GtkPrintSettings   *settings,
								GtkPrintPages       pages);
308
GDK_AVAILABLE_IN_ALL
309
GtkPageRange *        gtk_print_settings_get_page_ranges       (GtkPrintSettings   *settings,
Benjamin Otte's avatar
Benjamin Otte committed
310
								int                *num_ranges);
311
GDK_AVAILABLE_IN_ALL
312 313
void                  gtk_print_settings_set_page_ranges       (GtkPrintSettings   *settings,
								GtkPageRange       *page_ranges,
Benjamin Otte's avatar
Benjamin Otte committed
314
								int                 num_ranges);
315
GDK_AVAILABLE_IN_ALL
316
GtkPageSet            gtk_print_settings_get_page_set          (GtkPrintSettings   *settings);
317
GDK_AVAILABLE_IN_ALL
318 319
void                  gtk_print_settings_set_page_set          (GtkPrintSettings   *settings,
								GtkPageSet          page_set);
320
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
321
const char *         gtk_print_settings_get_default_source    (GtkPrintSettings   *settings);
322
GDK_AVAILABLE_IN_ALL
323
void                  gtk_print_settings_set_default_source    (GtkPrintSettings   *settings,
Benjamin Otte's avatar
Benjamin Otte committed
324
								const char         *default_source);
325
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
326
const char *         gtk_print_settings_get_media_type        (GtkPrintSettings   *settings);
327
GDK_AVAILABLE_IN_ALL
328
void                  gtk_print_settings_set_media_type        (GtkPrintSettings   *settings,
Benjamin Otte's avatar
Benjamin Otte committed
329
								const char         *media_type);
330
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
331
const char *         gtk_print_settings_get_dither            (GtkPrintSettings   *settings);
332
GDK_AVAILABLE_IN_ALL
333
void                  gtk_print_settings_set_dither            (GtkPrintSettings   *settings,
Benjamin Otte's avatar
Benjamin Otte committed
334
								const char         *dither);
335
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
336
const char *         gtk_print_settings_get_finishings        (GtkPrintSettings   *settings);
337
GDK_AVAILABLE_IN_ALL
338
void                  gtk_print_settings_set_finishings        (GtkPrintSettings   *settings,
Benjamin Otte's avatar
Benjamin Otte committed
339
								const char         *finishings);
340
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
341
const char *         gtk_print_settings_get_output_bin        (GtkPrintSettings   *settings);
342
GDK_AVAILABLE_IN_ALL
343
void                  gtk_print_settings_set_output_bin        (GtkPrintSettings   *settings,
Benjamin Otte's avatar
Benjamin Otte committed
344
								const char         *output_bin);
345

Matthias Clasen's avatar
Matthias Clasen committed
346
GDK_AVAILABLE_IN_ALL
347
GVariant             *gtk_print_settings_to_gvariant           (GtkPrintSettings   *settings);
Matthias Clasen's avatar
Matthias Clasen committed
348
GDK_AVAILABLE_IN_ALL
349 350 351
GtkPrintSettings     *gtk_print_settings_new_from_gvariant     (GVariant           *variant);


352 353 354
G_END_DECLS

#endif /* __GTK_PRINT_SETTINGS_H__ */