]> Pileus Git - ~andy/gtk/blob - gtk/gtkpapersize.h
Merge the gtk-printing branch. For more detailed ChangeLog entries, see
[~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 #ifndef __GTK_PAPER_SIZE_H__
22 #define __GTK_PAPER_SIZE_H__
23
24 #include <glib-object.h>
25 #include "gtkenums.h"
26
27 G_BEGIN_DECLS
28
29 typedef struct _GtkPaperSize GtkPaperSize;
30
31 #define GTK_TYPE_PAPER_SIZE    (gtk_paper_size_get_type ())
32
33 /* Common names, from PWG 5101.1-2002 PWG: Standard for Media Standardized Names */
34 #define GTK_PAPER_NAME_A3 "iso_a3"
35 #define GTK_PAPER_NAME_A4 "iso_a4"
36 #define GTK_PAPER_NAME_A5 "iso_a5"
37 #define GTK_PAPER_NAME_B5 "iso_b5"
38 #define GTK_PAPER_NAME_LETTER "na_letter"
39 #define GTK_PAPER_NAME_EXECUTIVE "na_executive"
40 #define GTK_PAPER_NAME_LEGAL "na_legal"
41
42 GType gtk_paper_size_get_type (void) G_GNUC_CONST;
43
44 GtkPaperSize *gtk_paper_size_new          (const char   *name);
45 GtkPaperSize *gtk_paper_size_new_from_ppd (const char   *ppd_name,
46                                            const char   *ppd_display_name,
47                                            double        width,
48                                            double        height);
49 GtkPaperSize *gtk_paper_size_new_custom   (const char   *name,
50                                            const char   *display_name,
51                                            double        width,
52                                            double        height,
53                                            GtkUnit       unit);
54 GtkPaperSize *gtk_paper_size_copy         (GtkPaperSize *other);
55 void          gtk_paper_size_free         (GtkPaperSize *size);
56 gboolean      gtk_paper_size_is_equal     (GtkPaperSize *size1,
57                                            GtkPaperSize *size2);
58
59
60 /* The width is always the shortest side, measure in mm */
61 G_CONST_RETURN char *   gtk_paper_size_get_name         (GtkPaperSize *size);
62 G_CONST_RETURN char *   gtk_paper_size_get_display_name (GtkPaperSize *size);
63 G_CONST_RETURN char *   gtk_paper_size_get_ppd_name     (GtkPaperSize *size);
64
65 double   gtk_paper_size_get_width        (GtkPaperSize *size, GtkUnit unit);
66 double   gtk_paper_size_get_height       (GtkPaperSize *size, GtkUnit unit);
67 gboolean gtk_paper_size_is_custom        (GtkPaperSize *size);
68
69 /* Only for custom sizes: */
70 void gtk_paper_size_set_size             (GtkPaperSize *size, 
71                                           double        width, 
72                                           double        height, 
73                                           GtkUnit       unit);
74
75 double gtk_paper_size_get_default_top_margin    (GtkPaperSize *size,
76                                                  GtkUnit       unit);
77 double gtk_paper_size_get_default_bottom_margin (GtkPaperSize *size,
78                                                  GtkUnit       unit);
79 double gtk_paper_size_get_default_left_margin   (GtkPaperSize *size,
80                                                  GtkUnit       unit);
81 double gtk_paper_size_get_default_right_margin  (GtkPaperSize *size,
82                                                  GtkUnit       unit);
83
84 G_CONST_RETURN char * gtk_paper_size_get_default (void);
85
86 G_END_DECLS
87
88 #endif /* __GTK_PAPER_SIZE_H__ */