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 gtk.c.functions; 31 public import gtk.c.types; 32 public import std.algorithm; 33 34 35 /** 36 * `GtkPrintOperationPreview` is the interface that is used to 37 * implement print preview. 38 * 39 * A `GtkPrintOperationPreview` object is passed to the 40 * [signal@Gtk.PrintOperation::preview] signal by 41 * [class@Gtk.PrintOperation]. 42 */ 43 public template PrintOperationPreviewT(TStruct) 44 { 45 /** Get the main Gtk struct */ 46 public GtkPrintOperationPreview* getPrintOperationPreviewStruct(bool transferOwnership = false) 47 { 48 if (transferOwnership) 49 ownedRef = false; 50 return cast(GtkPrintOperationPreview*)getStruct(); 51 } 52 53 54 /** 55 * Ends a preview. 56 * 57 * This function must be called to finish a custom print preview. 58 */ 59 public void endPreview() 60 { 61 gtk_print_operation_preview_end_preview(getPrintOperationPreviewStruct()); 62 } 63 64 /** 65 * Returns whether the given page is included in the set of pages that 66 * have been selected for printing. 67 * 68 * Params: 69 * pageNr = a page number 70 * 71 * Returns: %TRUE if the page has been selected for printing 72 */ 73 public bool isSelected(int pageNr) 74 { 75 return gtk_print_operation_preview_is_selected(getPrintOperationPreviewStruct(), pageNr) != 0; 76 } 77 78 /** 79 * Renders a page to the preview. 80 * 81 * This is using the print context that was passed to the 82 * [signal@Gtk.PrintOperation::preview] handler together 83 * with @preview. 84 * 85 * A custom print preview should use this function to render 86 * the currently selected page. 87 * 88 * Note that this function requires a suitable cairo context to 89 * be associated with the print context. 90 * 91 * Params: 92 * pageNr = the page to render 93 */ 94 public void renderPage(int pageNr) 95 { 96 gtk_print_operation_preview_render_page(getPrintOperationPreviewStruct(), pageNr); 97 } 98 99 /** 100 * Emitted once for each page that gets rendered to the preview. 101 * 102 * A handler for this signal should update the @context 103 * according to @page_setup and set up a suitable cairo 104 * context, using [method@Gtk.PrintContext.set_cairo_context]. 105 * 106 * Params: 107 * context = the current `GtkPrintContext` 108 * pageSetup = the `GtkPageSetup` for the current page 109 */ 110 gulong addOnGotPageSize(void delegate(PrintContext, PageSetup, PrintOperationPreviewIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 111 { 112 return Signals.connect(this, "got-page-size", dlg, connectFlags ^ ConnectFlags.SWAPPED); 113 } 114 115 /** 116 * The ::ready signal gets emitted once per preview operation, 117 * before the first page is rendered. 118 * 119 * A handler for this signal can be used for setup tasks. 120 * 121 * Params: 122 * context = the current #GtkPrintContext 123 */ 124 gulong addOnReady(void delegate(PrintContext, PrintOperationPreviewIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 125 { 126 return Signals.connect(this, "ready", dlg, connectFlags ^ ConnectFlags.SWAPPED); 127 } 128 }