PageRenderTime 33ms CodeModel.GetById 19ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 0ms

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