1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = gtk3-High-level-Printing-API.html
27  * outPack = gtk
28  * outFile = PrintOperation
29  * strct   = GtkPrintOperation
30  * realStrct=
31  * ctorStrct=
32  * clss    = PrintOperation
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * 	- PrintOperationPreviewIF
40  * prefixes:
41  * 	- gtk_print_operation_
42  * omit structs:
43  * omit prefixes:
44  * 	- gtk_print_operation_preview_
45  * omit code:
46  * omit signals:
47  * 	- got-page-size
48  * 	- ready
49  * imports:
50  * 	- glib.Str
51  * 	- glib.ErrorG
52  * 	- glib.GException
53  * 	- gtk.PageSetup
54  * 	- gtk.PrintContext
55  * 	- gtk.PrintSettings
56  * 	- gtk.Widget
57  * 	- gtk.Window
58  * 	- gtk.PrintOperationPreviewT
59  * 	- gtk.PrintOperationPreviewIF
60  * structWrap:
61  * 	- GtkPageSetup* -> PageSetup
62  * 	- GtkPrintContext* -> PrintContext
63  * 	- GtkPrintSettings* -> PrintSettings
64  * 	- GtkWidget* -> Widget
65  * 	- GtkWindow* -> Window
66  * module aliases:
67  * local aliases:
68  * overrides:
69  */
70 
71 module gtk.PrintOperation;
72 
73 public  import gtkc.gtktypes;
74 
75 private import gtkc.gtk;
76 private import glib.ConstructionException;
77 private import gobject.ObjectG;
78 
79 private import gobject.Signals;
80 public  import gtkc.gdktypes;
81 
82 private import glib.Str;
83 private import glib.ErrorG;
84 private import glib.GException;
85 private import gtk.PageSetup;
86 private import gtk.PrintContext;
87 private import gtk.PrintSettings;
88 private import gtk.Widget;
89 private import gtk.Window;
90 private import gtk.PrintOperationPreviewT;
91 private import gtk.PrintOperationPreviewIF;
92 
93 
94 
95 private import gobject.ObjectG;
96 
97 /**
98  * GtkPrintOperation is the high-level, portable printing API.
99  * It looks a bit different than other GTK+ dialogs such as the
100  * GtkFileChooser, since some platforms don't expose enough
101  * infrastructure to implement a good print dialog. On such
102  * platforms, GtkPrintOperation uses the native print dialog.
103  * On platforms which do not provide a native print dialog, GTK+
104  * uses its own, see GtkPrintUnixDialog.
105  *
106  * The typical way to use the high-level printing API is to create
107  * a GtkPrintOperation object with gtk_print_operation_new() when
108  * the user selects to print. Then you set some properties on it,
109  * e.g. the page size, any GtkPrintSettings from previous print
110  * operations, the number of pages, the current page, etc.
111  *
112  * Then you start the print operation by calling gtk_print_operation_run().
113  * It will then show a dialog, let the user select a printer and
114  * options. When the user finished the dialog various signals will
115  * be emitted on the GtkPrintOperation, the main one being
116  * "draw-page", which you are supposed to catch
117  * and render the page on the provided GtkPrintContext using Cairo.
118  *
119  * $(DDOC_COMMENT example)
120  *
121  * By default GtkPrintOperation uses an external application to do
122  * print preview. To implement a custom print preview, an application
123  * must connect to the preview signal. The functions
124  * gtk_print_operation_preview_render_page(),
125  * gtk_print_operation_preview_end_preview() and
126  * gtk_print_operation_preview_is_selected()
127  * are useful when implementing a print preview.
128  */
129 public class PrintOperation : ObjectG, PrintOperationPreviewIF
130 {
131 	
132 	/** the main Gtk struct */
133 	protected GtkPrintOperation* gtkPrintOperation;
134 	
135 	
136 	public GtkPrintOperation* getPrintOperationStruct()
137 	{
138 		return gtkPrintOperation;
139 	}
140 	
141 	
142 	/** the main Gtk struct as a void* */
143 	protected override void* getStruct()
144 	{
145 		return cast(void*)gtkPrintOperation;
146 	}
147 	
148 	/**
149 	 * Sets our main struct and passes it to the parent class
150 	 */
151 	public this (GtkPrintOperation* gtkPrintOperation)
152 	{
153 		super(cast(GObject*)gtkPrintOperation);
154 		this.gtkPrintOperation = gtkPrintOperation;
155 	}
156 	
157 	protected override void setStruct(GObject* obj)
158 	{
159 		super.setStruct(obj);
160 		gtkPrintOperation = cast(GtkPrintOperation*)obj;
161 	}
162 	
163 	// add the PrintOperationPreview capabilities
164 	mixin PrintOperationPreviewT!(GtkPrintOperation);
165 	
166 	/**
167 	 */
168 	int[string] connectedSignals;
169 	
170 	void delegate(PrintContext, PrintOperation)[] onBeginPrintListeners;
171 	/**
172 	 * Emitted after the user has finished changing print settings
173 	 * in the dialog, before the actual rendering starts.
174 	 * A typical use for ::begin-print is to use the parameters from the
175 	 * GtkPrintContext and paginate the document accordingly, and then
176 	 * set the number of pages with gtk_print_operation_set_n_pages().
177 	 * Since 2.10
178 	 */
179 	void addOnBeginPrint(void delegate(PrintContext, PrintOperation) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
180 	{
181 		if ( !("begin-print" in connectedSignals) )
182 		{
183 			Signals.connectData(
184 			getStruct(),
185 			"begin-print",
186 			cast(GCallback)&callBackBeginPrint,
187 			cast(void*)this,
188 			null,
189 			connectFlags);
190 			connectedSignals["begin-print"] = 1;
191 		}
192 		onBeginPrintListeners ~= dlg;
193 	}
194 	extern(C) static void callBackBeginPrint(GtkPrintOperation* operationStruct, GtkPrintContext* context, PrintOperation _printOperation)
195 	{
196 		foreach ( void delegate(PrintContext, PrintOperation) dlg ; _printOperation.onBeginPrintListeners )
197 		{
198 			dlg(ObjectG.getDObject!(PrintContext)(context), _printOperation);
199 		}
200 	}
201 	
202 	GObject* delegate(PrintOperation)[] onCreateCustomWidgetListeners;
203 	/**
204 	 * Emitted when displaying the print dialog. If you return a
205 	 * widget in a handler for this signal it will be added to a custom
206 	 * tab in the print dialog. You typically return a container widget
207 	 * with multiple widgets in it.
208 	 * The print dialog owns the returned widget, and its lifetime is not
209 	 * controlled by the application. However, the widget is guaranteed
210 	 * to stay around until the "custom-widget-apply"
211 	 * signal is emitted on the operation. Then you can read out any
212 	 * information you need from the widgets.
213 	 * Since 2.10
214 	 */
215 	void addOnCreateCustomWidget(GObject* delegate(PrintOperation) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
216 	{
217 		if ( !("create-custom-widget" in connectedSignals) )
218 		{
219 			Signals.connectData(
220 			getStruct(),
221 			"create-custom-widget",
222 			cast(GCallback)&callBackCreateCustomWidget,
223 			cast(void*)this,
224 			null,
225 			connectFlags);
226 			connectedSignals["create-custom-widget"] = 1;
227 		}
228 		onCreateCustomWidgetListeners ~= dlg;
229 	}
230 	extern(C) static void callBackCreateCustomWidget(GtkPrintOperation* operationStruct, PrintOperation _printOperation)
231 	{
232 		foreach ( GObject* delegate(PrintOperation) dlg ; _printOperation.onCreateCustomWidgetListeners )
233 		{
234 			dlg(_printOperation);
235 		}
236 	}
237 	
238 	void delegate(Widget, PrintOperation)[] onCustomWidgetApplyListeners;
239 	/**
240 	 * Emitted right before "begin-print" if you added
241 	 * a custom widget in the "create-custom-widget" handler.
242 	 * When you get this signal you should read the information from the
243 	 * custom widgets, as the widgets are not guaraneed to be around at a
244 	 * later time.
245 	 * Since 2.10
246 	 */
247 	void addOnCustomWidgetApply(void delegate(Widget, PrintOperation) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
248 	{
249 		if ( !("custom-widget-apply" in connectedSignals) )
250 		{
251 			Signals.connectData(
252 			getStruct(),
253 			"custom-widget-apply",
254 			cast(GCallback)&callBackCustomWidgetApply,
255 			cast(void*)this,
256 			null,
257 			connectFlags);
258 			connectedSignals["custom-widget-apply"] = 1;
259 		}
260 		onCustomWidgetApplyListeners ~= dlg;
261 	}
262 	extern(C) static void callBackCustomWidgetApply(GtkPrintOperation* operationStruct, GtkWidget* widget, PrintOperation _printOperation)
263 	{
264 		foreach ( void delegate(Widget, PrintOperation) dlg ; _printOperation.onCustomWidgetApplyListeners )
265 		{
266 			dlg(ObjectG.getDObject!(Widget)(widget), _printOperation);
267 		}
268 	}
269 	
270 	void delegate(GtkPrintOperationResult, PrintOperation)[] onDoneListeners;
271 	/**
272 	 * Emitted when the print operation run has finished doing
273 	 * everything required for printing.
274 	 * result gives you information about what happened during the run.
275 	 * If result is GTK_PRINT_OPERATION_RESULT_ERROR then you can call
276 	 * gtk_print_operation_get_error() for more information.
277 	 * If you enabled print status tracking then
278 	 * gtk_print_operation_is_finished() may still return FALSE
279 	 * after "done" was emitted.
280 	 * Since 2.10
281 	 */
282 	void addOnDone(void delegate(GtkPrintOperationResult, PrintOperation) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
283 	{
284 		if ( !("done" in connectedSignals) )
285 		{
286 			Signals.connectData(
287 			getStruct(),
288 			"done",
289 			cast(GCallback)&callBackDone,
290 			cast(void*)this,
291 			null,
292 			connectFlags);
293 			connectedSignals["done"] = 1;
294 		}
295 		onDoneListeners ~= dlg;
296 	}
297 	extern(C) static void callBackDone(GtkPrintOperation* operationStruct, GtkPrintOperationResult result, PrintOperation _printOperation)
298 	{
299 		foreach ( void delegate(GtkPrintOperationResult, PrintOperation) dlg ; _printOperation.onDoneListeners )
300 		{
301 			dlg(result, _printOperation);
302 		}
303 	}
304 	
305 	void delegate(PrintContext, gint, PrintOperation)[] onDrawPageListeners;
306 	/**
307 	 * Emitted for every page that is printed. The signal handler
308 	 * must render the page_nr's page onto the cairo context obtained
309 	 * from context using gtk_print_context_get_cairo_context().
310 	 * $(DDOC_COMMENT example)
311 	 * Use gtk_print_operation_set_use_full_page() and
312 	 * gtk_print_operation_set_unit() before starting the print operation
313 	 * to set up the transformation of the cairo context according to your
314 	 * needs.
315 	 * Since 2.10
316 	 */
317 	void addOnDrawPage(void delegate(PrintContext, gint, PrintOperation) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
318 	{
319 		if ( !("draw-page" in connectedSignals) )
320 		{
321 			Signals.connectData(
322 			getStruct(),
323 			"draw-page",
324 			cast(GCallback)&callBackDrawPage,
325 			cast(void*)this,
326 			null,
327 			connectFlags);
328 			connectedSignals["draw-page"] = 1;
329 		}
330 		onDrawPageListeners ~= dlg;
331 	}
332 	extern(C) static void callBackDrawPage(GtkPrintOperation* operationStruct, GtkPrintContext* context, gint pageNr, PrintOperation _printOperation)
333 	{
334 		foreach ( void delegate(PrintContext, gint, PrintOperation) dlg ; _printOperation.onDrawPageListeners )
335 		{
336 			dlg(ObjectG.getDObject!(PrintContext)(context), pageNr, _printOperation);
337 		}
338 	}
339 	
340 	void delegate(PrintContext, PrintOperation)[] onEndPrintListeners;
341 	/**
342 	 * Emitted after all pages have been rendered.
343 	 * A handler for this signal can clean up any resources that have
344 	 * been allocated in the "begin-print" handler.
345 	 * Since 2.10
346 	 */
347 	void addOnEndPrint(void delegate(PrintContext, PrintOperation) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
348 	{
349 		if ( !("end-print" in connectedSignals) )
350 		{
351 			Signals.connectData(
352 			getStruct(),
353 			"end-print",
354 			cast(GCallback)&callBackEndPrint,
355 			cast(void*)this,
356 			null,
357 			connectFlags);
358 			connectedSignals["end-print"] = 1;
359 		}
360 		onEndPrintListeners ~= dlg;
361 	}
362 	extern(C) static void callBackEndPrint(GtkPrintOperation* operationStruct, GtkPrintContext* context, PrintOperation _printOperation)
363 	{
364 		foreach ( void delegate(PrintContext, PrintOperation) dlg ; _printOperation.onEndPrintListeners )
365 		{
366 			dlg(ObjectG.getDObject!(PrintContext)(context), _printOperation);
367 		}
368 	}
369 	
370 	bool delegate(PrintContext, PrintOperation)[] onPaginateListeners;
371 	/**
372 	 * Emitted after the "begin-print" signal, but before
373 	 * the actual rendering starts. It keeps getting emitted until a connected
374 	 * signal handler returns TRUE.
375 	 * The ::paginate signal is intended to be used for paginating a document
376 	 * in small chunks, to avoid blocking the user interface for a long
377 	 * time. The signal handler should update the number of pages using
378 	 * gtk_print_operation_set_n_pages(), and return TRUE if the document
379 	 * has been completely paginated.
380 	 * If you don't need to do pagination in chunks, you can simply do
381 	 * it all in the ::begin-print handler, and set the number of pages
382 	 * from there.
383 	 * TRUE if pagination is complete
384 	 * Since 2.10
385 	 */
386 	void addOnPaginate(bool delegate(PrintContext, PrintOperation) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
387 	{
388 		if ( !("paginate" in connectedSignals) )
389 		{
390 			Signals.connectData(
391 			getStruct(),
392 			"paginate",
393 			cast(GCallback)&callBackPaginate,
394 			cast(void*)this,
395 			null,
396 			connectFlags);
397 			connectedSignals["paginate"] = 1;
398 		}
399 		onPaginateListeners ~= dlg;
400 	}
401 	extern(C) static gboolean callBackPaginate(GtkPrintOperation* operationStruct, GtkPrintContext* context, PrintOperation _printOperation)
402 	{
403 		foreach ( bool delegate(PrintContext, PrintOperation) dlg ; _printOperation.onPaginateListeners )
404 		{
405 			if ( dlg(ObjectG.getDObject!(PrintContext)(context), _printOperation) )
406 			{
407 				return 1;
408 			}
409 		}
410 		
411 		return 0;
412 	}
413 	
414 	bool delegate(GtkPrintOperationPreview*, PrintContext, Window, PrintOperation)[] onPreviewListeners;
415 	/**
416 	 * Gets emitted when a preview is requested from the native dialog.
417 	 * The default handler for this signal uses an external viewer
418 	 * application to preview.
419 	 * To implement a custom print preview, an application must return
420 	 * TRUE from its handler for this signal. In order to use the
421 	 * provided context for the preview implementation, it must be
422 	 * given a suitable cairo context with gtk_print_context_set_cairo_context().
423 	 * The custom preview implementation can use
424 	 * gtk_print_operation_preview_is_selected() and
425 	 * gtk_print_operation_preview_render_page() to find pages which
426 	 * are selected for print and render them. The preview must be
427 	 * finished by calling gtk_print_operation_preview_end_preview()
428 	 * (typically in response to the user clicking a close button).
429 	 * TRUE if the listener wants to take over control of the preview
430 	 * Since 2.10
431 	 */
432 	void addOnPreview(bool delegate(GtkPrintOperationPreview*, PrintContext, Window, PrintOperation) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
433 	{
434 		if ( !("preview" in connectedSignals) )
435 		{
436 			Signals.connectData(
437 			getStruct(),
438 			"preview",
439 			cast(GCallback)&callBackPreview,
440 			cast(void*)this,
441 			null,
442 			connectFlags);
443 			connectedSignals["preview"] = 1;
444 		}
445 		onPreviewListeners ~= dlg;
446 	}
447 	extern(C) static gboolean callBackPreview(GtkPrintOperation* operationStruct, GtkPrintOperationPreview* preview, GtkPrintContext* context, GtkWindow* parent, PrintOperation _printOperation)
448 	{
449 		foreach ( bool delegate(GtkPrintOperationPreview*, PrintContext, Window, PrintOperation) dlg ; _printOperation.onPreviewListeners )
450 		{
451 			if ( dlg(preview, ObjectG.getDObject!(PrintContext)(context), ObjectG.getDObject!(Window)(parent), _printOperation) )
452 			{
453 				return 1;
454 			}
455 		}
456 		
457 		return 0;
458 	}
459 	
460 	void delegate(PrintContext, gint, PageSetup, PrintOperation)[] onRequestPageSetupListeners;
461 	/**
462 	 * Emitted once for every page that is printed, to give
463 	 * the application a chance to modify the page setup. Any changes
464 	 * done to setup will be in force only for printing this page.
465 	 * Since 2.10
466 	 */
467 	void addOnRequestPageSetup(void delegate(PrintContext, gint, PageSetup, PrintOperation) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
468 	{
469 		if ( !("request-page-setup" in connectedSignals) )
470 		{
471 			Signals.connectData(
472 			getStruct(),
473 			"request-page-setup",
474 			cast(GCallback)&callBackRequestPageSetup,
475 			cast(void*)this,
476 			null,
477 			connectFlags);
478 			connectedSignals["request-page-setup"] = 1;
479 		}
480 		onRequestPageSetupListeners ~= dlg;
481 	}
482 	extern(C) static void callBackRequestPageSetup(GtkPrintOperation* operationStruct, GtkPrintContext* context, gint pageNr, GtkPageSetup* setup, PrintOperation _printOperation)
483 	{
484 		foreach ( void delegate(PrintContext, gint, PageSetup, PrintOperation) dlg ; _printOperation.onRequestPageSetupListeners )
485 		{
486 			dlg(ObjectG.getDObject!(PrintContext)(context), pageNr, ObjectG.getDObject!(PageSetup)(setup), _printOperation);
487 		}
488 	}
489 	
490 	void delegate(PrintOperation)[] onStatusChangedListeners;
491 	/**
492 	 * Emitted at between the various phases of the print operation.
493 	 * See GtkPrintStatus for the phases that are being discriminated.
494 	 * Use gtk_print_operation_get_status() to find out the current
495 	 * status.
496 	 * Since 2.10
497 	 */
498 	void addOnStatusChanged(void delegate(PrintOperation) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
499 	{
500 		if ( !("status-changed" in connectedSignals) )
501 		{
502 			Signals.connectData(
503 			getStruct(),
504 			"status-changed",
505 			cast(GCallback)&callBackStatusChanged,
506 			cast(void*)this,
507 			null,
508 			connectFlags);
509 			connectedSignals["status-changed"] = 1;
510 		}
511 		onStatusChangedListeners ~= dlg;
512 	}
513 	extern(C) static void callBackStatusChanged(GtkPrintOperation* operationStruct, PrintOperation _printOperation)
514 	{
515 		foreach ( void delegate(PrintOperation) dlg ; _printOperation.onStatusChangedListeners )
516 		{
517 			dlg(_printOperation);
518 		}
519 	}
520 	
521 	void delegate(Widget, PageSetup, PrintSettings, PrintOperation)[] onUpdateCustomWidgetListeners;
522 	/**
523 	 * Emitted after change of selected printer. The actual page setup and
524 	 * print settings are passed to the custom widget, which can actualize
525 	 * itself according to this change.
526 	 * Since 2.18
527 	 */
528 	void addOnUpdateCustomWidget(void delegate(Widget, PageSetup, PrintSettings, PrintOperation) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
529 	{
530 		if ( !("update-custom-widget" in connectedSignals) )
531 		{
532 			Signals.connectData(
533 			getStruct(),
534 			"update-custom-widget",
535 			cast(GCallback)&callBackUpdateCustomWidget,
536 			cast(void*)this,
537 			null,
538 			connectFlags);
539 			connectedSignals["update-custom-widget"] = 1;
540 		}
541 		onUpdateCustomWidgetListeners ~= dlg;
542 	}
543 	extern(C) static void callBackUpdateCustomWidget(GtkPrintOperation* operationStruct, GtkWidget* widget, GtkPageSetup* setup, GtkPrintSettings* settings, PrintOperation _printOperation)
544 	{
545 		foreach ( void delegate(Widget, PageSetup, PrintSettings, PrintOperation) dlg ; _printOperation.onUpdateCustomWidgetListeners )
546 		{
547 			dlg(ObjectG.getDObject!(Widget)(widget), ObjectG.getDObject!(PageSetup)(setup), ObjectG.getDObject!(PrintSettings)(settings), _printOperation);
548 		}
549 	}
550 	
551 	
552 	/**
553 	 * Creates a new GtkPrintOperation.
554 	 * Since 2.10
555 	 * Throws: ConstructionException GTK+ fails to create the object.
556 	 */
557 	public this ()
558 	{
559 		// GtkPrintOperation * gtk_print_operation_new (void);
560 		auto p = gtk_print_operation_new();
561 		if(p is null)
562 		{
563 			throw new ConstructionException("null returned by gtk_print_operation_new()");
564 		}
565 		this(cast(GtkPrintOperation*) p);
566 	}
567 	
568 	/**
569 	 * Sets whether the gtk_print_operation_run() may return
570 	 * before the print operation is completed. Note that
571 	 * some platforms may not allow asynchronous operation.
572 	 * Since 2.10
573 	 * Params:
574 	 * allowAsync = TRUE to allow asynchronous operation
575 	 */
576 	public void setAllowAsync(int allowAsync)
577 	{
578 		// void gtk_print_operation_set_allow_async (GtkPrintOperation *op,  gboolean allow_async);
579 		gtk_print_operation_set_allow_async(gtkPrintOperation, allowAsync);
580 	}
581 	
582 	/**
583 	 * Call this when the result of a print operation is
584 	 * GTK_PRINT_OPERATION_RESULT_ERROR, either as returned by
585 	 * gtk_print_operation_run(), or in the "done" signal
586 	 * handler. The returned GError will contain more details on what went wrong.
587 	 * Since 2.10
588 	 */
589 	public void getError()
590 	{
591 		// void gtk_print_operation_get_error (GtkPrintOperation *op,  GError **error);
592 		GError* err = null;
593 		
594 		gtk_print_operation_get_error(gtkPrintOperation, &err);
595 		
596 		if (err !is null)
597 		{
598 			throw new GException( new ErrorG(err) );
599 		}
600 		
601 	}
602 	
603 	/**
604 	 * Makes default_page_setup the default page setup for op.
605 	 * This page setup will be used by gtk_print_operation_run(),
606 	 * but it can be overridden on a per-page basis by connecting
607 	 * to the "request-page-setup" signal.
608 	 * Since 2.10
609 	 * Params:
610 	 * defaultPageSetup = a GtkPageSetup, or NULL. [allow-none]
611 	 */
612 	public void setDefaultPageSetup(PageSetup defaultPageSetup)
613 	{
614 		// void gtk_print_operation_set_default_page_setup  (GtkPrintOperation *op,  GtkPageSetup *default_page_setup);
615 		gtk_print_operation_set_default_page_setup(gtkPrintOperation, (defaultPageSetup is null) ? null : defaultPageSetup.getPageSetupStruct());
616 	}
617 	
618 	/**
619 	 * Returns the default page setup, see
620 	 * gtk_print_operation_set_default_page_setup().
621 	 * Since 2.10
622 	 * Returns: the default page setup. [transfer none]
623 	 */
624 	public PageSetup getDefaultPageSetup()
625 	{
626 		// GtkPageSetup * gtk_print_operation_get_default_page_setup  (GtkPrintOperation *op);
627 		auto p = gtk_print_operation_get_default_page_setup(gtkPrintOperation);
628 		
629 		if(p is null)
630 		{
631 			return null;
632 		}
633 		
634 		return ObjectG.getDObject!(PageSetup)(cast(GtkPageSetup*) p);
635 	}
636 	
637 	/**
638 	 * Sets the print settings for op. This is typically used to
639 	 * re-establish print settings from a previous print operation,
640 	 * see gtk_print_operation_run().
641 	 * Since 2.10
642 	 * Params:
643 	 * printSettings = GtkPrintSettings. [allow-none]
644 	 */
645 	public void setPrintSettings(PrintSettings printSettings)
646 	{
647 		// void gtk_print_operation_set_print_settings  (GtkPrintOperation *op,  GtkPrintSettings *print_settings);
648 		gtk_print_operation_set_print_settings(gtkPrintOperation, (printSettings is null) ? null : printSettings.getPrintSettingsStruct());
649 	}
650 	
651 	/**
652 	 * Returns the current print settings.
653 	 * Note that the return value is NULL until either
654 	 * gtk_print_operation_set_print_settings() or
655 	 * gtk_print_operation_run() have been called.
656 	 * Since 2.10
657 	 * Returns: the current print settings of op. [transfer none]
658 	 */
659 	public PrintSettings getPrintSettings()
660 	{
661 		// GtkPrintSettings * gtk_print_operation_get_print_settings  (GtkPrintOperation *op);
662 		auto p = gtk_print_operation_get_print_settings(gtkPrintOperation);
663 		
664 		if(p is null)
665 		{
666 			return null;
667 		}
668 		
669 		return ObjectG.getDObject!(PrintSettings)(cast(GtkPrintSettings*) p);
670 	}
671 	
672 	/**
673 	 * Sets the name of the print job. The name is used to identify
674 	 * the job (e.g. in monitoring applications like eggcups).
675 	 * If you don't set a job name, GTK+ picks a default one by
676 	 * numbering successive print jobs.
677 	 * Since 2.10
678 	 * Params:
679 	 * jobName = a string that identifies the print job
680 	 */
681 	public void setJobName(string jobName)
682 	{
683 		// void gtk_print_operation_set_job_name (GtkPrintOperation *op,  const gchar *job_name);
684 		gtk_print_operation_set_job_name(gtkPrintOperation, Str.toStringz(jobName));
685 	}
686 	
687 	/**
688 	 * Sets the number of pages in the document.
689 	 * This must be set to a positive number
690 	 * before the rendering starts. It may be set in a
691 	 * "begin-print" signal hander.
692 	 * Note that the page numbers passed to the
693 	 * "request-page-setup"
694 	 * and "draw-page" signals are 0-based, i.e. if
695 	 * the user chooses to print all pages, the last ::draw-page signal
696 	 * will be for page n_pages - 1.
697 	 * Since 2.10
698 	 * Params:
699 	 * nPages = the number of pages
700 	 */
701 	public void setNPages(int nPages)
702 	{
703 		// void gtk_print_operation_set_n_pages (GtkPrintOperation *op,  gint n_pages);
704 		gtk_print_operation_set_n_pages(gtkPrintOperation, nPages);
705 	}
706 	
707 	/**
708 	 * Returns the number of pages that will be printed.
709 	 * Note that this value is set during print preparation phase
710 	 * (GTK_PRINT_STATUS_PREPARING), so this function should never be
711 	 * called before the data generation phase (GTK_PRINT_STATUS_GENERATING_DATA).
712 	 * You can connect to the "status-changed" signal
713 	 * and call gtk_print_operation_get_n_pages_to_print() when
714 	 * print status is GTK_PRINT_STATUS_GENERATING_DATA.
715 	 * This is typically used to track the progress of print operation.
716 	 * Since 2.18
717 	 * Returns: the number of pages that will be printed
718 	 */
719 	public int getNPagesToPrint()
720 	{
721 		// gint gtk_print_operation_get_n_pages_to_print  (GtkPrintOperation *op);
722 		return gtk_print_operation_get_n_pages_to_print(gtkPrintOperation);
723 	}
724 	
725 	/**
726 	 * Sets the current page.
727 	 * If this is called before gtk_print_operation_run(),
728 	 * the user will be able to select to print only the current page.
729 	 * Note that this only makes sense for pre-paginated documents.
730 	 * Since 2.10
731 	 * Params:
732 	 * currentPage = the current page, 0-based
733 	 */
734 	public void setCurrentPage(int currentPage)
735 	{
736 		// void gtk_print_operation_set_current_page  (GtkPrintOperation *op,  gint current_page);
737 		gtk_print_operation_set_current_page(gtkPrintOperation, currentPage);
738 	}
739 	
740 	/**
741 	 * If full_page is TRUE, the transformation for the cairo context
742 	 * obtained from GtkPrintContext puts the origin at the top left
743 	 * corner of the page (which may not be the top left corner of the
744 	 * sheet, depending on page orientation and the number of pages per
745 	 * sheet). Otherwise, the origin is at the top left corner of the
746 	 * imageable area (i.e. inside the margins).
747 	 * Since 2.10
748 	 * Params:
749 	 * fullPage = TRUE to set up the GtkPrintContext for the full page
750 	 */
751 	public void setUseFullPage(int fullPage)
752 	{
753 		// void gtk_print_operation_set_use_full_page  (GtkPrintOperation *op,  gboolean full_page);
754 		gtk_print_operation_set_use_full_page(gtkPrintOperation, fullPage);
755 	}
756 	
757 	/**
758 	 * Sets up the transformation for the cairo context obtained from
759 	 * GtkPrintContext in such a way that distances are measured in
760 	 * units of unit.
761 	 * Since 2.10
762 	 * Params:
763 	 * unit = the unit to use
764 	 */
765 	public void setUnit(GtkUnit unit)
766 	{
767 		// void gtk_print_operation_set_unit (GtkPrintOperation *op,  GtkUnit unit);
768 		gtk_print_operation_set_unit(gtkPrintOperation, unit);
769 	}
770 	
771 	/**
772 	 * Sets up the GtkPrintOperation to generate a file instead
773 	 * of showing the print dialog. The indended use of this function
774 	 * is for implementing "Export to PDF" actions. Currently, PDF
775 	 * is the only supported format.
776 	 * "Print to PDF" support is independent of this and is done
777 	 * by letting the user pick the "Print to PDF" item from the list
778 	 * of printers in the print dialog.
779 	 * Since 2.10
780 	 * Params:
781 	 * filename = the filename for the exported file. [type filename]
782 	 */
783 	public void setExportFilename(string filename)
784 	{
785 		// void gtk_print_operation_set_export_filename  (GtkPrintOperation *op,  const gchar *filename);
786 		gtk_print_operation_set_export_filename(gtkPrintOperation, Str.toStringz(filename));
787 	}
788 	
789 	/**
790 	 * If show_progress is TRUE, the print operation will show a
791 	 * progress dialog during the print operation.
792 	 * Since 2.10
793 	 * Params:
794 	 * showProgress = TRUE to show a progress dialog
795 	 */
796 	public void setShowProgress(int showProgress)
797 	{
798 		// void gtk_print_operation_set_show_progress  (GtkPrintOperation *op,  gboolean show_progress);
799 		gtk_print_operation_set_show_progress(gtkPrintOperation, showProgress);
800 	}
801 	
802 	/**
803 	 * If track_status is TRUE, the print operation will try to continue report
804 	 * on the status of the print job in the printer queues and printer. This
805 	 * can allow your application to show things like "out of paper" issues,
806 	 * and when the print job actually reaches the printer.
807 	 * This function is often implemented using some form of polling, so it should
808 	 * not be enabled unless needed.
809 	 * Since 2.10
810 	 * Params:
811 	 * trackStatus = TRUE to track status after printing
812 	 */
813 	public void setTrackPrintStatus(int trackStatus)
814 	{
815 		// void gtk_print_operation_set_track_print_status  (GtkPrintOperation *op,  gboolean track_status);
816 		gtk_print_operation_set_track_print_status(gtkPrintOperation, trackStatus);
817 	}
818 	
819 	/**
820 	 * Sets the label for the tab holding custom widgets.
821 	 * Since 2.10
822 	 * Params:
823 	 * label = the label to use, or NULL to use the default label. [allow-none]
824 	 */
825 	public void setCustomTabLabel(string label)
826 	{
827 		// void gtk_print_operation_set_custom_tab_label  (GtkPrintOperation *op,  const gchar *label);
828 		gtk_print_operation_set_custom_tab_label(gtkPrintOperation, Str.toStringz(label));
829 	}
830 	
831 	/**
832 	 * Runs the print operation, by first letting the user modify
833 	 * print settings in the print dialog, and then print the document.
834 	 * Normally that this function does not return until the rendering of all
835 	 * pages is complete. You can connect to the
836 	 * "status-changed" signal on op to obtain some
837 	 * information about the progress of the print operation.
838 	 * Furthermore, it may use a recursive mainloop to show the print dialog.
839 	 * If you call gtk_print_operation_set_allow_async() or set the
840 	 * "allow-async" property the operation will run
841 	 * asynchronously if this is supported on the platform. The
842 	 * "done" signal will be emitted with the result of the
843 	 * operation when the it is done (i.e. when the dialog is canceled, or when
844 	 * the print succeeds or fails).
845 	 * $(DDOC_COMMENT example)
846 	 * Note that gtk_print_operation_run() can only be called once on a
847 	 * given GtkPrintOperation.
848 	 * Since 2.10
849 	 * Params:
850 	 * action = the action to start
851 	 * parent = Transient parent of the dialog. [allow-none]
852 	 * Returns: the result of the print operation. A return value of GTK_PRINT_OPERATION_RESULT_APPLY indicates that the printing was completed successfully. In this case, it is a good idea to obtain the used print settings with gtk_print_operation_get_print_settings() and store them for reuse with the next print operation. A value of GTK_PRINT_OPERATION_RESULT_IN_PROGRESS means the operation is running asynchronously, and will emit the "done" signal when done.
853 	 * Throws: GException on failure.
854 	 */
855 	public GtkPrintOperationResult run(GtkPrintOperationAction action, Window parent)
856 	{
857 		// GtkPrintOperationResult gtk_print_operation_run (GtkPrintOperation *op,  GtkPrintOperationAction action,  GtkWindow *parent,  GError **error);
858 		GError* err = null;
859 		
860 		auto p = gtk_print_operation_run(gtkPrintOperation, action, (parent is null) ? null : parent.getWindowStruct(), &err);
861 		
862 		if (err !is null)
863 		{
864 			throw new GException( new ErrorG(err) );
865 		}
866 		
867 		return p;
868 	}
869 	
870 	/**
871 	 * Cancels a running print operation. This function may
872 	 * be called from a "begin-print",
873 	 * "paginate" or "draw-page"
874 	 * signal handler to stop the currently running print
875 	 * operation.
876 	 * Since 2.10
877 	 */
878 	public void cancel()
879 	{
880 		// void gtk_print_operation_cancel (GtkPrintOperation *op);
881 		gtk_print_operation_cancel(gtkPrintOperation);
882 	}
883 	
884 	/**
885 	 * Signalize that drawing of particular page is complete.
886 	 * It is called after completion of page drawing (e.g. drawing in another
887 	 * thread).
888 	 * If gtk_print_operation_set_defer_drawing() was called before, then this function
889 	 * has to be called by application. In another case it is called by the library
890 	 * itself.
891 	 * Since 2.16
892 	 */
893 	public void drawPageFinish()
894 	{
895 		// void gtk_print_operation_draw_page_finish  (GtkPrintOperation *op);
896 		gtk_print_operation_draw_page_finish(gtkPrintOperation);
897 	}
898 	
899 	/**
900 	 * Sets up the GtkPrintOperation to wait for calling of
901 	 * gtk_print_operation_draw_page_finish() from application. It can
902 	 * be used for drawing page in another thread.
903 	 * This function must be called in the callback of "draw-page" signal.
904 	 * Since 2.16
905 	 */
906 	public void setDeferDrawing()
907 	{
908 		// void gtk_print_operation_set_defer_drawing  (GtkPrintOperation *op);
909 		gtk_print_operation_set_defer_drawing(gtkPrintOperation);
910 	}
911 	
912 	/**
913 	 * Returns the status of the print operation.
914 	 * Also see gtk_print_operation_get_status_string().
915 	 * Since 2.10
916 	 * Returns: the status of the print operation
917 	 */
918 	public GtkPrintStatus getStatus()
919 	{
920 		// GtkPrintStatus gtk_print_operation_get_status (GtkPrintOperation *op);
921 		return gtk_print_operation_get_status(gtkPrintOperation);
922 	}
923 	
924 	/**
925 	 * Returns a string representation of the status of the
926 	 * print operation. The string is translated and suitable
927 	 * for displaying the print status e.g. in a GtkStatusbar.
928 	 * Use gtk_print_operation_get_status() to obtain a status
929 	 * value that is suitable for programmatic use.
930 	 * Since 2.10
931 	 * Returns: a string representation of the status of the print operation
932 	 */
933 	public string getStatusString()
934 	{
935 		// const gchar * gtk_print_operation_get_status_string  (GtkPrintOperation *op);
936 		return Str.toString(gtk_print_operation_get_status_string(gtkPrintOperation));
937 	}
938 	
939 	/**
940 	 * A convenience function to find out if the print operation
941 	 * is finished, either successfully (GTK_PRINT_STATUS_FINISHED)
942 	 * or unsuccessfully (GTK_PRINT_STATUS_FINISHED_ABORTED).
943 	 * Note: when you enable print status tracking the print operation
944 	 * can be in a non-finished state even after done has been called, as
945 	 * the operation status then tracks the print job status on the printer.
946 	 * Since 2.10
947 	 * Returns: TRUE, if the print operation is finished.
948 	 */
949 	public int isFinished()
950 	{
951 		// gboolean gtk_print_operation_is_finished (GtkPrintOperation *op);
952 		return gtk_print_operation_is_finished(gtkPrintOperation);
953 	}
954 	
955 	/**
956 	 * Sets whether selection is supported by GtkPrintOperation.
957 	 * Since 2.18
958 	 * Params:
959 	 * supportSelection = TRUE to support selection
960 	 */
961 	public void setSupportSelection(int supportSelection)
962 	{
963 		// void gtk_print_operation_set_support_selection  (GtkPrintOperation *op,  gboolean support_selection);
964 		gtk_print_operation_set_support_selection(gtkPrintOperation, supportSelection);
965 	}
966 	
967 	/**
968 	 * Gets the value of "support-selection" property.
969 	 * Since 2.18
970 	 * Returns: whether the application supports print of selection
971 	 */
972 	public int getSupportSelection()
973 	{
974 		// gboolean gtk_print_operation_get_support_selection  (GtkPrintOperation *op);
975 		return gtk_print_operation_get_support_selection(gtkPrintOperation);
976 	}
977 	
978 	/**
979 	 * Sets whether there is a selection to print.
980 	 * Application has to set number of pages to which the selection
981 	 * will draw by gtk_print_operation_set_n_pages() in a callback of
982 	 * "begin-print".
983 	 * Since 2.18
984 	 * Params:
985 	 * hasSelection = TRUE indicates that a selection exists
986 	 */
987 	public void setHasSelection(int hasSelection)
988 	{
989 		// void gtk_print_operation_set_has_selection  (GtkPrintOperation *op,  gboolean has_selection);
990 		gtk_print_operation_set_has_selection(gtkPrintOperation, hasSelection);
991 	}
992 	
993 	/**
994 	 * Gets the value of "has-selection" property.
995 	 * Since 2.18
996 	 * Returns: whether there is a selection
997 	 */
998 	public int getHasSelection()
999 	{
1000 		// gboolean gtk_print_operation_get_has_selection  (GtkPrintOperation *op);
1001 		return gtk_print_operation_get_has_selection(gtkPrintOperation);
1002 	}
1003 	
1004 	/**
1005 	 * Embed page size combo box and orientation combo box into page setup page.
1006 	 * Selected page setup is stored as default page setup in GtkPrintOperation.
1007 	 * Since 2.18
1008 	 * Params:
1009 	 * embed = TRUE to embed page setup selection in the GtkPrintUnixDialog
1010 	 */
1011 	public void setEmbedPageSetup(int embed)
1012 	{
1013 		// void gtk_print_operation_set_embed_page_setup  (GtkPrintOperation *op,  gboolean embed);
1014 		gtk_print_operation_set_embed_page_setup(gtkPrintOperation, embed);
1015 	}
1016 	
1017 	/**
1018 	 * Gets the value of "embed-page-setup" property.
1019 	 * Since 2.18
1020 	 * Returns: whether page setup selection combos are embedded
1021 	 */
1022 	public int getEmbedPageSetup()
1023 	{
1024 		// gboolean gtk_print_operation_get_embed_page_setup  (GtkPrintOperation *op);
1025 		return gtk_print_operation_get_embed_page_setup(gtkPrintOperation);
1026 	}
1027 	
1028 	/**
1029 	 * Runs a page setup dialog, letting the user modify the values from
1030 	 * page_setup. If the user cancels the dialog, the returned GtkPageSetup
1031 	 * is identical to the passed in page_setup, otherwise it contains the
1032 	 * modifications done in the dialog.
1033 	 * Note that this function may use a recursive mainloop to show the page
1034 	 * setup dialog. See gtk_print_run_page_setup_dialog_async() if this is
1035 	 * a problem.
1036 	 * Since 2.10
1037 	 * Params:
1038 	 * parent = transient parent. [allow-none]
1039 	 * pageSetup = an existing GtkPageSetup. [allow-none]
1040 	 * settings = a GtkPrintSettings
1041 	 * Returns: a new GtkPageSetup. [transfer full]
1042 	 */
1043 	public static PageSetup gtkPrintRunPageSetupDialog(Window parent, PageSetup pageSetup, PrintSettings settings)
1044 	{
1045 		// GtkPageSetup * gtk_print_run_page_setup_dialog (GtkWindow *parent,  GtkPageSetup *page_setup,  GtkPrintSettings *settings);
1046 		auto p = gtk_print_run_page_setup_dialog((parent is null) ? null : parent.getWindowStruct(), (pageSetup is null) ? null : pageSetup.getPageSetupStruct(), (settings is null) ? null : settings.getPrintSettingsStruct());
1047 		
1048 		if(p is null)
1049 		{
1050 			return null;
1051 		}
1052 		
1053 		return ObjectG.getDObject!(PageSetup)(cast(GtkPageSetup*) p);
1054 	}
1055 	
1056 	/**
1057 	 * Runs a page setup dialog, letting the user modify the values from page_setup.
1058 	 * In contrast to gtk_print_run_page_setup_dialog(), this function returns after
1059 	 * showing the page setup dialog on platforms that support this, and calls done_cb
1060 	 * from a signal handler for the ::response signal of the dialog.
1061 	 * Since 2.10
1062 	 * Params:
1063 	 * parent = transient parent, or NULL. [allow-none]
1064 	 * pageSetup = an existing GtkPageSetup, or NULL. [allow-none]
1065 	 * settings = a GtkPrintSettings
1066 	 * doneCb = a function to call when the user saves
1067 	 * the modified page setup. [scope async]
1068 	 * data = user data to pass to done_cb
1069 	 */
1070 	public static void gtkPrintRunPageSetupDialogAsync(Window parent, PageSetup pageSetup, PrintSettings settings, GtkPageSetupDoneFunc doneCb, void* data)
1071 	{
1072 		// void gtk_print_run_page_setup_dialog_async  (GtkWindow *parent,  GtkPageSetup *page_setup,  GtkPrintSettings *settings,  GtkPageSetupDoneFunc done_cb,  gpointer data);
1073 		gtk_print_run_page_setup_dialog_async((parent is null) ? null : parent.getWindowStruct(), (pageSetup is null) ? null : pageSetup.getPageSetupStruct(), (settings is null) ? null : settings.getPrintSettingsStruct(), doneCb, data);
1074 	}
1075 }