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