]> Pileus Git - ~andy/gtk/blob - gtk/gtkpapersize.h
define __GTK_H_INSIDE__ around including all other headers.
[~andy/gtk] / gtk / gtkpapersize.h
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, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
22 #error "Only <gtk/gtk.h> can be included directly."
23 #endif
24
25 #ifndef __GTK_PAPER_SIZE_H__
26 #define __GTK_PAPER_SIZE_H__
27
28 #include <glib-object.h>
29 #include "gtkenums.h"
30
31 G_BEGIN_DECLS
32
33 typedef 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 #define GTK_PAPER_NAME_A3 "iso_a3"
39 #define GTK_PAPER_NAME_A4 "iso_a4"
40 #define GTK_PAPER_NAME_A5 "iso_a5"
41 #define GTK_PAPER_NAME_B5 "iso_b5"
42 #define GTK_PAPER_NAME_LETTER "na_letter"
43 #define GTK_PAPER_NAME_EXECUTIVE "na_executive"
44 #define GTK_PAPER_NAME_LEGAL "na_legal"
45
46 GType gtk_paper_size_get_type (void) G_GNUC_CONST;
47
48 GtkPaperSize *gtk_paper_size_new          (const gchar  *name);
49 GtkPaperSize *gtk_paper_size_new_from_ppd (const gchar  *ppd_name,
50                                            const gchar  *ppd_display_name,
51                                            gdouble       width,
52                                            gdouble       height);
53 GtkPaperSize *gtk_paper_size_new_custom   (const gchar  *name,
54                                            const gchar  *display_name,
55                                            gdouble       width,
56                                            gdouble       height,
57                                            GtkUnit       unit);
58 GtkPaperSize *gtk_paper_size_copy         (GtkPaperSize *other);
59 void          gtk_paper_size_free         (GtkPaperSize *size);
60 gboolean      gtk_paper_size_is_equal     (GtkPaperSize *size1,
61                                            GtkPaperSize *size2);
62
63 GList        *gtk_paper_size_get_paper_sizes (gboolean include_custom);
64
65 /* The width is always the shortest side, measure in mm */
66 G_CONST_RETURN gchar *gtk_paper_size_get_name         (GtkPaperSize *size);
67 G_CONST_RETURN gchar *gtk_paper_size_get_display_name (GtkPaperSize *size);
68 G_CONST_RETURN gchar *gtk_paper_size_get_ppd_name     (GtkPaperSize *size);
69
70 gdouble  gtk_paper_size_get_width        (GtkPaperSize *size, GtkUnit unit);
71 gdouble  gtk_paper_size_get_height       (GtkPaperSize *size, GtkUnit unit);
72 gboolean gtk_paper_size_is_custom        (GtkPaperSize *size);
73
74 /* Only for custom sizes: */
75 void    gtk_paper_size_set_size                  (GtkPaperSize *size, 
76                                                   gdouble       width, 
77                                                   gdouble       height, 
78                                                   GtkUnit       unit);
79
80 gdouble gtk_paper_size_get_default_top_margin    (GtkPaperSize *size,
81                                                   GtkUnit       unit);
82 gdouble gtk_paper_size_get_default_bottom_margin (GtkPaperSize *size,
83                                                   GtkUnit       unit);
84 gdouble gtk_paper_size_get_default_left_margin   (GtkPaperSize *size,
85                                                   GtkUnit       unit);
86 gdouble gtk_paper_size_get_default_right_margin  (GtkPaperSize *size,
87                                                   GtkUnit       unit);
88
89 G_CONST_RETURN gchar *gtk_paper_size_get_default (void);
90
91 GtkPaperSize *gtk_paper_size_new_from_key_file (GKeyFile    *key_file,
92                                                 const gchar *group_name,
93                                                 GError     **error);
94 void     gtk_paper_size_to_key_file            (GtkPaperSize *size,
95                                                 GKeyFile     *key_file,
96                                                 const gchar  *group_name);
97
98 G_END_DECLS
99
100 #endif /* __GTK_PAPER_SIZE_H__ */