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