/src/wrappers/gtk/library/gtk_page_setup.e

http://github.com/tybor/Liberty · Specman e · 224 lines · 119 code · 38 blank · 67 comment · 2 complexity · 2b7a76f7d846d9a3dd1e77fa3112f3c2 MD5 · raw file

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