/src/wrappers/gtk/library/gtk_print_job.e

http://github.com/tybor/Liberty · Specman e · 322 lines · 123 code · 39 blank · 160 comment · 4 complexity · 95cd18e5ceafd3a6aa0ccff27a940c13 MD5 · raw file

  1. indexing
  2. description: "GtkPrintJob -- Represents a print job."
  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_PRINT_JOB
  20. -- A GtkPrintJob object represents a job that is sent to a printer. You only
  21. -- need to deal directly with print jobs if you use the non-portable
  22. -- GtkPrintUnixDialog API.
  23. -- Use `surface' to obtain the cairo surface onto which the
  24. -- pages must be drawn. Use `send' to send the finished job to
  25. -- the printer. If you don't use cairo GtkPrintJob also supports printing of
  26. -- manually generated postscript, via `set_source_file'.
  27. -- Printing support was added in GTK+ 2.10.
  28. inherit G_OBJECT
  29. insert
  30. GTK
  31. GTK_PRINT_STATUS
  32. creation make, from_external_pointer
  33. feature {} -- Creation
  34. make (a_title: STRING; a_printer: GTK_PRINTER; some_settings: GTK_PRINT_SETTINGS; a_page_setup: GTK_PAGE_SETUP) is
  35. -- Creates a new GtkPrintJob.
  36. require
  37. title_not_void: a_title /= Void
  38. printer_not_void: a_printer /= Void
  39. settings_not_void: some_settings /= Void
  40. page_setup_not_void: a_page_setup /= Void
  41. do
  42. from_external_pointer(gtk_print_job_new(a_title.to_external, a_printer.handle,
  43. some_settings.handle, a_page_setup.handle))
  44. end
  45. feature
  46. settings: GTK_PRINT_SETTINGS is
  47. -- the GtkPrintSettings of the print job.
  48. local p: POINTER; r: G_OBJECT_EXPANDED_FACTORY[GTK_PRINT_SETTINGS]
  49. do
  50. p:=gtk_print_job_get_settings(handle)
  51. check pointer_not_void: p.is_not_null end
  52. Result:=r.wrapper(p)
  53. if Result=Void then
  54. create Result.from_external_pointer(p)
  55. end
  56. ensure not_void: Result/=Void
  57. end
  58. printer: GTK_PRINTER is
  59. -- the GtkPrinter of the print job.
  60. local p: POINTER; r: G_OBJECT_EXPANDED_FACTORY[GTK_PRINTER]
  61. do
  62. p:=gtk_print_job_get_printer(handle)
  63. Result:=r.wrapper(p)
  64. if Result=Void then
  65. create Result.from_external_pointer(p)
  66. end
  67. ensure not_void: Result/=Void
  68. end
  69. title: CONST_STRING is
  70. -- the job title.
  71. do
  72. create Result.from_external (gtk_print_job_get_title(handle))
  73. ensure not_void: Result /= Void
  74. end
  75. status: INTEGER is
  76. -- the status of the print job.
  77. do
  78. Result:=gtk_print_job_get_status(handle)
  79. ensure valid: is_valid_gtk_print_status(Result)
  80. end
  81. is_successful: BOOLEAN
  82. -- Have the last call of `set_source_file' been successful?
  83. set_source_file (a_filename: STRING) is
  84. -- Send an existing document to the printing system. The file
  85. -- can be in any format understood by the platforms printing
  86. -- system (typically PostScript, but on many platforms PDF
  87. -- may work too). See GTK_PRINTER's `accepts_pdf' and
  88. -- `accepts_postscript'.
  89. -- error : return location for errors
  90. -- `is_successful' will contain the Result of the command.
  91. -- If False `gtk.error' will be updated
  92. require name_not_void: a_filename /= Void
  93. do
  94. is_successful:=(gtk_print_job_set_source_file
  95. (handle, a_filename.to_external,
  96. address_of(gtk.error.handle))).to_boolean
  97. end
  98. -- TODO: surface: CAIRO_SURFACE is
  99. --
  100. -- cairo_surface_t* gtk_print_job_get_surface (GtkPrintJob *job,
  101. -- GError **error);
  102. --
  103. -- Gets a cairo surface onto which the pages of the print job should be
  104. -- rendered.
  105. --
  106. -- job : a GtkPrintJob
  107. -- error : return location for errors, or NULL
  108. -- Returns : the cairo surface of job
  109. --
  110. -- Since 2.10
  111. --
  112. -- gtk_print_job_send ()
  113. --
  114. -- void gtk_print_job_send (GtkPrintJob *job,
  115. -- GtkPrintJobCompleteFunc callback,
  116. -- gpointer user_data,
  117. -- GDestroyNotify dnotify);
  118. --
  119. -- Sends the print job off to the printer.
  120. --
  121. -- job : a GtkPrintJob
  122. -- callback : function to call when the job completes or an error occurs
  123. -- user_data : user data that gets passed to callback
  124. -- dnotify : destroy notify for user_data
  125. --
  126. -- Since 2.10
  127. --
  128. set_track_print_status (a_track_status: BOOLEAN) is
  129. -- If `a_track_status' is True, the print job will try to
  130. -- continue report on the status of the print job in the
  131. -- printer queues and printer. This can allow your
  132. -- application to show things like "out of paper" issues, and
  133. -- when the print job actually reaches the printer.
  134. -- This function is often implemented using some form of
  135. -- polling, so it should not be enabled unless needed.
  136. do
  137. gtk_print_job_set_track_print_status(handle,a_track_status.to_integer)
  138. end
  139. tracked_after_printing: BOOLEAN is
  140. -- Will jobs be tracked after printing? For details, see
  141. -- `set_track_print_status'.
  142. do
  143. Result:=gtk_print_job_get_track_print_status(handle).to_boolean
  144. end
  145. feature -- TODO: Properties
  146. --
  147. --
  148. -- "page-setup" GtkPageSetup : Read / Write / Construct Only
  149. -- "printer" GtkPrinter : Read / Write / Construct Only
  150. -- "settings" GtkPrintSettings : Read / Write / Construct Only
  151. -- "title" gchararray : Read / Write / Construct Only
  152. -- "track-print-status" gboolean : Read / Write
  153. --Property Details
  154. --
  155. -- The "page-setup" property
  156. --
  157. -- "page-setup" GtkPageSetup : Read / Write / Construct Only
  158. --
  159. -- Page Setup.
  160. --
  161. -- --------------------------------------------------------------------------
  162. --
  163. -- The "printer" property
  164. --
  165. -- "printer" GtkPrinter : Read / Write / Construct Only
  166. --
  167. -- Printer to print the job to.
  168. --
  169. -- --------------------------------------------------------------------------
  170. --
  171. -- The "settings" property
  172. --
  173. -- "settings" GtkPrintSettings : Read / Write / Construct Only
  174. --
  175. -- Printer settings.
  176. --
  177. -- --------------------------------------------------------------------------
  178. --
  179. -- The "title" property
  180. --
  181. -- "title" gchararray : Read / Write / Construct Only
  182. --
  183. -- Title of the print job.
  184. --
  185. -- Default value: NULL
  186. --
  187. -- --------------------------------------------------------------------------
  188. --
  189. -- The "track-print-status" property
  190. --
  191. -- "track-print-status" gboolean : Read / Write
  192. --
  193. -- TRUE if the print job will continue to emit status-changed signals after
  194. -- the print data has been sent to the printer or print server.
  195. --
  196. -- Default value: FALSE
  197. --
  198. feature -- TODO: Signals
  199. -- "status-changed"
  200. -- void user_function (GtkPrintJob *job,
  201. -- gpointer user_data) : Run last
  202. --Signal Details
  203. --
  204. -- The "status-changed" signal
  205. --
  206. -- void user_function (GtkPrintJob *job,
  207. -- gpointer user_data) : Run last
  208. --
  209. -- Gets emitted when the status of a job changes. The signal handler can use
  210. -- gtk_print_job_get_status() to obtain the new status.
  211. --
  212. -- job : the GtkPrintJob object on which the signal was emitted
  213. -- user_data : user data set when the signal handler was connected.
  214. --
  215. -- Since 2.10
  216. feature {} -- Unwrapped
  217. -- GtkPrintJobCompleteFunc ()
  218. --
  219. -- void (*GtkPrintJobCompleteFunc) (GtkPrintJob *print_job,
  220. -- gpointer user_data,
  221. -- GError *error);
  222. --
  223. -- The type of callback that is passed to gtk_print_job_send(). It is called
  224. -- when the print job has been completely sent.
  225. --
  226. -- print_job : the GtkPrintJob
  227. -- user_data : user data that has been passed to gtk_print_job_send()
  228. -- error : a GError that contains error information if the sending of the
  229. -- print job failed, otherwise NULL
  230. feature {} -- External calls
  231. -- void (*GtkPrintJobCompleteFunc) (GtkPrintJob *print_job, gpointer
  232. -- user_data, GError *error);
  233. gtk_print_job_new (a_title, a_printer, a_settings, a_page_setup: POINTER): POINTER is
  234. -- GtkPrintJob* gtk_print_job_new (const gchar *title, GtkPrinter
  235. -- *printer, GtkPrintSettings *settings, GtkPageSetup *page_setup);
  236. external "C use <gtk/gtk.h>"
  237. end
  238. gtk_print_job_get_settings (a_job: POINTER): POINTER is
  239. -- GtkPrintSettings* gtk_print_job_get_settings (GtkPrintJob *job);
  240. external "C use <gtk/gtk.h>"
  241. end
  242. gtk_print_job_get_printer (a_job: POINTER): POINTER is
  243. -- GtkPrinter* gtk_print_job_get_printer (GtkPrintJob *job);
  244. external "C use <gtk/gtk.h>"
  245. end
  246. gtk_print_job_get_title (a_job: POINTER): POINTER is
  247. -- const gchar* gtk_print_job_get_title (GtkPrintJob *job);
  248. external "C use <gtk/gtk.h>"
  249. end
  250. gtk_print_job_get_status (a_job: POINTER): INTEGER is
  251. -- GtkPrintStatus gtk_print_job_get_status (GtkPrintJob *job);
  252. external "C use <gtk/gtk.h>"
  253. end
  254. gtk_print_job_set_source_file (a_job, a_filename, an_error_handle: POINTER): INTEGER is
  255. -- gboolean gtk_print_job_set_source_file (GtkPrintJob *job, const
  256. -- gchar *filename, GError **error);
  257. external "C use <gtk/gtk.h>"
  258. end
  259. gtk_print_job_get_surface (a_job, an_error_handle: POINTER): POINTER is
  260. -- cairo_surface_t* gtk_print_job_get_surface (GtkPrintJob *job, GError
  261. -- **error);
  262. external "C use <gtk/gtk.h>"
  263. end
  264. gtk_print_job_send (a_job, a_callback, some_user_data, a_destroy_notify: POINTER) is
  265. -- void gtk_print_job_send (GtkPrintJob *job, GtkPrintJobCompleteFunc
  266. -- callback, gpointer user_data, GDestroyNotify dnotify);
  267. external "C use <gtk/gtk.h>"
  268. end
  269. gtk_print_job_set_track_print_status (a_job: POINTER; a_track_status: INTEGER) is
  270. -- void gtk_print_job_set_track_print_status (GtkPrintJob *job,
  271. -- gboolean track_status);
  272. external "C use <gtk/gtk.h>"
  273. end
  274. gtk_print_job_get_track_print_status (a_job: POINTER): INTEGER is
  275. -- gboolean gtk_print_job_get_track_print_status (GtkPrintJob *job);
  276. external "C use <gtk/gtk.h>"
  277. end
  278. feature -- size
  279. struct_size: INTEGER is
  280. external "C inline use <gtk/gtk.h>"
  281. alias "sizeof(GtkPrintJob)"
  282. end
  283. end -- class GTK_PRINT_JOB