1/* GTK - The GIMP Toolkit
2 * gtkpapersize.h: Paper Size
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_PAPER_SIZE_H__
20#define __GTK_PAPER_SIZE_H__
21
22
23#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
24#error "Only <gtk/gtk.h> can be included directly."
25#endif
26
27#include <gdk/gdk.h>
28#include <gtk/gtkenums.h>
29
30
31G_BEGIN_DECLS
32
33typedef struct _GtkPaperSize GtkPaperSize;
34
35#define GTK_TYPE_PAPER_SIZE (gtk_paper_size_get_type ())
36
37/* Common names, from PWG 5101.1-2002 PWG: Standard for Media Standardized Names */
38/**
39 * GTK_PAPER_NAME_A3:
40 *
41 * Name for the A3 paper size.
42 */
43#define GTK_PAPER_NAME_A3 "iso_a3"
44
45/**
46 * GTK_PAPER_NAME_A4:
47 *
48 * Name for the A4 paper size.
49 */
50#define GTK_PAPER_NAME_A4 "iso_a4"
51
52/**
53 * GTK_PAPER_NAME_A5:
54 *
55 * Name for the A5 paper size.
56 */
57#define GTK_PAPER_NAME_A5 "iso_a5"
58
59/**
60 * GTK_PAPER_NAME_B5:
61 *
62 * Name for the B5 paper size.
63 */
64#define GTK_PAPER_NAME_B5 "iso_b5"
65
66/**
67 * GTK_PAPER_NAME_LETTER:
68 *
69 * Name for the Letter paper size.
70 */
71#define GTK_PAPER_NAME_LETTER "na_letter"
72
73/**
74 * GTK_PAPER_NAME_EXECUTIVE:
75 *
76 * Name for the Executive paper size.
77 */
78#define GTK_PAPER_NAME_EXECUTIVE "na_executive"
79
80/**
81 * GTK_PAPER_NAME_LEGAL:
82 *
83 * Name for the Legal paper size.
84 */
85#define GTK_PAPER_NAME_LEGAL "na_legal"
86
87GDK_AVAILABLE_IN_ALL
88GType gtk_paper_size_get_type (void) G_GNUC_CONST;
89
90GDK_AVAILABLE_IN_ALL
91GtkPaperSize *gtk_paper_size_new (const char *name);
92GDK_AVAILABLE_IN_ALL
93GtkPaperSize *gtk_paper_size_new_from_ppd (const char *ppd_name,
94 const char *ppd_display_name,
95 double width,
96 double height);
97GDK_AVAILABLE_IN_ALL
98GtkPaperSize *gtk_paper_size_new_from_ipp (const char *ipp_name,
99 double width,
100 double height);
101GDK_AVAILABLE_IN_ALL
102GtkPaperSize *gtk_paper_size_new_custom (const char *name,
103 const char *display_name,
104 double width,
105 double height,
106 GtkUnit unit);
107GDK_AVAILABLE_IN_ALL
108GtkPaperSize *gtk_paper_size_copy (GtkPaperSize *other);
109GDK_AVAILABLE_IN_ALL
110void gtk_paper_size_free (GtkPaperSize *size);
111GDK_AVAILABLE_IN_ALL
112gboolean gtk_paper_size_is_equal (GtkPaperSize *size1,
113 GtkPaperSize *size2);
114
115GDK_AVAILABLE_IN_ALL
116GList *gtk_paper_size_get_paper_sizes (gboolean include_custom);
117
118/* The width is always the shortest side, measure in mm */
119GDK_AVAILABLE_IN_ALL
120const char *gtk_paper_size_get_name (GtkPaperSize *size);
121GDK_AVAILABLE_IN_ALL
122const char *gtk_paper_size_get_display_name (GtkPaperSize *size);
123GDK_AVAILABLE_IN_ALL
124const char *gtk_paper_size_get_ppd_name (GtkPaperSize *size);
125
126GDK_AVAILABLE_IN_ALL
127double gtk_paper_size_get_width (GtkPaperSize *size, GtkUnit unit);
128GDK_AVAILABLE_IN_ALL
129double gtk_paper_size_get_height (GtkPaperSize *size, GtkUnit unit);
130GDK_AVAILABLE_IN_ALL
131gboolean gtk_paper_size_is_custom (GtkPaperSize *size);
132GDK_AVAILABLE_IN_ALL
133gboolean gtk_paper_size_is_ipp (GtkPaperSize *size);
134
135/* Only for custom sizes: */
136GDK_AVAILABLE_IN_ALL
137void gtk_paper_size_set_size (GtkPaperSize *size,
138 double width,
139 double height,
140 GtkUnit unit);
141
142GDK_AVAILABLE_IN_ALL
143double gtk_paper_size_get_default_top_margin (GtkPaperSize *size,
144 GtkUnit unit);
145GDK_AVAILABLE_IN_ALL
146double gtk_paper_size_get_default_bottom_margin (GtkPaperSize *size,
147 GtkUnit unit);
148GDK_AVAILABLE_IN_ALL
149double gtk_paper_size_get_default_left_margin (GtkPaperSize *size,
150 GtkUnit unit);
151GDK_AVAILABLE_IN_ALL
152double gtk_paper_size_get_default_right_margin (GtkPaperSize *size,
153 GtkUnit unit);
154
155GDK_AVAILABLE_IN_ALL
156const char *gtk_paper_size_get_default (void);
157
158GDK_AVAILABLE_IN_ALL
159GtkPaperSize *gtk_paper_size_new_from_key_file (GKeyFile *key_file,
160 const char *group_name,
161 GError **error);
162GDK_AVAILABLE_IN_ALL
163void gtk_paper_size_to_key_file (GtkPaperSize *size,
164 GKeyFile *key_file,
165 const char *group_name);
166
167GDK_AVAILABLE_IN_ALL
168GtkPaperSize *gtk_paper_size_new_from_gvariant (GVariant *variant);
169GDK_AVAILABLE_IN_ALL
170GVariant *gtk_paper_size_to_gvariant (GtkPaperSize *paper_size);
171
172G_END_DECLS
173
174#endif /* __GTK_PAPER_SIZE_H__ */
175

source code of gtk/gtk/gtkpapersize.h