]> Pileus Git - ~andy/gtk/blob - gtk/gtkpapersize.h
gtk: Use const instead G_CONST_RETURN
[~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_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
29 #include <gtk/gtkenums.h>
30
31
32 G_BEGIN_DECLS
33
34 typedef struct _GtkPaperSize GtkPaperSize;
35
36 #define GTK_TYPE_PAPER_SIZE    (gtk_paper_size_get_type ())
37
38 /* Common names, from PWG 5101.1-2002 PWG: Standard for Media Standardized Names */
39 /**
40  * GTK_PAPER_NAME_A3:
41  *
42  * Name for the A4 paper size.
43  */
44 #define GTK_PAPER_NAME_A3 "iso_a3"
45
46 /**
47  * GTK_PAPER_NAME_A4:
48  *
49  * Name for the A4 paper size.
50  */
51 #define GTK_PAPER_NAME_A4 "iso_a4"
52
53 /**
54  * GTK_PAPER_NAME_A5:
55  *
56  * Name for the A5 paper size.
57  */
58 #define GTK_PAPER_NAME_A5 "iso_a5"
59
60 /**
61  * GTK_PAPER_NAME_B5:
62  *
63  * Name for the B5 paper size.
64  */
65 #define GTK_PAPER_NAME_B5 "iso_b5"
66
67 /**
68  * GTK_PAPER_NAME_LETTER:
69  *
70  * Name for the Letter paper size.
71  */
72 #define GTK_PAPER_NAME_LETTER "na_letter"
73
74 /**
75  * GTK_PAPER_NAME_EXECUTIVE:
76  *
77  * Name for the Executive paper size.
78  */
79 #define GTK_PAPER_NAME_EXECUTIVE "na_executive"
80
81 /**
82  * GTK_PAPER_NAME_LEGAL:
83  *
84  * Name for the Legal paper size.
85  */
86 #define GTK_PAPER_NAME_LEGAL "na_legal"
87
88 GType gtk_paper_size_get_type (void) G_GNUC_CONST;
89
90 GtkPaperSize *gtk_paper_size_new          (const gchar  *name);
91 GtkPaperSize *gtk_paper_size_new_from_ppd (const gchar  *ppd_name,
92                                            const gchar  *ppd_display_name,
93                                            gdouble       width,
94                                            gdouble       height);
95 GtkPaperSize *gtk_paper_size_new_custom   (const gchar  *name,
96                                            const gchar  *display_name,
97                                            gdouble       width,
98                                            gdouble       height,
99                                            GtkUnit       unit);
100 GtkPaperSize *gtk_paper_size_copy         (GtkPaperSize *other);
101 void          gtk_paper_size_free         (GtkPaperSize *size);
102 gboolean      gtk_paper_size_is_equal     (GtkPaperSize *size1,
103                                            GtkPaperSize *size2);
104
105 GList        *gtk_paper_size_get_paper_sizes (gboolean include_custom);
106
107 /* The width is always the shortest side, measure in mm */
108 const gchar *gtk_paper_size_get_name         (GtkPaperSize *size);
109 const gchar *gtk_paper_size_get_display_name (GtkPaperSize *size);
110 const gchar *gtk_paper_size_get_ppd_name     (GtkPaperSize *size);
111
112 gdouble  gtk_paper_size_get_width        (GtkPaperSize *size, GtkUnit unit);
113 gdouble  gtk_paper_size_get_height       (GtkPaperSize *size, GtkUnit unit);
114 gboolean gtk_paper_size_is_custom        (GtkPaperSize *size);
115
116 /* Only for custom sizes: */
117 void    gtk_paper_size_set_size                  (GtkPaperSize *size, 
118                                                   gdouble       width, 
119                                                   gdouble       height, 
120                                                   GtkUnit       unit);
121
122 gdouble gtk_paper_size_get_default_top_margin    (GtkPaperSize *size,
123                                                   GtkUnit       unit);
124 gdouble gtk_paper_size_get_default_bottom_margin (GtkPaperSize *size,
125                                                   GtkUnit       unit);
126 gdouble gtk_paper_size_get_default_left_margin   (GtkPaperSize *size,
127                                                   GtkUnit       unit);
128 gdouble gtk_paper_size_get_default_right_margin  (GtkPaperSize *size,
129                                                   GtkUnit       unit);
130
131 const gchar *gtk_paper_size_get_default (void);
132
133 GtkPaperSize *gtk_paper_size_new_from_key_file (GKeyFile    *key_file,
134                                                 const gchar *group_name,
135                                                 GError     **error);
136 void     gtk_paper_size_to_key_file            (GtkPaperSize *size,
137                                                 GKeyFile     *key_file,
138                                                 const gchar  *group_name);
139
140 G_END_DECLS
141
142 #endif /* __GTK_PAPER_SIZE_H__ */