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