1/* GTK - The GIMP Toolkit
2 * gtkprintsettings.h: Print Settings
3 * Copyright (C) 2006, Red Hat, Inc.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef __GTK_PRINT_SETTINGS_H__
20#define __GTK_PRINT_SETTINGS_H__
21
22#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
23#error "Only <gtk/gtk.h> can be included directly."
24#endif
25
26#include <gtk/gtkpapersize.h>
27
28G_BEGIN_DECLS
29
30typedef struct _GtkPrintSettings GtkPrintSettings;
31
32#define GTK_TYPE_PRINT_SETTINGS (gtk_print_settings_get_type ())
33#define GTK_PRINT_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PRINT_SETTINGS, GtkPrintSettings))
34#define GTK_IS_PRINT_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PRINT_SETTINGS))
35
36typedef void (*GtkPrintSettingsFunc) (const gchar *key,
37 const gchar *value,
38 gpointer user_data);
39
40typedef struct _GtkPageRange GtkPageRange;
41/**
42 * GtkPageRange:
43 * @start: start of page range.
44 * @end: end of page range.
45 *
46 * See also gtk_print_settings_set_page_ranges().
47 */
48struct _GtkPageRange
49{
50 gint start;
51 gint end;
52};
53
54GDK_AVAILABLE_IN_ALL
55GType gtk_print_settings_get_type (void) G_GNUC_CONST;
56GDK_AVAILABLE_IN_ALL
57GtkPrintSettings *gtk_print_settings_new (void);
58
59GDK_AVAILABLE_IN_ALL
60GtkPrintSettings *gtk_print_settings_copy (GtkPrintSettings *other);
61
62GDK_AVAILABLE_IN_ALL
63GtkPrintSettings *gtk_print_settings_new_from_file (const gchar *file_name,
64 GError **error);
65GDK_AVAILABLE_IN_ALL
66gboolean gtk_print_settings_load_file (GtkPrintSettings *settings,
67 const gchar *file_name,
68 GError **error);
69GDK_AVAILABLE_IN_ALL
70gboolean gtk_print_settings_to_file (GtkPrintSettings *settings,
71 const gchar *file_name,
72 GError **error);
73GDK_AVAILABLE_IN_ALL
74GtkPrintSettings *gtk_print_settings_new_from_key_file (GKeyFile *key_file,
75 const gchar *group_name,
76 GError **error);
77GDK_AVAILABLE_IN_ALL
78gboolean gtk_print_settings_load_key_file (GtkPrintSettings *settings,
79 GKeyFile *key_file,
80 const gchar *group_name,
81 GError **error);
82GDK_AVAILABLE_IN_ALL
83void gtk_print_settings_to_key_file (GtkPrintSettings *settings,
84 GKeyFile *key_file,
85 const gchar *group_name);
86GDK_AVAILABLE_IN_ALL
87gboolean gtk_print_settings_has_key (GtkPrintSettings *settings,
88 const gchar *key);
89GDK_AVAILABLE_IN_ALL
90const gchar * gtk_print_settings_get (GtkPrintSettings *settings,
91 const gchar *key);
92GDK_AVAILABLE_IN_ALL
93void gtk_print_settings_set (GtkPrintSettings *settings,
94 const gchar *key,
95 const gchar *value);
96GDK_AVAILABLE_IN_ALL
97void gtk_print_settings_unset (GtkPrintSettings *settings,
98 const gchar *key);
99GDK_AVAILABLE_IN_ALL
100void gtk_print_settings_foreach (GtkPrintSettings *settings,
101 GtkPrintSettingsFunc func,
102 gpointer user_data);
103GDK_AVAILABLE_IN_ALL
104gboolean gtk_print_settings_get_bool (GtkPrintSettings *settings,
105 const gchar *key);
106GDK_AVAILABLE_IN_ALL
107void gtk_print_settings_set_bool (GtkPrintSettings *settings,
108 const gchar *key,
109 gboolean value);
110GDK_AVAILABLE_IN_ALL
111gdouble gtk_print_settings_get_double (GtkPrintSettings *settings,
112 const gchar *key);
113GDK_AVAILABLE_IN_ALL
114gdouble gtk_print_settings_get_double_with_default (GtkPrintSettings *settings,
115 const gchar *key,
116 gdouble def);
117GDK_AVAILABLE_IN_ALL
118void gtk_print_settings_set_double (GtkPrintSettings *settings,
119 const gchar *key,
120 gdouble value);
121GDK_AVAILABLE_IN_ALL
122gdouble gtk_print_settings_get_length (GtkPrintSettings *settings,
123 const gchar *key,
124 GtkUnit unit);
125GDK_AVAILABLE_IN_ALL
126void gtk_print_settings_set_length (GtkPrintSettings *settings,
127 const gchar *key,
128 gdouble value,
129 GtkUnit unit);
130GDK_AVAILABLE_IN_ALL
131gint gtk_print_settings_get_int (GtkPrintSettings *settings,
132 const gchar *key);
133GDK_AVAILABLE_IN_ALL
134gint gtk_print_settings_get_int_with_default (GtkPrintSettings *settings,
135 const gchar *key,
136 gint def);
137GDK_AVAILABLE_IN_ALL
138void gtk_print_settings_set_int (GtkPrintSettings *settings,
139 const gchar *key,
140 gint value);
141
142#define GTK_PRINT_SETTINGS_PRINTER "printer"
143#define GTK_PRINT_SETTINGS_ORIENTATION "orientation"
144#define GTK_PRINT_SETTINGS_PAPER_FORMAT "paper-format"
145#define GTK_PRINT_SETTINGS_PAPER_WIDTH "paper-width"
146#define GTK_PRINT_SETTINGS_PAPER_HEIGHT "paper-height"
147#define GTK_PRINT_SETTINGS_N_COPIES "n-copies"
148#define GTK_PRINT_SETTINGS_DEFAULT_SOURCE "default-source"
149#define GTK_PRINT_SETTINGS_QUALITY "quality"
150#define GTK_PRINT_SETTINGS_RESOLUTION "resolution"
151#define GTK_PRINT_SETTINGS_USE_COLOR "use-color"
152#define GTK_PRINT_SETTINGS_DUPLEX "duplex"
153#define GTK_PRINT_SETTINGS_COLLATE "collate"
154#define GTK_PRINT_SETTINGS_REVERSE "reverse"
155#define GTK_PRINT_SETTINGS_MEDIA_TYPE "media-type"
156#define GTK_PRINT_SETTINGS_DITHER "dither"
157#define GTK_PRINT_SETTINGS_SCALE "scale"
158#define GTK_PRINT_SETTINGS_PRINT_PAGES "print-pages"
159#define GTK_PRINT_SETTINGS_PAGE_RANGES "page-ranges"
160#define GTK_PRINT_SETTINGS_PAGE_SET "page-set"
161#define GTK_PRINT_SETTINGS_FINISHINGS "finishings"
162#define GTK_PRINT_SETTINGS_NUMBER_UP "number-up"
163#define GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT "number-up-layout"
164#define GTK_PRINT_SETTINGS_OUTPUT_BIN "output-bin"
165#define GTK_PRINT_SETTINGS_RESOLUTION_X "resolution-x"
166#define GTK_PRINT_SETTINGS_RESOLUTION_Y "resolution-y"
167#define GTK_PRINT_SETTINGS_PRINTER_LPI "printer-lpi"
168
169/**
170 * GTK_PRINT_SETTINGS_OUTPUT_DIR:
171 *
172 * The key used by the “Print to file” printer to store the
173 * directory to which the output should be written.
174 *
175 * Since: 3.6
176 */
177#define GTK_PRINT_SETTINGS_OUTPUT_DIR "output-dir"
178
179/**
180 * GTK_PRINT_SETTINGS_OUTPUT_BASENAME:
181 *
182 * The key used by the “Print to file” printer to store the file
183 * name of the output without the path to the directory and the
184 * file extension.
185 *
186 * Since: 3.6
187 */
188#define GTK_PRINT_SETTINGS_OUTPUT_BASENAME "output-basename"
189
190/**
191 * GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT:
192 *
193 * The key used by the “Print to file” printer to store the format
194 * 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 * GTK_PRINT_SETTINGS_OUTPUT_URI:
200 *
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#define GTK_PRINT_SETTINGS_OUTPUT_URI "output-uri"
206
207#define GTK_PRINT_SETTINGS_WIN32_DRIVER_VERSION "win32-driver-version"
208#define GTK_PRINT_SETTINGS_WIN32_DRIVER_EXTRA "win32-driver-extra"
209
210/* Helpers: */
211
212GDK_AVAILABLE_IN_ALL
213const gchar * gtk_print_settings_get_printer (GtkPrintSettings *settings);
214GDK_AVAILABLE_IN_ALL
215void gtk_print_settings_set_printer (GtkPrintSettings *settings,
216 const gchar *printer);
217GDK_AVAILABLE_IN_ALL
218GtkPageOrientation gtk_print_settings_get_orientation (GtkPrintSettings *settings);
219GDK_AVAILABLE_IN_ALL
220void gtk_print_settings_set_orientation (GtkPrintSettings *settings,
221 GtkPageOrientation orientation);
222GDK_AVAILABLE_IN_ALL
223GtkPaperSize * gtk_print_settings_get_paper_size (GtkPrintSettings *settings);
224GDK_AVAILABLE_IN_ALL
225void gtk_print_settings_set_paper_size (GtkPrintSettings *settings,
226 GtkPaperSize *paper_size);
227GDK_AVAILABLE_IN_ALL
228gdouble gtk_print_settings_get_paper_width (GtkPrintSettings *settings,
229 GtkUnit unit);
230GDK_AVAILABLE_IN_ALL
231void gtk_print_settings_set_paper_width (GtkPrintSettings *settings,
232 gdouble width,
233 GtkUnit unit);
234GDK_AVAILABLE_IN_ALL
235gdouble gtk_print_settings_get_paper_height (GtkPrintSettings *settings,
236 GtkUnit unit);
237GDK_AVAILABLE_IN_ALL
238void gtk_print_settings_set_paper_height (GtkPrintSettings *settings,
239 gdouble height,
240 GtkUnit unit);
241GDK_AVAILABLE_IN_ALL
242gboolean gtk_print_settings_get_use_color (GtkPrintSettings *settings);
243GDK_AVAILABLE_IN_ALL
244void gtk_print_settings_set_use_color (GtkPrintSettings *settings,
245 gboolean use_color);
246GDK_AVAILABLE_IN_ALL
247gboolean gtk_print_settings_get_collate (GtkPrintSettings *settings);
248GDK_AVAILABLE_IN_ALL
249void gtk_print_settings_set_collate (GtkPrintSettings *settings,
250 gboolean collate);
251GDK_AVAILABLE_IN_ALL
252gboolean gtk_print_settings_get_reverse (GtkPrintSettings *settings);
253GDK_AVAILABLE_IN_ALL
254void gtk_print_settings_set_reverse (GtkPrintSettings *settings,
255 gboolean reverse);
256GDK_AVAILABLE_IN_ALL
257GtkPrintDuplex gtk_print_settings_get_duplex (GtkPrintSettings *settings);
258GDK_AVAILABLE_IN_ALL
259void gtk_print_settings_set_duplex (GtkPrintSettings *settings,
260 GtkPrintDuplex duplex);
261GDK_AVAILABLE_IN_ALL
262GtkPrintQuality gtk_print_settings_get_quality (GtkPrintSettings *settings);
263GDK_AVAILABLE_IN_ALL
264void gtk_print_settings_set_quality (GtkPrintSettings *settings,
265 GtkPrintQuality quality);
266GDK_AVAILABLE_IN_ALL
267gint gtk_print_settings_get_n_copies (GtkPrintSettings *settings);
268GDK_AVAILABLE_IN_ALL
269void gtk_print_settings_set_n_copies (GtkPrintSettings *settings,
270 gint num_copies);
271GDK_AVAILABLE_IN_ALL
272gint gtk_print_settings_get_number_up (GtkPrintSettings *settings);
273GDK_AVAILABLE_IN_ALL
274void gtk_print_settings_set_number_up (GtkPrintSettings *settings,
275 gint number_up);
276GDK_AVAILABLE_IN_ALL
277GtkNumberUpLayout gtk_print_settings_get_number_up_layout (GtkPrintSettings *settings);
278GDK_AVAILABLE_IN_ALL
279void gtk_print_settings_set_number_up_layout (GtkPrintSettings *settings,
280 GtkNumberUpLayout number_up_layout);
281GDK_AVAILABLE_IN_ALL
282gint gtk_print_settings_get_resolution (GtkPrintSettings *settings);
283GDK_AVAILABLE_IN_ALL
284void gtk_print_settings_set_resolution (GtkPrintSettings *settings,
285 gint resolution);
286GDK_AVAILABLE_IN_ALL
287gint gtk_print_settings_get_resolution_x (GtkPrintSettings *settings);
288GDK_AVAILABLE_IN_ALL
289gint gtk_print_settings_get_resolution_y (GtkPrintSettings *settings);
290GDK_AVAILABLE_IN_ALL
291void gtk_print_settings_set_resolution_xy (GtkPrintSettings *settings,
292 gint resolution_x,
293 gint resolution_y);
294GDK_AVAILABLE_IN_ALL
295gdouble gtk_print_settings_get_printer_lpi (GtkPrintSettings *settings);
296GDK_AVAILABLE_IN_ALL
297void gtk_print_settings_set_printer_lpi (GtkPrintSettings *settings,
298 gdouble lpi);
299GDK_AVAILABLE_IN_ALL
300gdouble gtk_print_settings_get_scale (GtkPrintSettings *settings);
301GDK_AVAILABLE_IN_ALL
302void gtk_print_settings_set_scale (GtkPrintSettings *settings,
303 gdouble scale);
304GDK_AVAILABLE_IN_ALL
305GtkPrintPages gtk_print_settings_get_print_pages (GtkPrintSettings *settings);
306GDK_AVAILABLE_IN_ALL
307void gtk_print_settings_set_print_pages (GtkPrintSettings *settings,
308 GtkPrintPages pages);
309GDK_AVAILABLE_IN_ALL
310GtkPageRange * gtk_print_settings_get_page_ranges (GtkPrintSettings *settings,
311 gint *num_ranges);
312GDK_AVAILABLE_IN_ALL
313void gtk_print_settings_set_page_ranges (GtkPrintSettings *settings,
314 GtkPageRange *page_ranges,
315 gint num_ranges);
316GDK_AVAILABLE_IN_ALL
317GtkPageSet gtk_print_settings_get_page_set (GtkPrintSettings *settings);
318GDK_AVAILABLE_IN_ALL
319void gtk_print_settings_set_page_set (GtkPrintSettings *settings,
320 GtkPageSet page_set);
321GDK_AVAILABLE_IN_ALL
322const gchar * gtk_print_settings_get_default_source (GtkPrintSettings *settings);
323GDK_AVAILABLE_IN_ALL
324void gtk_print_settings_set_default_source (GtkPrintSettings *settings,
325 const gchar *default_source);
326GDK_AVAILABLE_IN_ALL
327const gchar * gtk_print_settings_get_media_type (GtkPrintSettings *settings);
328GDK_AVAILABLE_IN_ALL
329void gtk_print_settings_set_media_type (GtkPrintSettings *settings,
330 const gchar *media_type);
331GDK_AVAILABLE_IN_ALL
332const gchar * gtk_print_settings_get_dither (GtkPrintSettings *settings);
333GDK_AVAILABLE_IN_ALL
334void gtk_print_settings_set_dither (GtkPrintSettings *settings,
335 const gchar *dither);
336GDK_AVAILABLE_IN_ALL
337const gchar * gtk_print_settings_get_finishings (GtkPrintSettings *settings);
338GDK_AVAILABLE_IN_ALL
339void gtk_print_settings_set_finishings (GtkPrintSettings *settings,
340 const gchar *finishings);
341GDK_AVAILABLE_IN_ALL
342const gchar * gtk_print_settings_get_output_bin (GtkPrintSettings *settings);
343GDK_AVAILABLE_IN_ALL
344void gtk_print_settings_set_output_bin (GtkPrintSettings *settings,
345 const gchar *output_bin);
346
347GDK_AVAILABLE_IN_3_22
348GVariant *gtk_print_settings_to_gvariant (GtkPrintSettings *settings);
349GDK_AVAILABLE_IN_3_22
350GtkPrintSettings *gtk_print_settings_new_from_gvariant (GVariant *variant);
351
352
353G_END_DECLS
354
355#endif /* __GTK_PRINT_SETTINGS_H__ */
356