/src/wrappers/gtk/library/gtk_page_setup.e
Specman e | 224 lines | 119 code | 38 blank | 67 comment | 2 complexity | 2b7a76f7d846d9a3dd1e77fa3112f3c2 MD5 | raw file
1indexing 2 description: "GtkPageSetup stores page setup information." 3 copyright: "[ 4 Copyright (C) 2007 Paolo Redaelli, GTK+ team 5 6 This library is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Lesser General Public License 8 as published by the Free Software Foundation; either version 2.1 of 9 the License, or (at your option) any later version. 10 11 This library is distributed in the hopeOA that it will be useful, but 12 WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 Lesser General Public License for more details. 15 16 You should have received a copy of the GNU Lesser General Public 17 License along with this library; if not, write to the Free Software 18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19 02110-1301 USA 20 ]" 21 22 wrapped_version: "2.10.6" 23 24class GTK_PAGE_SETUP 25 -- A GtkPageSetup object stores the page size, orientation and 26 -- margins. The idea is that you can get one of these from the page 27 -- setup dialog and then pass it to the GtkPrintOperation when 28 -- printing. The benefit of splitting this out of the 29 -- GtkPrintSettings is that these affect the actual layout of the 30 -- page, and thus need to be set long before user prints. 31 32 -- The margins specified in this object are the "print margins", 33 -- i.e. the parts of the page that the printer cannot print 34 -- on. These are different from the layout margins that a word 35 -- processor uses; they are typically used to determine the minimal 36 -- size for the layout margins. 37 38 -- To obtain a GtkPageSetup use gtk_page_setup_new() to get the 39 -- defaults, or use gtk_print_run_page_setup_dialog() to show the 40 -- page setup dialog and receive the resulting page setup. 41 42 -- Example 3. A page setup dialog 43 44 -- static GtkPrintSettings *settings = NULL; 45 -- static GtkPageSetup *page_setup = NULL; 46 -- 47 -- static void 48 -- do_page_setup (void) 49 -- { 50 -- GtkPageSetup *new_page_setup; 51 -- 52 -- if (settings == NULL) 53 -- settings = gtk_print_settings_new (); 54 -- 55 -- new_page_setup = gtk_print_run_page_setup_dialog (GTK_WINDOW (main_window), 56 -- page_setup, settings); 57 -- 58 -- if (page_setup) 59 -- g_object_unref (page_setup); 60 -- 61 -- page_setup = new_page_setup; 62 -- } 63 64 -- Printing support was added in GTK+ 2.10. 65 66inherit 67 G_OBJECT 68 redefine copy end 69 70insert 71 GTK_PAGE_SETUP_EXTERNALS 72 GTK_PAGE_ORIENTATION 73 74creation make, copy, from_external_pointer 75 76feature {} -- Creation 77 make is 78 -- Creates a new GtkPageSetup. 79 do 80 from_external_pointer(gtk_page_setup_new) 81 end 82 83feature -- Copying 84 copy (another: GTK_PAGE_SETUP) is 85 -- Copies a GtkPageSetup. 86 do 87 from_external_pointer(gtk_page_setup_copy(another.handle)) 88 end 89 90feature -- Queries 91 orientation: INTEGER is 92 -- The page orientation of the GtkPageSetup. 93 do 94 Result:=gtk_page_setup_get_orientation(handle) 95 ensure valid: is_valid_gtk_page_orientation(Result) 96 end 97 98 paper_size: GTK_PAPER_SIZE is 99 -- The paper size of the GtkPageSetup. 100 do 101 create Result.from_external_pointer 102 (gtk_page_setup_get_paper_size(handle)) 103 end 104 105 unit: INTEGER -- The unit used for margins 106 107 top_margin: REAL is 108 -- the top margin. 109 do 110 Result:=gtk_page_setup_get_top_margin(handle,unit) 111 end 112 113 bottom_margin: REAL is 114 -- the bottom margin. 115 do 116 Result:=gtk_page_setup_get_bottom_margin(handle,unit) 117 end 118 119 left_margin: REAL is 120 -- The left margin. 121 do 122 Result:=gtk_page_setup_get_left_margin (handle, unit) 123 end 124 125 right_margin: REAL is 126 -- The right margin. 127 do 128 Result:=gtk_page_setup_get_right_margin (handle, unit) 129 end 130 131 paper_width: REAL is 132 -- The paper width (expressed in `unit'). 133 134 -- Note that this feature takes orientation, but not margins 135 -- into consideration. See `page_width'. 136 do 137 Result:=gtk_page_setup_get_paper_width(handle, unit) 138 end 139 140 paper_height: REAL is 141 -- The paper height unit. 142 143 -- Note that this function takes orientation, but not margins 144 -- into consideration. See `page_height'. 145 do 146 Result:=gtk_page_setup_get_paper_height (handle,unit) 147 end 148 149 page_width: REAL is 150 -- The page width. 151 152 -- Note that this function takes orientation and margins into 153 -- consideration. See `paper_width'. 154 do 155 Result:=gtk_page_setup_get_page_width(handle,unit) 156 end 157 158 page_height: REAL is 159 -- The page height. 160 161 -- Note that this function takes orientation and margins into 162 -- consideration. See `paper_height'. 163 do 164 Result:=gtk_page_setup_get_page_height(handle, unit) 165 end 166 167feature -- Setters 168 set_orientation (an_orientation: INTEGER) is 169 -- Sets the page orientation of the GtkPageSetup. 170 require valid: is_valid_gtk_page_orientation(an_orientation) 171 do 172 gtk_page_setup_set_orientation (handle, an_orientation) 173 end 174 175 set_paper_size (a_paper_size: GTK_PAPER_SIZE) is 176 -- Sets the paper size of the GtkPageSetup without changing 177 -- the margins. See `set_paper_size_and_default_margins'. 178 require size_not_void: a_paper_size /= Void 179 do 180 gtk_page_setup_set_paper_size (handle, a_paper_size.handle) 181 end 182 183 set_unit (a_unit: INTEGER) is 184 -- Use `a_unit' as the unit used to express margins 185 require valid_unit: is_valid_gtk_unit(a_unit) 186 do 187 unit := a_unit 188 end 189 190 set_top_margin (a_margin: REAL) is 191 -- Sets the top margin of the GtkPageSetup to `a_margin'. 192 do 193 gtk_page_setup_set_top_margin(handle,a_margin, unit) 194 ensure set: a_margin=top_margin 195 end 196 197 set_bottom_margin (a_margin: REAL) is 198 -- Sets the bottom margin of the GtkPageSetup to `a_margin', 199 -- expressed in `unit'. 200 do 201 gtk_page_setup_set_bottom_margin(handle, a_margin, unit) 202 end 203 204 set_left_margin (a_margin: REAL) is 205 -- Sets the left margin of the GtkPageSetup to `a_margin', 206 -- expressed in `unit'. 207 do 208 gtk_page_setup_set_left_margin (handle, a_margin, unit) 209 end 210 211 set_right_margin (a_margin: REAL) is 212 -- Sets the right margin of the GtkPageSetup. 213 do 214 gtk_page_setup_set_right_margin (handle, a_margin, unit) 215 end 216 217 set_paper_size_and_default_margins (a_size: GTK_PAPER_SIZE) is 218 -- Sets the paper size of the GtkPageSetup and modifies the 219 -- margins according to `a_size'. 220 require size_not_void: a_size /= Void 221 do 222 gtk_page_setup_set_paper_size_and_default_margins(handle,a_size.handle) 223 end 224end -- class GTK_PAGE_SETUP