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.PrintUnixDialog;
26 
27 private import glib.ConstructionException;
28 private import glib.Str;
29 private import gobject.ObjectG;
30 private import gtk.Dialog;
31 private import gtk.PageSetup;
32 private import gtk.PrintSettings;
33 private import gtk.Printer;
34 private import gtk.Settings;
35 private import gtk.Widget;
36 private import gtk.Window;
37 private import gtk.c.functions;
38 public  import gtk.c.types;
39 
40 
41 /**
42  * `GtkPrintUnixDialog` implements a print dialog for platforms
43  * which don’t provide a native print dialog, like Unix.
44  * 
45  * ![An example GtkPrintUnixDialog](printdialog.png)
46  * 
47  * It can be used very much like any other GTK dialog, at the cost of
48  * the portability offered by the high-level printing API with
49  * [class@Gtk.PrintOperation].
50  * 
51  * In order to print something with `GtkPrintUnixDialog`, you need to
52  * use [method@Gtk.PrintUnixDialog.get_selected_printer] to obtain a
53  * [class@Gtk.Printer] object and use it to construct a [class@Gtk.PrintJob]
54  * using [ctor@Gtk.PrintJob.new].
55  * 
56  * `GtkPrintUnixDialog` uses the following response values:
57  * 
58  * - %GTK_RESPONSE_OK: for the “Print” button
59  * - %GTK_RESPONSE_APPLY: for the “Preview” button
60  * - %GTK_RESPONSE_CANCEL: for the “Cancel” button
61  * 
62  * # GtkPrintUnixDialog as GtkBuildable
63  * 
64  * The `GtkPrintUnixDialog` implementation of the `GtkBuildable` interface
65  * exposes its @notebook internal children with the name “notebook”.
66  * 
67  * An example of a `GtkPrintUnixDialog` UI definition fragment:
68  * 
69  * ```xml
70  * <object class="GtkPrintUnixDialog" id="dialog1">
71  * <child internal-child="notebook">
72  * <object class="GtkNotebook" id="notebook">
73  * <child>
74  * <object type="GtkNotebookPage">
75  * <property name="tab_expand">False</property>
76  * <property name="tab_fill">False</property>
77  * <property name="tab">
78  * <object class="GtkLabel" id="tablabel">
79  * <property name="label">Tab label</property>
80  * </object>
81  * </property>
82  * <property name="child">
83  * <object class="GtkLabel" id="tabcontent">
84  * <property name="label">Content on notebook tab</property>
85  * </object>
86  * </property>
87  * </object>
88  * </child>
89  * </object>
90  * </child>
91  * </object>
92  * ```
93  * 
94  * # CSS nodes
95  * 
96  * `GtkPrintUnixDialog` has a single CSS node with name window. The style classes
97  * dialog and print are added.
98  */
99 public class PrintUnixDialog : Dialog
100 {
101 	/** the main Gtk struct */
102 	protected GtkPrintUnixDialog* gtkPrintUnixDialog;
103 
104 	/** Get the main Gtk struct */
105 	public GtkPrintUnixDialog* getPrintUnixDialogStruct(bool transferOwnership = false)
106 	{
107 		if (transferOwnership)
108 			ownedRef = false;
109 		return gtkPrintUnixDialog;
110 	}
111 
112 	/** the main Gtk struct as a void* */
113 	protected override void* getStruct()
114 	{
115 		return cast(void*)gtkPrintUnixDialog;
116 	}
117 
118 	/**
119 	 * Sets our main struct and passes it to the parent class.
120 	 */
121 	public this (GtkPrintUnixDialog* gtkPrintUnixDialog, bool ownedRef = false)
122 	{
123 		this.gtkPrintUnixDialog = gtkPrintUnixDialog;
124 		super(cast(GtkDialog*)gtkPrintUnixDialog, ownedRef);
125 	}
126 
127 	/**
128 	 * Gets a new `GtkPrintSettings` object that represents the
129 	 * current values in the print dialog.
130 	 *
131 	 * Note that this creates a new object, and you need to unref
132 	 * it if don’t want to keep it.
133 	 *
134 	 * Returns: a new `GtkPrintSettings` object with the values from @dialog
135 	 */
136 	public override Settings getSettings()
137 	{
138 		auto __p = gtk_print_unix_dialog_get_settings(gtkPrintUnixDialog);
139 
140 		if(__p is null)
141 		{
142 			return null;
143 		}
144 
145 		return cast(Settings)ObjectG.getDObject!(PrintSettings)(cast(GtkPrintSettings*) __p, true);
146 	}
147 
148 	/**
149 	 */
150 
151 	/** */
152 	public static GType getType()
153 	{
154 		return gtk_print_unix_dialog_get_type();
155 	}
156 
157 	/**
158 	 * Creates a new `GtkPrintUnixDialog`.
159 	 *
160 	 * Params:
161 	 *     title = Title of the dialog, or %NULL
162 	 *     parent = Transient parent of the dialog, or %NULL
163 	 *
164 	 * Returns: a new `GtkPrintUnixDialog`
165 	 *
166 	 * Throws: ConstructionException GTK+ fails to create the object.
167 	 */
168 	public this(string title, Window parent)
169 	{
170 		auto __p = gtk_print_unix_dialog_new(Str.toStringz(title), (parent is null) ? null : parent.getWindowStruct());
171 
172 		if(__p is null)
173 		{
174 			throw new ConstructionException("null returned by new");
175 		}
176 
177 		this(cast(GtkPrintUnixDialog*) __p);
178 	}
179 
180 	/**
181 	 * Adds a custom tab to the print dialog.
182 	 *
183 	 * Params:
184 	 *     child = the widget to put in the custom tab
185 	 *     tabLabel = the widget to use as tab label
186 	 */
187 	public void addCustomTab(Widget child, Widget tabLabel)
188 	{
189 		gtk_print_unix_dialog_add_custom_tab(gtkPrintUnixDialog, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct());
190 	}
191 
192 	/**
193 	 * Gets the current page of the `GtkPrintUnixDialog`.
194 	 *
195 	 * Returns: the current page of @dialog
196 	 */
197 	public int getCurrentPage()
198 	{
199 		return gtk_print_unix_dialog_get_current_page(gtkPrintUnixDialog);
200 	}
201 
202 	/**
203 	 * Gets whether to embed the page setup.
204 	 *
205 	 * Returns: whether to embed the page setup
206 	 */
207 	public bool getEmbedPageSetup()
208 	{
209 		return gtk_print_unix_dialog_get_embed_page_setup(gtkPrintUnixDialog) != 0;
210 	}
211 
212 	/**
213 	 * Gets whether there is a selection.
214 	 *
215 	 * Returns: whether there is a selection
216 	 */
217 	public bool getHasSelection()
218 	{
219 		return gtk_print_unix_dialog_get_has_selection(gtkPrintUnixDialog) != 0;
220 	}
221 
222 	/**
223 	 * Gets the capabilities that have been set on this `GtkPrintUnixDialog`.
224 	 *
225 	 * Returns: the printing capabilities
226 	 */
227 	public GtkPrintCapabilities getManualCapabilities()
228 	{
229 		return gtk_print_unix_dialog_get_manual_capabilities(gtkPrintUnixDialog);
230 	}
231 
232 	/**
233 	 * Gets the page setup that is used by the `GtkPrintUnixDialog`.
234 	 *
235 	 * Returns: the page setup of @dialog.
236 	 */
237 	public PageSetup getPageSetup()
238 	{
239 		auto __p = gtk_print_unix_dialog_get_page_setup(gtkPrintUnixDialog);
240 
241 		if(__p is null)
242 		{
243 			return null;
244 		}
245 
246 		return ObjectG.getDObject!(PageSetup)(cast(GtkPageSetup*) __p);
247 	}
248 
249 	/**
250 	 * Gets whether a page setup was set by the user.
251 	 *
252 	 * Returns: whether a page setup was set by user.
253 	 */
254 	public bool getPageSetupSet()
255 	{
256 		return gtk_print_unix_dialog_get_page_setup_set(gtkPrintUnixDialog) != 0;
257 	}
258 
259 	/**
260 	 * Gets the currently selected printer.
261 	 *
262 	 * Returns: the currently selected printer
263 	 */
264 	public Printer getSelectedPrinter()
265 	{
266 		auto __p = gtk_print_unix_dialog_get_selected_printer(gtkPrintUnixDialog);
267 
268 		if(__p is null)
269 		{
270 			return null;
271 		}
272 
273 		return ObjectG.getDObject!(Printer)(cast(GtkPrinter*) __p);
274 	}
275 
276 	/**
277 	 * Gets whether the print dialog allows user to print a selection.
278 	 *
279 	 * Returns: whether the application supports print of selection
280 	 */
281 	public bool getSupportSelection()
282 	{
283 		return gtk_print_unix_dialog_get_support_selection(gtkPrintUnixDialog) != 0;
284 	}
285 
286 	/**
287 	 * Sets the current page number.
288 	 *
289 	 * If @current_page is not -1, this enables the current page choice
290 	 * for the range of pages to print.
291 	 *
292 	 * Params:
293 	 *     currentPage = the current page number.
294 	 */
295 	public void setCurrentPage(int currentPage)
296 	{
297 		gtk_print_unix_dialog_set_current_page(gtkPrintUnixDialog, currentPage);
298 	}
299 
300 	/**
301 	 * Embed page size combo box and orientation combo box into page setup page.
302 	 *
303 	 * Params:
304 	 *     embed = embed page setup selection
305 	 */
306 	public void setEmbedPageSetup(bool embed)
307 	{
308 		gtk_print_unix_dialog_set_embed_page_setup(gtkPrintUnixDialog, embed);
309 	}
310 
311 	/**
312 	 * Sets whether a selection exists.
313 	 *
314 	 * Params:
315 	 *     hasSelection = %TRUE indicates that a selection exists
316 	 */
317 	public void setHasSelection(bool hasSelection)
318 	{
319 		gtk_print_unix_dialog_set_has_selection(gtkPrintUnixDialog, hasSelection);
320 	}
321 
322 	/**
323 	 * This lets you specify the printing capabilities your application
324 	 * supports.
325 	 *
326 	 * For instance, if you can handle scaling the output then you pass
327 	 * %GTK_PRINT_CAPABILITY_SCALE. If you don’t pass that, then the dialog
328 	 * will only let you select the scale if the printing system automatically
329 	 * handles scaling.
330 	 *
331 	 * Params:
332 	 *     capabilities = the printing capabilities of your application
333 	 */
334 	public void setManualCapabilities(GtkPrintCapabilities capabilities)
335 	{
336 		gtk_print_unix_dialog_set_manual_capabilities(gtkPrintUnixDialog, capabilities);
337 	}
338 
339 	/**
340 	 * Sets the page setup of the `GtkPrintUnixDialog`.
341 	 *
342 	 * Params:
343 	 *     pageSetup = a `GtkPageSetup`
344 	 */
345 	public void setPageSetup(PageSetup pageSetup)
346 	{
347 		gtk_print_unix_dialog_set_page_setup(gtkPrintUnixDialog, (pageSetup is null) ? null : pageSetup.getPageSetupStruct());
348 	}
349 
350 	/**
351 	 * Sets the `GtkPrintSettings` for the `GtkPrintUnixDialog`.
352 	 *
353 	 * Typically, this is used to restore saved print settings
354 	 * from a previous print operation before the print dialog
355 	 * is shown.
356 	 *
357 	 * Params:
358 	 *     settings = a `GtkPrintSettings`, or %NULL
359 	 */
360 	public void setSettings(PrintSettings settings)
361 	{
362 		gtk_print_unix_dialog_set_settings(gtkPrintUnixDialog, (settings is null) ? null : settings.getPrintSettingsStruct());
363 	}
364 
365 	/**
366 	 * Sets whether the print dialog allows user to print a selection.
367 	 *
368 	 * Params:
369 	 *     supportSelection = %TRUE to allow print selection
370 	 */
371 	public void setSupportSelection(bool supportSelection)
372 	{
373 		gtk_print_unix_dialog_set_support_selection(gtkPrintUnixDialog, supportSelection);
374 	}
375 }