1 /* 2 * This file is part of EvinceD. 3 * EvinceD is based on GtkD. 4 * 5 * EvinceD is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU Lesser General Public License 7 * as published by the Free Software Foundation; either version 3 8 * of the License, or (at your option) any later version, with 9 * some exceptions, please read the COPYING file. 10 * 11 * EvinceD is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public License 17 * along with EvinceD; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 19 */ 20 21 // generated automatically - do not change 22 // find conversion definition on APILookup.txt 23 24 25 module evince.view.PrintOperation; 26 27 private import evince.document.Document; 28 private import evince.view.c.functions; 29 public import evince.view.c.types; 30 private import glib.ConstructionException; 31 private import glib.ErrorG; 32 private import glib.GException; 33 private import glib.Str; 34 private import gobject.ObjectG; 35 private import gobject.Signals; 36 private import gtk.PageSetup; 37 private import gtk.PrintSettings; 38 private import gtk.Window; 39 private import std.algorithm; 40 41 42 /** */ 43 public class PrintOperation : ObjectG 44 { 45 /** the main Gtk struct */ 46 protected EvPrintOperation* evPrintOperation; 47 48 /** Get the main Gtk struct */ 49 public EvPrintOperation* getPrintOperationStruct(bool transferOwnership = false) 50 { 51 if (transferOwnership) 52 ownedRef = false; 53 return evPrintOperation; 54 } 55 56 /** the main Gtk struct as a void* */ 57 protected override void* getStruct() 58 { 59 return cast(void*)evPrintOperation; 60 } 61 62 /** 63 * Sets our main struct and passes it to the parent class. 64 */ 65 public this (EvPrintOperation* evPrintOperation, bool ownedRef = false) 66 { 67 this.evPrintOperation = evPrintOperation; 68 super(cast(GObject*)evPrintOperation, ownedRef); 69 } 70 71 72 /** */ 73 public static GType getType() 74 { 75 return ev_print_operation_get_type(); 76 } 77 78 /** */ 79 public this(Document document) 80 { 81 auto __p = ev_print_operation_new((document is null) ? null : document.getDocumentStruct()); 82 83 if(__p is null) 84 { 85 throw new ConstructionException("null returned by new"); 86 } 87 88 this(cast(EvPrintOperation*) __p, true); 89 } 90 91 /** */ 92 public static bool existsForDocument(Document document) 93 { 94 return ev_print_operation_exists_for_document((document is null) ? null : document.getDocumentStruct()) != 0; 95 } 96 97 /** */ 98 public void cancel() 99 { 100 ev_print_operation_cancel(evPrintOperation); 101 } 102 103 /** 104 * Returns: a #GtkPageSetup 105 */ 106 public PageSetup getDefaultPageSetup() 107 { 108 auto __p = ev_print_operation_get_default_page_setup(evPrintOperation); 109 110 if(__p is null) 111 { 112 return null; 113 } 114 115 return ObjectG.getDObject!(PageSetup)(cast(GtkPageSetup*) __p); 116 } 117 118 /** */ 119 public bool getEmbedPageSetup() 120 { 121 return ev_print_operation_get_embed_page_setup(evPrintOperation) != 0; 122 } 123 124 /** */ 125 public void getError() 126 { 127 GError* err = null; 128 129 ev_print_operation_get_error(evPrintOperation, &err); 130 131 if (err !is null) 132 { 133 throw new GException( new ErrorG(err) ); 134 } 135 } 136 137 /** */ 138 public string getJobName() 139 { 140 return Str.toString(ev_print_operation_get_job_name(evPrintOperation)); 141 } 142 143 /** 144 * Returns: a #GtkPrintSettings 145 */ 146 public PrintSettings getPrintSettings() 147 { 148 auto __p = ev_print_operation_get_print_settings(evPrintOperation); 149 150 if(__p is null) 151 { 152 return null; 153 } 154 155 return ObjectG.getDObject!(PrintSettings)(cast(GtkPrintSettings*) __p); 156 } 157 158 /** */ 159 public double getProgress() 160 { 161 return ev_print_operation_get_progress(evPrintOperation); 162 } 163 164 /** */ 165 public string getStatus() 166 { 167 return Str.toString(ev_print_operation_get_status(evPrintOperation)); 168 } 169 170 /** */ 171 public void run(Window parent) 172 { 173 ev_print_operation_run(evPrintOperation, (parent is null) ? null : parent.getWindowStruct()); 174 } 175 176 /** */ 177 public void setCurrentPage(int currentPage) 178 { 179 ev_print_operation_set_current_page(evPrintOperation, currentPage); 180 } 181 182 /** */ 183 public void setDefaultPageSetup(PageSetup pageSetup) 184 { 185 ev_print_operation_set_default_page_setup(evPrintOperation, (pageSetup is null) ? null : pageSetup.getPageSetupStruct()); 186 } 187 188 /** */ 189 public void setEmbedPageSetup(bool embed) 190 { 191 ev_print_operation_set_embed_page_setup(evPrintOperation, embed); 192 } 193 194 /** */ 195 public void setJobName(string jobName) 196 { 197 ev_print_operation_set_job_name(evPrintOperation, Str.toStringz(jobName)); 198 } 199 200 /** */ 201 public void setPrintSettings(PrintSettings printSettings) 202 { 203 ev_print_operation_set_print_settings(evPrintOperation, (printSettings is null) ? null : printSettings.getPrintSettingsStruct()); 204 } 205 206 /** */ 207 gulong addOnBeginPrint(void delegate(PrintOperation) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 208 { 209 return Signals.connect(this, "begin-print", dlg, connectFlags ^ ConnectFlags.SWAPPED); 210 } 211 212 /** */ 213 gulong addOnDone(void delegate(GtkPrintOperationResult, PrintOperation) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 214 { 215 return Signals.connect(this, "done", dlg, connectFlags ^ ConnectFlags.SWAPPED); 216 } 217 218 /** */ 219 gulong addOnStatusChanged(void delegate(PrintOperation) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 220 { 221 return Signals.connect(this, "status-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 222 } 223 }