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  = 
27  * outPack = gtk
28  * outFile = PrintOperationPreviewT
29  * strct   = GtkPrintOperationPreview
30  * realStrct=
31  * ctorStrct=
32  * clss    = PrintOperationPreviewT
33  * interf  = PrintOperationPreviewIF
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * 	- TStruct
38  * extend  = 
39  * implements:
40  * prefixes:
41  * 	- gtk_print_operation_preview_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * 	- begin-print
47  * 	- create-custom-widget
48  * 	- custom-widget-apply
49  * 	- done
50  * 	- draw-page
51  * 	- end-print
52  * 	- paginate
53  * 	- preview
54  * 	- request-page-setup
55  * 	- status-changed
56  * 	- update-custom-widget
57  * imports:
58  * 	- gtk.PageSetup
59  * 	- gtk.PrintContext
60  * structWrap:
61  * 	- GtkPageSetup* -> PageSetup
62  * 	- GtkPrintContext* -> PrintContext
63  * module aliases:
64  * local aliases:
65  * overrides:
66  */
67 
68 module gtk.PrintOperationPreviewT;
69 
70 public  import gtkc.gtktypes;
71 
72 public import gtkc.gtk;
73 public import glib.ConstructionException;
74 public import gobject.ObjectG;
75 
76 public import gobject.Signals;
77 public  import gtkc.gdktypes;
78 
79 public import gtk.PageSetup;
80 public import gtk.PrintContext;
81 
82 
83 
84 
85 /**
86  * GtkPrintOperation is the high-level, portable printing API.
87  * It looks a bit different than other GTK+ dialogs such as the
88  * GtkFileChooser, since some platforms don't expose enough
89  * infrastructure to implement a good print dialog. On such
90  * platforms, GtkPrintOperation uses the native print dialog.
91  * On platforms which do not provide a native print dialog, GTK+
92  * uses its own, see GtkPrintUnixDialog.
93  *
94  * The typical way to use the high-level printing API is to create
95  * a GtkPrintOperation object with gtk_print_operation_new() when
96  * the user selects to print. Then you set some properties on it,
97  * e.g. the page size, any GtkPrintSettings from previous print
98  * operations, the number of pages, the current page, etc.
99  *
100  * Then you start the print operation by calling gtk_print_operation_run().
101  * It will then show a dialog, let the user select a printer and
102  * options. When the user finished the dialog various signals will
103  * be emitted on the GtkPrintOperation, the main one being
104  * "draw-page", which you are supposed to catch
105  * and render the page on the provided GtkPrintContext using Cairo.
106  *
107  * $(DDOC_COMMENT example)
108  *
109  * By default GtkPrintOperation uses an external application to do
110  * print preview. To implement a custom print preview, an application
111  * must connect to the preview signal. The functions
112  * gtk_print_operation_preview_render_page(),
113  * gtk_print_operation_preview_end_preview() and
114  * gtk_print_operation_preview_is_selected()
115  * are useful when implementing a print preview.
116  */
117 public template PrintOperationPreviewT(TStruct)
118 {
119 	
120 	/** the main Gtk struct */
121 	protected GtkPrintOperationPreview* gtkPrintOperationPreview;
122 	
123 	
124 	public GtkPrintOperationPreview* getPrintOperationPreviewTStruct()
125 	{
126 		return cast(GtkPrintOperationPreview*)getStruct();
127 	}
128 	
129 	
130 	/**
131 	 */
132 	int[string] connectedSignals;
133 	
134 	void delegate(PrintContext, PageSetup, PrintOperationPreviewIF)[] _onGotPageSizeListeners;
135 	@property void delegate(PrintContext, PageSetup, PrintOperationPreviewIF)[] onGotPageSizeListeners()
136 	{
137 		return  _onGotPageSizeListeners;
138 	}
139 	/**
140 	 * The ::got-page-size signal is emitted once for each page
141 	 * that gets rendered to the preview.
142 	 * A handler for this signal should update the context
143 	 * according to page_setup and set up a suitable cairo
144 	 * context, using gtk_print_context_set_cairo_context().
145 	 */
146 	void addOnGotPageSize(void delegate(PrintContext, PageSetup, PrintOperationPreviewIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
147 	{
148 		if ( !("got-page-size" in connectedSignals) )
149 		{
150 			Signals.connectData(
151 			getStruct(),
152 			"got-page-size",
153 			cast(GCallback)&callBackGotPageSize,
154 			cast(void*)cast(PrintOperationPreviewIF)this,
155 			null,
156 			connectFlags);
157 			connectedSignals["got-page-size"] = 1;
158 		}
159 		_onGotPageSizeListeners ~= dlg;
160 	}
161 	extern(C) static void callBackGotPageSize(GtkPrintOperationPreview* previewStruct, GtkPrintContext* context, GtkPageSetup* pageSetup, PrintOperationPreviewIF _printOperationPreviewIF)
162 	{
163 		foreach ( void delegate(PrintContext, PageSetup, PrintOperationPreviewIF) dlg ; _printOperationPreviewIF.onGotPageSizeListeners )
164 		{
165 			dlg(ObjectG.getDObject!(PrintContext)(context), ObjectG.getDObject!(PageSetup)(pageSetup), _printOperationPreviewIF);
166 		}
167 	}
168 	
169 	void delegate(PrintContext, PrintOperationPreviewIF)[] _onReadyListeners;
170 	@property void delegate(PrintContext, PrintOperationPreviewIF)[] onReadyListeners()
171 	{
172 		return  _onReadyListeners;
173 	}
174 	/**
175 	 * The ::ready signal gets emitted once per preview operation,
176 	 * before the first page is rendered.
177 	 * A handler for this signal can be used for setup tasks.
178 	 * See Also
179 	 * GtkPrintContext, GtkPrintUnixDialog
180 	 */
181 	void addOnReady(void delegate(PrintContext, PrintOperationPreviewIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
182 	{
183 		if ( !("ready" in connectedSignals) )
184 		{
185 			Signals.connectData(
186 			getStruct(),
187 			"ready",
188 			cast(GCallback)&callBackReady,
189 			cast(void*)cast(PrintOperationPreviewIF)this,
190 			null,
191 			connectFlags);
192 			connectedSignals["ready"] = 1;
193 		}
194 		_onReadyListeners ~= dlg;
195 	}
196 	extern(C) static void callBackReady(GtkPrintOperationPreview* previewStruct, GtkPrintContext* context, PrintOperationPreviewIF _printOperationPreviewIF)
197 	{
198 		foreach ( void delegate(PrintContext, PrintOperationPreviewIF) dlg ; _printOperationPreviewIF.onReadyListeners )
199 		{
200 			dlg(ObjectG.getDObject!(PrintContext)(context), _printOperationPreviewIF);
201 		}
202 	}
203 	
204 	
205 	/**
206 	 * Ends a preview.
207 	 * This function must be called to finish a custom print preview.
208 	 * Since 2.10
209 	 */
210 	public void endPreview()
211 	{
212 		// void gtk_print_operation_preview_end_preview  (GtkPrintOperationPreview *preview);
213 		gtk_print_operation_preview_end_preview(getPrintOperationPreviewTStruct());
214 	}
215 	
216 	/**
217 	 * Returns whether the given page is included in the set of pages that
218 	 * have been selected for printing.
219 	 * Since 2.10
220 	 * Params:
221 	 * pageNr = a page number
222 	 * Returns: TRUE if the page has been selected for printing
223 	 */
224 	public int isSelected(int pageNr)
225 	{
226 		// gboolean gtk_print_operation_preview_is_selected  (GtkPrintOperationPreview *preview,  gint page_nr);
227 		return gtk_print_operation_preview_is_selected(getPrintOperationPreviewTStruct(), pageNr);
228 	}
229 	
230 	/**
231 	 * Renders a page to the preview, using the print context that
232 	 * was passed to the "preview" handler together
233 	 * with preview.
234 	 * A custom iprint preview should use this function in its ::expose
235 	 * handler to render the currently selected page.
236 	 * Note that this function requires a suitable cairo context to
237 	 * be associated with the print context.
238 	 * Since 2.10
239 	 * Params:
240 	 * pageNr = the page to render
241 	 */
242 	public void renderPage(int pageNr)
243 	{
244 		// void gtk_print_operation_preview_render_page  (GtkPrintOperationPreview *preview,  gint page_nr);
245 		gtk_print_operation_preview_render_page(getPrintOperationPreviewTStruct(), pageNr);
246 	}
247 }