gtkpapersize.h 5.06 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
 * gtkpapersize.h: Paper Size
 * 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_PAPER_SIZE_H__
#define __GTK_PAPER_SIZE_H__

22

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

27
#include <gdk/gdk.h>
28
#include <gtk/gtkenums.h>
29

30

31 32 33 34 35 36 37
G_BEGIN_DECLS

typedef struct _GtkPaperSize GtkPaperSize;

#define GTK_TYPE_PAPER_SIZE    (gtk_paper_size_get_type ())

/* Common names, from PWG 5101.1-2002 PWG: Standard for Media Standardized Names */
38 39 40
/**
 * GTK_PAPER_NAME_A3:
 *
Luc Pionchon's avatar
Luc Pionchon committed
41
 * Name for the A3 paper size.
42
 */
43
#define GTK_PAPER_NAME_A3 "iso_a3"
44 45 46 47 48 49

/**
 * GTK_PAPER_NAME_A4:
 *
 * Name for the A4 paper size.
 */
50
#define GTK_PAPER_NAME_A4 "iso_a4"
51 52 53 54 55 56

/**
 * GTK_PAPER_NAME_A5:
 *
 * Name for the A5 paper size.
 */
57
#define GTK_PAPER_NAME_A5 "iso_a5"
58 59 60 61 62 63

/**
 * GTK_PAPER_NAME_B5:
 *
 * Name for the B5 paper size.
 */
64
#define GTK_PAPER_NAME_B5 "iso_b5"
65 66 67 68 69 70

/**
 * GTK_PAPER_NAME_LETTER:
 *
 * Name for the Letter paper size.
 */
71
#define GTK_PAPER_NAME_LETTER "na_letter"
72 73 74 75 76 77

/**
 * GTK_PAPER_NAME_EXECUTIVE:
 *
 * Name for the Executive paper size.
 */
78
#define GTK_PAPER_NAME_EXECUTIVE "na_executive"
79 80 81 82 83 84

/**
 * GTK_PAPER_NAME_LEGAL:
 *
 * Name for the Legal paper size.
 */
85 86
#define GTK_PAPER_NAME_LEGAL "na_legal"

87
GDK_AVAILABLE_IN_ALL
88 89
GType gtk_paper_size_get_type (void) G_GNUC_CONST;

90
GDK_AVAILABLE_IN_ALL
91
GtkPaperSize *gtk_paper_size_new          (const gchar  *name);
92
GDK_AVAILABLE_IN_ALL
93 94 95 96
GtkPaperSize *gtk_paper_size_new_from_ppd (const gchar  *ppd_name,
					   const gchar  *ppd_display_name,
					   gdouble       width,
					   gdouble       height);
97
GDK_AVAILABLE_IN_ALL
98
GtkPaperSize *gtk_paper_size_new_from_ipp (const gchar  *ipp_name,
99 100 101
					   gdouble       width,
					   gdouble       height);
GDK_AVAILABLE_IN_ALL
102 103 104 105
GtkPaperSize *gtk_paper_size_new_custom   (const gchar  *name,
					   const gchar  *display_name,
					   gdouble       width,
					   gdouble       height,
106
					   GtkUnit       unit);
107
GDK_AVAILABLE_IN_ALL
108
GtkPaperSize *gtk_paper_size_copy         (GtkPaperSize *other);
109
GDK_AVAILABLE_IN_ALL
110
void          gtk_paper_size_free         (GtkPaperSize *size);
111
GDK_AVAILABLE_IN_ALL
112 113 114
gboolean      gtk_paper_size_is_equal     (GtkPaperSize *size1,
					   GtkPaperSize *size2);

115
GDK_AVAILABLE_IN_ALL
116
GList        *gtk_paper_size_get_paper_sizes (gboolean include_custom);
117 118

/* The width is always the shortest side, measure in mm */
119
GDK_AVAILABLE_IN_ALL
120
const gchar *gtk_paper_size_get_name         (GtkPaperSize *size);
121
GDK_AVAILABLE_IN_ALL
122
const gchar *gtk_paper_size_get_display_name (GtkPaperSize *size);
123
GDK_AVAILABLE_IN_ALL
124
const gchar *gtk_paper_size_get_ppd_name     (GtkPaperSize *size);
125

126
GDK_AVAILABLE_IN_ALL
127
gdouble  gtk_paper_size_get_width        (GtkPaperSize *size, GtkUnit unit);
128
GDK_AVAILABLE_IN_ALL
129
gdouble  gtk_paper_size_get_height       (GtkPaperSize *size, GtkUnit unit);
130
GDK_AVAILABLE_IN_ALL
131
gboolean gtk_paper_size_is_custom        (GtkPaperSize *size);
132 133
GDK_AVAILABLE_IN_ALL
gboolean gtk_paper_size_is_ipp           (GtkPaperSize *size);
134 135

/* Only for custom sizes: */
136
GDK_AVAILABLE_IN_ALL
137 138 139 140 141
void    gtk_paper_size_set_size                  (GtkPaperSize *size, 
                                                  gdouble       width, 
                                                  gdouble       height, 
                                                  GtkUnit       unit);

142
GDK_AVAILABLE_IN_ALL
143 144
gdouble gtk_paper_size_get_default_top_margin    (GtkPaperSize *size,
						  GtkUnit       unit);
145
GDK_AVAILABLE_IN_ALL
146 147
gdouble gtk_paper_size_get_default_bottom_margin (GtkPaperSize *size,
						  GtkUnit       unit);
148
GDK_AVAILABLE_IN_ALL
149 150
gdouble gtk_paper_size_get_default_left_margin   (GtkPaperSize *size,
						  GtkUnit       unit);
151
GDK_AVAILABLE_IN_ALL
152 153 154
gdouble gtk_paper_size_get_default_right_margin  (GtkPaperSize *size,
						  GtkUnit       unit);

155
GDK_AVAILABLE_IN_ALL
156
const gchar *gtk_paper_size_get_default (void);
157

158
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
159 160 161
GtkPaperSize *gtk_paper_size_new_from_key_file (GKeyFile    *key_file,
					        const gchar *group_name,
					        GError     **error);
162
GDK_AVAILABLE_IN_ALL
Matthias Clasen's avatar
Matthias Clasen committed
163 164 165 166
void     gtk_paper_size_to_key_file            (GtkPaperSize *size,
					        GKeyFile     *key_file,
					        const gchar  *group_name);

167 168 169
GDK_AVAILABLE_IN_3_22
GtkPaperSize *gtk_paper_size_new_from_gvariant (GVariant     *variant);
GDK_AVAILABLE_IN_3_22
170
GVariant     *gtk_paper_size_to_gvariant       (GtkPaperSize *paper_size);
171

172 173 174
G_END_DECLS

#endif /* __GTK_PAPER_SIZE_H__ */