/src/wrappers/gtk/library/gtk_printer.e

http://github.com/tybor/Liberty · Specman e · 332 lines · 114 code · 34 blank · 184 comment · 2 complexity · 54205a1aa257a1d3eecbc8d3b9aa9d69 MD5 · raw file

  1. indexing
  2. description: "GtkPrinter represents a printer."
  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_PRINTER
  20. -- A GtkPrinter object represents a printer. You only need to deal
  21. -- directly with printers if you use the non-portable
  22. -- GtkPrintUnixDialog API.
  23. -- A GtkPrinter allows to get status information about the printer,
  24. -- such as its description, its location, the number of queued
  25. -- jobs, etc. Most importantly, a GtkPrinter object can be used to
  26. -- create a GtkPrintJob object, which lets you print to the
  27. -- printer.
  28. -- Printing support was added in GTK+ 2.10.
  29. inherit
  30. G_OBJECT rename is_default as is_void redefine is_equal end
  31. COMPARABLE
  32. rename
  33. is_default as is_void
  34. undefine
  35. copy, is_equal
  36. redefine
  37. is_equal,
  38. compare, three_way_comparison
  39. end
  40. insert
  41. GTK_PRINTER_EXTERNALS
  42. rename is_default as is_void end
  43. creation make, from_external_pointer
  44. feature {} -- Creation
  45. make (a_name: STRING; a_backend: GTK_PRINT_BACKEND; virtual: BOOLEAN) is
  46. -- Creates a new GtkPrinter with `a_name', connected to
  47. -- `a_backend'. `virtual' tells whether the printer is
  48. -- virtual.
  49. require
  50. name_not_void: a_name/=Void
  51. backend_not_void: a_backend /= Void
  52. do
  53. from_external_pointer (gtk_printer_new(a_name.to_external,
  54. a_backend.handle,
  55. virtual.to_integer))
  56. end
  57. feature -- Queries
  58. backend: GTK_PRINT_BACKEND is
  59. -- The backend of the printer.
  60. do
  61. create Result.from_external_pointer(gtk_printer_get_backend(handle))
  62. ensure not_void: Result/=Void
  63. end
  64. name: CONST_STRING is
  65. -- the name of the printer.
  66. do
  67. create Result.from_external(gtk_printer_get_name(handle))
  68. ensure not_void: Result/=Void
  69. end
  70. state_message: CONST_STRING is
  71. -- the state message of printer
  72. do
  73. create Result.from_external(gtk_printer_get_state_message(handle))
  74. ensure not_void: Result/=Void
  75. end
  76. description: CONST_STRING is
  77. -- the description of printer
  78. do
  79. create Result.from_external(gtk_printer_get_description(handle))
  80. ensure not_void: Result/=Void
  81. end
  82. location: CONST_STRING is
  83. -- The location of the printer.
  84. do
  85. create Result.from_external(gtk_printer_get_location(handle))
  86. end
  87. icon_name: CONST_STRING is
  88. -- the icon name for printer
  89. do
  90. create Result.from_external(gtk_printer_get_icon_name(handle))
  91. end
  92. job_count: INTEGER is
  93. -- the number of jobs currently queued on the printer.
  94. do
  95. Result:=gtk_printer_get_job_count(handle)
  96. end
  97. is_active: BOOLEAN is
  98. -- Is the printer currently active? A printer is active when
  99. -- it accepts new jobs.
  100. do
  101. Result:=gtk_printer_is_active(handle).to_boolean
  102. end
  103. is_virtual: BOOLEAN is
  104. -- Is the printer virtual? A virtual printer does not
  105. -- represent actual printer hardware, but something like a
  106. -- CUPS class.
  107. do
  108. Result:=gtk_printer_is_virtual(handle).to_boolean
  109. end
  110. is_default: BOOLEAN is
  111. -- Is the printer the default printer?
  112. do
  113. Result:=gtk_printer_is_default(handle).to_boolean
  114. end
  115. accepts_postscript: BOOLEAN is
  116. -- Does the printer accept input in PostScript format?
  117. do
  118. Result:=gtk_printer_accepts_ps(handle).to_boolean
  119. end
  120. accepts_pdf: BOOLEAN is
  121. -- Does the printer accept input in PDF format?
  122. do
  123. Result:=gtk_printer_accepts_pdf(handle).to_boolean
  124. end
  125. feature -- Comparability
  126. is_equal (other: like Current): BOOLEAN is
  127. do
  128. Result:=(compare(other)=0)
  129. end
  130. infix "<" (other: like Current): BOOLEAN is
  131. do
  132. Result:=(compare(other)<0)
  133. end
  134. compare, three_way_comparison (other: like Current): INTEGER is
  135. -- Compares two printers: 0 if the printer match, a
  136. -- negative value if Current < `other,' or a positive
  137. -- value if Current > `other'
  138. do
  139. Result:=gtk_printer_compare(handle, other.handle)
  140. end
  141. feature -- TODO unwrapped
  142. -- TODO: wrap gtk_enumerate_printers
  143. -- void gtk_enumerate_printers (GtkPrinterFunc func, gpointer data,
  144. -- GDestroyNotify destroy, gboolean wait);
  145. -- Calls a function for all GtkPrinters. If func returns TRUE, the
  146. -- enumeration is stopped.
  147. --
  148. -- func : a function to call for each printer
  149. -- data : user data to pass to func
  150. -- destroy : function to call if data is no longer needed
  151. -- wait : if TRUE, wait in a recursive mainloop until all printers are
  152. -- enumerated; otherwise return early
  153. --
  154. -- Since 2.10
  155. --
  156. -- GtkPrinterFunc ()
  157. --
  158. -- gboolean (*GtkPrinterFunc) (GtkPrinter *printer,
  159. -- gpointer data);
  160. --
  161. -- The type of function passed to gtk_enumerate_printers(). Note that you
  162. -- need to ref printer, if you want to keep a reference to it after the
  163. -- function has returned.
  164. --
  165. -- printer : a GtkPrinter
  166. -- data : user data passed to gtk_enumerate_printers()
  167. -- Returns : TRUE to stop the enumeration, FALSE to continue
  168. --
  169. -- --------------------------------------------------------------------------
  170. --
  171. feature -- TODO: Properties
  172. --
  173. --
  174. -- "accepts-pdf" gboolean : Read / Write / Construct Only
  175. -- "accepts-ps" gboolean : Read / Write / Construct Only
  176. -- "backend" GtkPrintBackend : Read / Write / Construct Only
  177. -- "icon-name" gchararray : Read
  178. -- "is-virtual" gboolean : Read / Write / Construct Only
  179. -- "job-count" gint : Read
  180. -- "location" gchararray : Read
  181. -- "name" gchararray : Read / Write / Construct Only
  182. -- "state-message" gchararray : Read
  183. --
  184. --Property Details
  185. --
  186. -- The "accepts-pdf" property
  187. --
  188. -- "accepts-pdf" gboolean : Read / Write / Construct Only
  189. --
  190. -- TRUE if this printer can accept PDF.
  191. --
  192. -- Default value: TRUE
  193. --
  194. -- --------------------------------------------------------------------------
  195. --
  196. -- The "accepts-ps" property
  197. --
  198. -- "accepts-ps" gboolean : Read / Write / Construct Only
  199. --
  200. -- TRUE if this printer can accept PostScript.
  201. --
  202. -- Default value: TRUE
  203. --
  204. -- --------------------------------------------------------------------------
  205. --
  206. -- The "backend" property
  207. --
  208. -- "backend" GtkPrintBackend : Read / Write / Construct Only
  209. --
  210. -- Backend for the printer.
  211. --
  212. -- --------------------------------------------------------------------------
  213. --
  214. -- The "icon-name" property
  215. --
  216. -- "icon-name" gchararray : Read
  217. --
  218. -- The icon name to use for the printer.
  219. --
  220. -- Default value: NULL
  221. --
  222. -- --------------------------------------------------------------------------
  223. --
  224. -- The "is-virtual" property
  225. --
  226. -- "is-virtual" gboolean : Read / Write / Construct Only
  227. --
  228. -- FALSE if this represents a real hardware printer.
  229. --
  230. -- Default value: FALSE
  231. --
  232. -- --------------------------------------------------------------------------
  233. --
  234. -- The "job-count" property
  235. --
  236. -- "job-count" gint : Read
  237. --
  238. -- Number of jobs queued in the printer.
  239. --
  240. -- Allowed values: >= 0
  241. --
  242. -- Default value: 0
  243. --
  244. -- --------------------------------------------------------------------------
  245. --
  246. -- The "location" property
  247. --
  248. -- "location" gchararray : Read
  249. --
  250. -- The location of the printer.
  251. --
  252. -- Default value: NULL
  253. --
  254. -- --------------------------------------------------------------------------
  255. --
  256. -- The "name" property
  257. --
  258. -- "name" gchararray : Read / Write / Construct Only
  259. --
  260. -- Name of the printer.
  261. --
  262. -- Default value: NULL
  263. --
  264. -- --------------------------------------------------------------------------
  265. --
  266. -- The "state-message" property
  267. --
  268. -- "state-message" gchararray : Read
  269. --
  270. -- String giving the current state of the printer.
  271. --
  272. -- Default value: NULL
  273. --
  274. feature -- TODO: Signals
  275. --
  276. --
  277. -- "details-acquired"
  278. -- void user_function (GtkPrinter *printer,
  279. -- gboolean success,
  280. -- gpointer user_data) : Run last
  281. --Signal Details
  282. --
  283. -- The "details-acquired" signal
  284. --
  285. -- void user_function (GtkPrinter *printer,
  286. -- gboolean success,
  287. -- gpointer user_data) : Run last
  288. --
  289. -- Gets emitted in response to a request for detailed information about a
  290. -- printer from the print backend. The success parameter indicates if the
  291. -- information was actually obtained.
  292. --
  293. -- printer : the GtkPrinter on which the signal is emitted
  294. -- success : TRUE if the details were successfully acquired
  295. -- user_data : user data set when the signal handler was connected.
  296. --
  297. -- Since 2.10
  298. end -- class GTK_PRINTER