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 module gtk.PrintOperationPreviewT;
26 
27 public  import gobject.Signals;
28 public  import gtk.PageSetup;
29 public  import gtk.PrintContext;
30 public  import gtkc.gdktypes;
31 public  import gtkc.gtk;
32 public  import gtkc.gtktypes;
33 
34 
35 /** */
36 public template PrintOperationPreviewT(TStruct)
37 {
38 	/** Get the main Gtk struct */
39 	public GtkPrintOperationPreview* getPrintOperationPreviewStruct()
40 	{
41 		return cast(GtkPrintOperationPreview*)getStruct();
42 	}
43 
44 
45 	/**
46 	 * Ends a preview.
47 	 *
48 	 * This function must be called to finish a custom print preview.
49 	 *
50 	 * Since: 2.10
51 	 */
52 	public void endPreview()
53 	{
54 		gtk_print_operation_preview_end_preview(getPrintOperationPreviewStruct());
55 	}
56 
57 	/**
58 	 * Returns whether the given page is included in the set of pages that
59 	 * have been selected for printing.
60 	 *
61 	 * Params:
62 	 *     pageNr = a page number
63 	 *
64 	 * Return: %TRUE if the page has been selected for printing
65 	 *
66 	 * Since: 2.10
67 	 */
68 	public bool isSelected(int pageNr)
69 	{
70 		return gtk_print_operation_preview_is_selected(getPrintOperationPreviewStruct(), pageNr) != 0;
71 	}
72 
73 	/**
74 	 * Renders a page to the preview, using the print context that
75 	 * was passed to the #GtkPrintOperation::preview handler together
76 	 * with @preview.
77 	 *
78 	 * A custom iprint preview should use this function in its ::expose
79 	 * handler to render the currently selected page.
80 	 *
81 	 * Note that this function requires a suitable cairo context to
82 	 * be associated with the print context.
83 	 *
84 	 * Params:
85 	 *     pageNr = the page to render
86 	 *
87 	 * Since: 2.10
88 	 */
89 	public void renderPage(int pageNr)
90 	{
91 		gtk_print_operation_preview_render_page(getPrintOperationPreviewStruct(), pageNr);
92 	}
93 
94 	int[string] connectedSignals;
95 
96 	void delegate(PrintContext, PageSetup, PrintOperationPreviewIF)[] _onGotPageSizeListeners;
97 	@property void delegate(PrintContext, PageSetup, PrintOperationPreviewIF)[] onGotPageSizeListeners()
98 	{
99 		return _onGotPageSizeListeners;
100 	}
101 	/**
102 	 * The ::got-page-size signal is emitted once for each page
103 	 * that gets rendered to the preview.
104 	 *
105 	 * A handler for this signal should update the @context
106 	 * according to @page_setup and set up a suitable cairo
107 	 * context, using gtk_print_context_set_cairo_context().
108 	 *
109 	 * Params:
110 	 *     context = the current #GtkPrintContext
111 	 *     pageSetup = the #GtkPageSetup for the current page
112 	 */
113 	void addOnGotPageSize(void delegate(PrintContext, PageSetup, PrintOperationPreviewIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
114 	{
115 		if ( "got-page-size" !in connectedSignals )
116 		{
117 			Signals.connectData(
118 				this,
119 				"got-page-size",
120 				cast(GCallback)&callBackGotPageSize,
121 				cast(void*)cast(PrintOperationPreviewIF)this,
122 				null,
123 				connectFlags);
124 			connectedSignals["got-page-size"] = 1;
125 		}
126 		_onGotPageSizeListeners ~= dlg;
127 	}
128 	extern(C) static void callBackGotPageSize(GtkPrintOperationPreview* printoperationpreviewStruct, GtkPrintContext* context, GtkPageSetup* pageSetup, PrintOperationPreviewIF _printoperationpreview)
129 	{
130 		foreach ( void delegate(PrintContext, PageSetup, PrintOperationPreviewIF) dlg; _printoperationpreview.onGotPageSizeListeners )
131 		{
132 			dlg(ObjectG.getDObject!(PrintContext)(context), ObjectG.getDObject!(PageSetup)(pageSetup), _printoperationpreview);
133 		}
134 	}
135 
136 	void delegate(PrintContext, PrintOperationPreviewIF)[] _onReadyListeners;
137 	@property void delegate(PrintContext, PrintOperationPreviewIF)[] onReadyListeners()
138 	{
139 		return _onReadyListeners;
140 	}
141 	/**
142 	 * The ::ready signal gets emitted once per preview operation,
143 	 * before the first page is rendered.
144 	 *
145 	 * A handler for this signal can be used for setup tasks.
146 	 *
147 	 * Params:
148 	 *     context = the current #GtkPrintContext
149 	 */
150 	void addOnReady(void delegate(PrintContext, PrintOperationPreviewIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
151 	{
152 		if ( "ready" !in connectedSignals )
153 		{
154 			Signals.connectData(
155 				this,
156 				"ready",
157 				cast(GCallback)&callBackReady,
158 				cast(void*)cast(PrintOperationPreviewIF)this,
159 				null,
160 				connectFlags);
161 			connectedSignals["ready"] = 1;
162 		}
163 		_onReadyListeners ~= dlg;
164 	}
165 	extern(C) static void callBackReady(GtkPrintOperationPreview* printoperationpreviewStruct, GtkPrintContext* context, PrintOperationPreviewIF _printoperationpreview)
166 	{
167 		foreach ( void delegate(PrintContext, PrintOperationPreviewIF) dlg; _printoperationpreview.onReadyListeners )
168 		{
169 			dlg(ObjectG.getDObject!(PrintContext)(context), _printoperationpreview);
170 		}
171 	}
172 }