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 36 37 38 39

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))

typedef void  (*GtkPrintSettingsFunc)  (const gchar *key,
					const gchar *value,
					gpointer     user_data);

40
typedef struct _GtkPageRange GtkPageRange;
41 42 43 44 45 46 47
/**
 * GtkPageRange:
 * @start: start of page range.
 * @end: end of page range.
 *
 * See also gtk_print_settings_set_page_ranges().
 */
48
struct _GtkPageRange
49 50 51
{
  gint start;
  gint end;
52
};
53

54
GDK_AVAILABLE_IN_ALL
55
GType             gtk_print_settings_get_type                (void) G_GNUC_CONST;
56
GDK_AVAILABLE_IN_ALL
57
GtkPrintSettings *gtk_print_settings_new                     (void);
58

59
GDK_AVAILABLE_IN_ALL
60
GtkPrintSettings *gtk_print_settings_copy                    (GtkPrintSettings     *other);
Matthias Clasen's avatar
Matthias Clasen committed
61

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

142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
#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"
165 166 167
#define GTK_PRINT_SETTINGS_RESOLUTION_X     "resolution-x"
#define GTK_PRINT_SETTINGS_RESOLUTION_Y     "resolution-y"
#define GTK_PRINT_SETTINGS_PRINTER_LPI      "printer-lpi"
168 169 170 171

/**
 * GTK_PRINT_SETTINGS_OUTPUT_DIR:
 *
172
 * The key used by the “Print to file” printer to store the
173 174 175 176
 * directory to which the output should be written.
 *
 * Since: 3.6
 */
177
#define GTK_PRINT_SETTINGS_OUTPUT_DIR       "output-dir"
178 179 180 181

/**
 * GTK_PRINT_SETTINGS_OUTPUT_BASENAME:
 *
182
 * The key used by the “Print to file” printer to store the file
183 184 185 186 187
 * name of the output without the path to the directory and the
 * file extension.
 *
 * Since: 3.6
 */
188
#define GTK_PRINT_SETTINGS_OUTPUT_BASENAME  "output-basename"
189

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

/**
 * GTK_PRINT_SETTINGS_OUTPUT_URI:
 *
201
 * The key used by the “Print to file” printer to store the URI
202
 * to which the output should be written. GTK+ itself supports
203
 * only “file://” URIs.
204
 */
205 206
#define GTK_PRINT_SETTINGS_OUTPUT_URI          "output-uri"

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

/* Helpers: */

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

347 348 349 350 351 352
GDK_AVAILABLE_IN_3_22
GVariant             *gtk_print_settings_to_gvariant           (GtkPrintSettings   *settings);
GDK_AVAILABLE_IN_3_22
GtkPrintSettings     *gtk_print_settings_new_from_gvariant     (GVariant           *variant);


353 354 355
G_END_DECLS

#endif /* __GTK_PRINT_SETTINGS_H__ */