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 <gdk/gdk.h> 28 #include <gtk/gtkenums.h> 29 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 /** 39 * GTK_PAPER_NAME_A3: 40 * 41 * Name for the A3 paper size. 42 */ 43 #define GTK_PAPER_NAME_A3 "iso_a3" 44 45 /** 46 * GTK_PAPER_NAME_A4: 47 * 48 * Name for the A4 paper size. 49 */ 50 #define GTK_PAPER_NAME_A4 "iso_a4" 51 52 /** 53 * GTK_PAPER_NAME_A5: 54 * 55 * Name for the A5 paper size. 56 */ 57 #define GTK_PAPER_NAME_A5 "iso_a5" 58 59 /** 60 * GTK_PAPER_NAME_B5: 61 * 62 * Name for the B5 paper size. 63 */ 64 #define GTK_PAPER_NAME_B5 "iso_b5" 65 66 /** 67 * GTK_PAPER_NAME_LETTER: 68 * 69 * Name for the Letter paper size. 70 */ 71 #define GTK_PAPER_NAME_LETTER "na_letter" 72 73 /** 74 * GTK_PAPER_NAME_EXECUTIVE: 75 * 76 * Name for the Executive paper size. 77 */ 78 #define GTK_PAPER_NAME_EXECUTIVE "na_executive" 79 80 /** 81 * GTK_PAPER_NAME_LEGAL: 82 * 83 * Name for the Legal paper size. 84 */ 85 #define GTK_PAPER_NAME_LEGAL "na_legal" 86 87 GDK_AVAILABLE_IN_ALL 88 GType gtk_paper_size_get_type (void) G_GNUC_CONST; 89 90 GDK_AVAILABLE_IN_ALL 91 GtkPaperSize *gtk_paper_size_new (const gchar *name); 92 GDK_AVAILABLE_IN_ALL 93 GtkPaperSize *gtk_paper_size_new_from_ppd (const gchar *ppd_name, 94 const gchar *ppd_display_name, 95 gdouble width, 96 gdouble height); 97 GDK_AVAILABLE_IN_ALL 98 GtkPaperSize *gtk_paper_size_new_from_ipp (const gchar *ipp_name, 99 gdouble width, 100 gdouble height); 101 GDK_AVAILABLE_IN_ALL 102 GtkPaperSize *gtk_paper_size_new_custom (const gchar *name, 103 const gchar *display_name, 104 gdouble width, 105 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 gboolean gtk_paper_size_is_equal (GtkPaperSize *size1, 113 GtkPaperSize *size2); 114 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 GDK_AVAILABLE_IN_ALL 133 gboolean gtk_paper_size_is_ipp (GtkPaperSize *size); 134 135 /* Only for custom sizes: */ 136 GDK_AVAILABLE_IN_ALL 137 void gtk_paper_size_set_size (GtkPaperSize *size, 138 gdouble width, 139 gdouble height, 140 GtkUnit unit); 141 142 GDK_AVAILABLE_IN_ALL 143 gdouble gtk_paper_size_get_default_top_margin (GtkPaperSize *size, 144 GtkUnit unit); 145 GDK_AVAILABLE_IN_ALL 146 gdouble gtk_paper_size_get_default_bottom_margin (GtkPaperSize *size, 147 GtkUnit unit); 148 GDK_AVAILABLE_IN_ALL 149 gdouble gtk_paper_size_get_default_left_margin (GtkPaperSize *size, 150 GtkUnit unit); 151 GDK_AVAILABLE_IN_ALL 152 gdouble gtk_paper_size_get_default_right_margin (GtkPaperSize *size, 153 GtkUnit unit); 154 155 GDK_AVAILABLE_IN_ALL 156 const gchar *gtk_paper_size_get_default (void); 157 158 GDK_AVAILABLE_IN_ALL 159 GtkPaperSize *gtk_paper_size_new_from_key_file (GKeyFile *key_file, 160 const gchar *group_name, 161 GError **error); 162 GDK_AVAILABLE_IN_ALL 163 void gtk_paper_size_to_key_file (GtkPaperSize *size, 164 GKeyFile *key_file, 165 const gchar *group_name); 166 167 GDK_AVAILABLE_IN_3_22 168 GtkPaperSize *gtk_paper_size_new_from_gvariant (GVariant *variant); 169 GDK_AVAILABLE_IN_3_22 170 GVariant *gtk_paper_size_to_gvariant (GtkPaperSize *paper_size); 171 172 G_END_DECLS 173 174 #endif /* __GTK_PAPER_SIZE_H__ */ 175