PageRenderTime 19ms CodeModel.GetById 11ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

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