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 = GtkPrintSettings.html 27 * outPack = gtk 28 * outFile = PrintSettings 29 * strct = GtkPrintSettings 30 * realStrct= 31 * ctorStrct= 32 * clss = PrintSettings 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_print_settings_ 41 * - gtk_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * - gtk.PaperSize 49 * - glib.ErrorG 50 * - glib.GException 51 * - glib.KeyFile 52 * structWrap: 53 * - GKeyFile* -> KeyFile 54 * - GtkPaperSize* -> PaperSize 55 * - GtkPrintSettings* -> PrintSettings 56 * module aliases: 57 * local aliases: 58 * overrides: 59 */ 60 61 module gtk.PrintSettings; 62 63 public import gtkc.gtktypes; 64 65 private import gtkc.gtk; 66 private import glib.ConstructionException; 67 private import gobject.ObjectG; 68 69 70 private import glib.Str; 71 private import gtk.PaperSize; 72 private import glib.ErrorG; 73 private import glib.GException; 74 private import glib.KeyFile; 75 76 77 78 private import gobject.ObjectG; 79 80 /** 81 * Description 82 * A GtkPrintSettings object represents the settings of a print dialog in 83 * a system-independent way. The main use for this object is that once 84 * you've printed you can get a settings object that represents the settings 85 * the user chose, and the next time you print you can pass that object in so 86 * that the user doesn't have to re-set all his settings. 87 * Its also possible to enumerate the settings so that you can easily save 88 * the settings for the next time your app runs, or even store them in a 89 * document. The predefined keys try to use shared values as much as possible 90 * so that moving such a document between systems still works. 91 * Printing support was added in GTK+ 2.10. 92 */ 93 public class PrintSettings : ObjectG 94 { 95 96 /** the main Gtk struct */ 97 protected GtkPrintSettings* gtkPrintSettings; 98 99 100 public GtkPrintSettings* getPrintSettingsStruct() 101 { 102 return gtkPrintSettings; 103 } 104 105 106 /** the main Gtk struct as a void* */ 107 protected override void* getStruct() 108 { 109 return cast(void*)gtkPrintSettings; 110 } 111 112 /** 113 * Sets our main struct and passes it to the parent class 114 */ 115 public this (GtkPrintSettings* gtkPrintSettings) 116 { 117 super(cast(GObject*)gtkPrintSettings); 118 this.gtkPrintSettings = gtkPrintSettings; 119 } 120 121 protected override void setStruct(GObject* obj) 122 { 123 super.setStruct(obj); 124 gtkPrintSettings = cast(GtkPrintSettings*)obj; 125 } 126 127 /** 128 */ 129 130 /** 131 * Creates a new GtkPrintSettings object. 132 * Since 2.10 133 * Throws: ConstructionException GTK+ fails to create the object. 134 */ 135 public this () 136 { 137 // GtkPrintSettings * gtk_print_settings_new (void); 138 auto p = gtk_print_settings_new(); 139 if(p is null) 140 { 141 throw new ConstructionException("null returned by gtk_print_settings_new()"); 142 } 143 this(cast(GtkPrintSettings*) p); 144 } 145 146 /** 147 * Copies a GtkPrintSettings object. 148 * Since 2.10 149 * Returns: a newly allocated copy of other. [transfer full] 150 */ 151 public PrintSettings copy() 152 { 153 // GtkPrintSettings * gtk_print_settings_copy (GtkPrintSettings *other); 154 auto p = gtk_print_settings_copy(gtkPrintSettings); 155 156 if(p is null) 157 { 158 return null; 159 } 160 161 return ObjectG.getDObject!(PrintSettings)(cast(GtkPrintSettings*) p); 162 } 163 164 /** 165 * Returns TRUE, if a value is associated with key. 166 * Since 2.10 167 * Params: 168 * key = a key 169 * Returns: TRUE, if key has a value 170 */ 171 public int hasKey(string key) 172 { 173 // gboolean gtk_print_settings_has_key (GtkPrintSettings *settings, const gchar *key); 174 return gtk_print_settings_has_key(gtkPrintSettings, Str.toStringz(key)); 175 } 176 177 /** 178 * Looks up the string value associated with key. 179 * Since 2.10 180 * Params: 181 * key = a key 182 * Returns: the string value for key 183 */ 184 public string get(string key) 185 { 186 // const gchar * gtk_print_settings_get (GtkPrintSettings *settings, const gchar *key); 187 return Str.toString(gtk_print_settings_get(gtkPrintSettings, Str.toStringz(key))); 188 } 189 190 /** 191 * Associates value with key. 192 * Since 2.10 193 * Params: 194 * key = a key 195 * value = a string value, or NULL. [allow-none] 196 */ 197 public void set(string key, string value) 198 { 199 // void gtk_print_settings_set (GtkPrintSettings *settings, const gchar *key, const gchar *value); 200 gtk_print_settings_set(gtkPrintSettings, Str.toStringz(key), Str.toStringz(value)); 201 } 202 203 /** 204 * Removes any value associated with key. 205 * This has the same effect as setting the value to NULL. 206 * Since 2.10 207 * Params: 208 * key = a key 209 */ 210 public void unset(string key) 211 { 212 // void gtk_print_settings_unset (GtkPrintSettings *settings, const gchar *key); 213 gtk_print_settings_unset(gtkPrintSettings, Str.toStringz(key)); 214 } 215 216 /** 217 * Calls func for each key-value pair of settings. 218 * Since 2.10 219 * Params: 220 * func = the function to call. [scope call] 221 * userData = user data for func 222 */ 223 public void foreac(GtkPrintSettingsFunc func, void* userData) 224 { 225 // void gtk_print_settings_foreach (GtkPrintSettings *settings, GtkPrintSettingsFunc func, gpointer user_data); 226 gtk_print_settings_foreach(gtkPrintSettings, func, userData); 227 } 228 229 /** 230 * Returns the boolean represented by the value 231 * that is associated with key. 232 * The string "true" represents TRUE, any other 233 * string FALSE. 234 * Since 2.10 235 * Params: 236 * key = a key 237 * Returns: TRUE, if key maps to a true value. 238 */ 239 public int getBool(string key) 240 { 241 // gboolean gtk_print_settings_get_bool (GtkPrintSettings *settings, const gchar *key); 242 return gtk_print_settings_get_bool(gtkPrintSettings, Str.toStringz(key)); 243 } 244 245 /** 246 * Sets key to a boolean value. 247 * Since 2.10 248 * Params: 249 * key = a key 250 * value = a boolean 251 */ 252 public void setBool(string key, int value) 253 { 254 // void gtk_print_settings_set_bool (GtkPrintSettings *settings, const gchar *key, gboolean value); 255 gtk_print_settings_set_bool(gtkPrintSettings, Str.toStringz(key), value); 256 } 257 258 /** 259 * Returns the double value associated with key, or 0. 260 * Since 2.10 261 * Params: 262 * key = a key 263 * Returns: the double value of key 264 */ 265 public double getDouble(string key) 266 { 267 // gdouble gtk_print_settings_get_double (GtkPrintSettings *settings, const gchar *key); 268 return gtk_print_settings_get_double(gtkPrintSettings, Str.toStringz(key)); 269 } 270 271 /** 272 * Returns the floating point number represented by 273 * the value that is associated with key, or default_val 274 * if the value does not represent a floating point number. 275 * Floating point numbers are parsed with g_ascii_strtod(). 276 * Since 2.10 277 * Params: 278 * key = a key 279 * def = the default value 280 * Returns: the floating point number associated with key 281 */ 282 public double getDoubleWithDefault(string key, double def) 283 { 284 // gdouble gtk_print_settings_get_double_with_default (GtkPrintSettings *settings, const gchar *key, gdouble def); 285 return gtk_print_settings_get_double_with_default(gtkPrintSettings, Str.toStringz(key), def); 286 } 287 288 /** 289 * Sets key to a double value. 290 * Since 2.10 291 * Params: 292 * key = a key 293 * value = a double value 294 */ 295 public void setDouble(string key, double value) 296 { 297 // void gtk_print_settings_set_double (GtkPrintSettings *settings, const gchar *key, gdouble value); 298 gtk_print_settings_set_double(gtkPrintSettings, Str.toStringz(key), value); 299 } 300 301 /** 302 * Returns the value associated with key, interpreted 303 * as a length. The returned value is converted to units. 304 * Since 2.10 305 * Params: 306 * key = a key 307 * unit = the unit of the return value 308 * Returns: the length value of key, converted to unit 309 */ 310 public double getLength(string key, GtkUnit unit) 311 { 312 // gdouble gtk_print_settings_get_length (GtkPrintSettings *settings, const gchar *key, GtkUnit unit); 313 return gtk_print_settings_get_length(gtkPrintSettings, Str.toStringz(key), unit); 314 } 315 316 /** 317 * Associates a length in units of unit with key. 318 * Since 2.10 319 * Params: 320 * key = a key 321 * value = a length 322 * unit = the unit of length 323 */ 324 public void setLength(string key, double value, GtkUnit unit) 325 { 326 // void gtk_print_settings_set_length (GtkPrintSettings *settings, const gchar *key, gdouble value, GtkUnit unit); 327 gtk_print_settings_set_length(gtkPrintSettings, Str.toStringz(key), value, unit); 328 } 329 330 /** 331 * Returns the integer value of key, or 0. 332 * Since 2.10 333 * Params: 334 * key = a key 335 * Returns: the integer value of key 336 */ 337 public int getInt(string key) 338 { 339 // gint gtk_print_settings_get_int (GtkPrintSettings *settings, const gchar *key); 340 return gtk_print_settings_get_int(gtkPrintSettings, Str.toStringz(key)); 341 } 342 343 /** 344 * Returns the value of key, interpreted as 345 * an integer, or the default value. 346 * Since 2.10 347 * Params: 348 * key = a key 349 * def = the default value 350 * Returns: the integer value of key 351 */ 352 public int getIntWithDefault(string key, int def) 353 { 354 // gint gtk_print_settings_get_int_with_default (GtkPrintSettings *settings, const gchar *key, gint def); 355 return gtk_print_settings_get_int_with_default(gtkPrintSettings, Str.toStringz(key), def); 356 } 357 358 /** 359 * Sets key to an integer value. 360 * Since 2.10 361 * Params: 362 * key = a key 363 * value = an integer 364 */ 365 public void setInt(string key, int value) 366 { 367 // void gtk_print_settings_set_int (GtkPrintSettings *settings, const gchar *key, gint value); 368 gtk_print_settings_set_int(gtkPrintSettings, Str.toStringz(key), value); 369 } 370 371 /** 372 * Convenience function to obtain the value of 373 * GTK_PRINT_SETTINGS_PRINTER. 374 * Since 2.10 375 * Returns: the printer name 376 */ 377 public string getPrinter() 378 { 379 // const gchar * gtk_print_settings_get_printer (GtkPrintSettings *settings); 380 return Str.toString(gtk_print_settings_get_printer(gtkPrintSettings)); 381 } 382 383 /** 384 * Convenience function to set GTK_PRINT_SETTINGS_PRINTER 385 * to printer. 386 * Since 2.10 387 * Params: 388 * printer = the printer name 389 */ 390 public void setPrinter(string printer) 391 { 392 // void gtk_print_settings_set_printer (GtkPrintSettings *settings, const gchar *printer); 393 gtk_print_settings_set_printer(gtkPrintSettings, Str.toStringz(printer)); 394 } 395 396 /** 397 * Get the value of GTK_PRINT_SETTINGS_ORIENTATION, 398 * converted to a GtkPageOrientation. 399 * Since 2.10 400 * Returns: the orientation 401 */ 402 public GtkPageOrientation getOrientation() 403 { 404 // GtkPageOrientation gtk_print_settings_get_orientation (GtkPrintSettings *settings); 405 return gtk_print_settings_get_orientation(gtkPrintSettings); 406 } 407 408 /** 409 * Sets the value of GTK_PRINT_SETTINGS_ORIENTATION. 410 * Since 2.10 411 * Params: 412 * orientation = a page orientation 413 */ 414 public void setOrientation(GtkPageOrientation orientation) 415 { 416 // void gtk_print_settings_set_orientation (GtkPrintSettings *settings, GtkPageOrientation orientation); 417 gtk_print_settings_set_orientation(gtkPrintSettings, orientation); 418 } 419 420 /** 421 * Gets the value of GTK_PRINT_SETTINGS_PAPER_FORMAT, 422 * converted to a GtkPaperSize. 423 * Since 2.10 424 * Returns: the paper size 425 */ 426 public PaperSize getPaperSize() 427 { 428 // GtkPaperSize * gtk_print_settings_get_paper_size (GtkPrintSettings *settings); 429 auto p = gtk_print_settings_get_paper_size(gtkPrintSettings); 430 431 if(p is null) 432 { 433 return null; 434 } 435 436 return ObjectG.getDObject!(PaperSize)(cast(GtkPaperSize*) p); 437 } 438 439 /** 440 * Sets the value of GTK_PRINT_SETTINGS_PAPER_FORMAT, 441 * GTK_PRINT_SETTINGS_PAPER_WIDTH and 442 * GTK_PRINT_SETTINGS_PAPER_HEIGHT. 443 * Since 2.10 444 * Params: 445 * paperSize = a paper size 446 */ 447 public void setPaperSize(PaperSize paperSize) 448 { 449 // void gtk_print_settings_set_paper_size (GtkPrintSettings *settings, GtkPaperSize *paper_size); 450 gtk_print_settings_set_paper_size(gtkPrintSettings, (paperSize is null) ? null : paperSize.getPaperSizeStruct()); 451 } 452 453 /** 454 * Gets the value of GTK_PRINT_SETTINGS_PAPER_WIDTH, 455 * converted to unit. 456 * Since 2.10 457 * Params: 458 * unit = the unit for the return value 459 * Returns: the paper width, in units of unit 460 */ 461 public double getPaperWidth(GtkUnit unit) 462 { 463 // gdouble gtk_print_settings_get_paper_width (GtkPrintSettings *settings, GtkUnit unit); 464 return gtk_print_settings_get_paper_width(gtkPrintSettings, unit); 465 } 466 467 /** 468 * Sets the value of GTK_PRINT_SETTINGS_PAPER_WIDTH. 469 * Since 2.10 470 * Params: 471 * width = the paper width 472 * unit = the units of width 473 */ 474 public void setPaperWidth(double width, GtkUnit unit) 475 { 476 // void gtk_print_settings_set_paper_width (GtkPrintSettings *settings, gdouble width, GtkUnit unit); 477 gtk_print_settings_set_paper_width(gtkPrintSettings, width, unit); 478 } 479 480 /** 481 * Gets the value of GTK_PRINT_SETTINGS_PAPER_HEIGHT, 482 * converted to unit. 483 * Since 2.10 484 * Params: 485 * unit = the unit for the return value 486 * Returns: the paper height, in units of unit 487 */ 488 public double getPaperHeight(GtkUnit unit) 489 { 490 // gdouble gtk_print_settings_get_paper_height (GtkPrintSettings *settings, GtkUnit unit); 491 return gtk_print_settings_get_paper_height(gtkPrintSettings, unit); 492 } 493 494 /** 495 * Sets the value of GTK_PRINT_SETTINGS_PAPER_HEIGHT. 496 * Since 2.10 497 * Params: 498 * height = the paper height 499 * unit = the units of height 500 */ 501 public void setPaperHeight(double height, GtkUnit unit) 502 { 503 // void gtk_print_settings_set_paper_height (GtkPrintSettings *settings, gdouble height, GtkUnit unit); 504 gtk_print_settings_set_paper_height(gtkPrintSettings, height, unit); 505 } 506 507 /** 508 * Gets the value of GTK_PRINT_SETTINGS_USE_COLOR. 509 * Since 2.10 510 * Returns: whether to use color 511 */ 512 public int getUseColor() 513 { 514 // gboolean gtk_print_settings_get_use_color (GtkPrintSettings *settings); 515 return gtk_print_settings_get_use_color(gtkPrintSettings); 516 } 517 518 /** 519 * Sets the value of GTK_PRINT_SETTINGS_USE_COLOR. 520 * Since 2.10 521 * Params: 522 * useColor = whether to use color 523 */ 524 public void setUseColor(int useColor) 525 { 526 // void gtk_print_settings_set_use_color (GtkPrintSettings *settings, gboolean use_color); 527 gtk_print_settings_set_use_color(gtkPrintSettings, useColor); 528 } 529 530 /** 531 * Gets the value of GTK_PRINT_SETTINGS_COLLATE. 532 * Since 2.10 533 * Returns: whether to collate the printed pages 534 */ 535 public int getCollate() 536 { 537 // gboolean gtk_print_settings_get_collate (GtkPrintSettings *settings); 538 return gtk_print_settings_get_collate(gtkPrintSettings); 539 } 540 541 /** 542 * Sets the value of GTK_PRINT_SETTINGS_COLLATE. 543 * Since 2.10 544 * Params: 545 * collate = whether to collate the output 546 */ 547 public void setCollate(int collate) 548 { 549 // void gtk_print_settings_set_collate (GtkPrintSettings *settings, gboolean collate); 550 gtk_print_settings_set_collate(gtkPrintSettings, collate); 551 } 552 553 /** 554 * Gets the value of GTK_PRINT_SETTINGS_REVERSE. 555 * Since 2.10 556 * Returns: whether to reverse the order of the printed pages 557 */ 558 public int getReverse() 559 { 560 // gboolean gtk_print_settings_get_reverse (GtkPrintSettings *settings); 561 return gtk_print_settings_get_reverse(gtkPrintSettings); 562 } 563 564 /** 565 * Sets the value of GTK_PRINT_SETTINGS_REVERSE. 566 * Since 2.10 567 * Params: 568 * reverse = whether to reverse the output 569 */ 570 public void setReverse(int reverse) 571 { 572 // void gtk_print_settings_set_reverse (GtkPrintSettings *settings, gboolean reverse); 573 gtk_print_settings_set_reverse(gtkPrintSettings, reverse); 574 } 575 576 /** 577 * Gets the value of GTK_PRINT_SETTINGS_DUPLEX. 578 * Since 2.10 579 * Returns: whether to print the output in duplex. 580 */ 581 public GtkPrintDuplex getDuplex() 582 { 583 // GtkPrintDuplex gtk_print_settings_get_duplex (GtkPrintSettings *settings); 584 return gtk_print_settings_get_duplex(gtkPrintSettings); 585 } 586 587 /** 588 * Sets the value of GTK_PRINT_SETTINGS_DUPLEX. 589 * Since 2.10 590 * Params: 591 * duplex = a GtkPrintDuplex value 592 */ 593 public void setDuplex(GtkPrintDuplex duplex) 594 { 595 // void gtk_print_settings_set_duplex (GtkPrintSettings *settings, GtkPrintDuplex duplex); 596 gtk_print_settings_set_duplex(gtkPrintSettings, duplex); 597 } 598 599 /** 600 * Gets the value of GTK_PRINT_SETTINGS_QUALITY. 601 * Since 2.10 602 * Returns: the print quality 603 */ 604 public GtkPrintQuality getQuality() 605 { 606 // GtkPrintQuality gtk_print_settings_get_quality (GtkPrintSettings *settings); 607 return gtk_print_settings_get_quality(gtkPrintSettings); 608 } 609 610 /** 611 * Sets the value of GTK_PRINT_SETTINGS_QUALITY. 612 * Since 2.10 613 * Params: 614 * quality = a GtkPrintQuality value 615 */ 616 public void setQuality(GtkPrintQuality quality) 617 { 618 // void gtk_print_settings_set_quality (GtkPrintSettings *settings, GtkPrintQuality quality); 619 gtk_print_settings_set_quality(gtkPrintSettings, quality); 620 } 621 622 /** 623 * Gets the value of GTK_PRINT_SETTINGS_N_COPIES. 624 * Since 2.10 625 * Returns: the number of copies to print 626 */ 627 public int getNCopies() 628 { 629 // gint gtk_print_settings_get_n_copies (GtkPrintSettings *settings); 630 return gtk_print_settings_get_n_copies(gtkPrintSettings); 631 } 632 633 /** 634 * Sets the value of GTK_PRINT_SETTINGS_N_COPIES. 635 * Since 2.10 636 * Params: 637 * numCopies = the number of copies 638 */ 639 public void setNCopies(int numCopies) 640 { 641 // void gtk_print_settings_set_n_copies (GtkPrintSettings *settings, gint num_copies); 642 gtk_print_settings_set_n_copies(gtkPrintSettings, numCopies); 643 } 644 645 /** 646 * Gets the value of GTK_PRINT_SETTINGS_NUMBER_UP. 647 * Since 2.10 648 * Returns: the number of pages per sheet 649 */ 650 public int getNumberUp() 651 { 652 // gint gtk_print_settings_get_number_up (GtkPrintSettings *settings); 653 return gtk_print_settings_get_number_up(gtkPrintSettings); 654 } 655 656 /** 657 * Sets the value of GTK_PRINT_SETTINGS_NUMBER_UP. 658 * Since 2.10 659 * Params: 660 * numberUp = the number of pages per sheet 661 */ 662 public void setNumberUp(int numberUp) 663 { 664 // void gtk_print_settings_set_number_up (GtkPrintSettings *settings, gint number_up); 665 gtk_print_settings_set_number_up(gtkPrintSettings, numberUp); 666 } 667 668 /** 669 * Gets the value of GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT. 670 * Since 2.14 671 * Returns: layout of page in number-up mode 672 */ 673 public GtkNumberUpLayout getNumberUpLayout() 674 { 675 // GtkNumberUpLayout gtk_print_settings_get_number_up_layout (GtkPrintSettings *settings); 676 return gtk_print_settings_get_number_up_layout(gtkPrintSettings); 677 } 678 679 /** 680 * Sets the value of GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT. 681 * Since 2.14 682 * Params: 683 * numberUpLayout = a GtkNumberUpLayout value 684 */ 685 public void setNumberUpLayout(GtkNumberUpLayout numberUpLayout) 686 { 687 // void gtk_print_settings_set_number_up_layout (GtkPrintSettings *settings, GtkNumberUpLayout number_up_layout); 688 gtk_print_settings_set_number_up_layout(gtkPrintSettings, numberUpLayout); 689 } 690 691 /** 692 * Gets the value of GTK_PRINT_SETTINGS_RESOLUTION. 693 * Since 2.10 694 * Returns: the resolution in dpi 695 */ 696 public int getResolution() 697 { 698 // gint gtk_print_settings_get_resolution (GtkPrintSettings *settings); 699 return gtk_print_settings_get_resolution(gtkPrintSettings); 700 } 701 702 /** 703 * Sets the values of GTK_PRINT_SETTINGS_RESOLUTION, 704 * GTK_PRINT_SETTINGS_RESOLUTION_X and 705 * GTK_PRINT_SETTINGS_RESOLUTION_Y. 706 * Since 2.10 707 * Params: 708 * resolution = the resolution in dpi 709 */ 710 public void setResolution(int resolution) 711 { 712 // void gtk_print_settings_set_resolution (GtkPrintSettings *settings, gint resolution); 713 gtk_print_settings_set_resolution(gtkPrintSettings, resolution); 714 } 715 716 /** 717 * Sets the values of GTK_PRINT_SETTINGS_RESOLUTION, 718 * GTK_PRINT_SETTINGS_RESOLUTION_X and 719 * GTK_PRINT_SETTINGS_RESOLUTION_Y. 720 * Since 2.16 721 * Params: 722 * resolutionX = the horizontal resolution in dpi 723 * resolutionY = the vertical resolution in dpi 724 */ 725 public void setResolutionXy(int resolutionX, int resolutionY) 726 { 727 // void gtk_print_settings_set_resolution_xy (GtkPrintSettings *settings, gint resolution_x, gint resolution_y); 728 gtk_print_settings_set_resolution_xy(gtkPrintSettings, resolutionX, resolutionY); 729 } 730 731 /** 732 * Gets the value of GTK_PRINT_SETTINGS_RESOLUTION_X. 733 * Since 2.16 734 * Returns: the horizontal resolution in dpi 735 */ 736 public int getResolutionX() 737 { 738 // gint gtk_print_settings_get_resolution_x (GtkPrintSettings *settings); 739 return gtk_print_settings_get_resolution_x(gtkPrintSettings); 740 } 741 742 /** 743 * Gets the value of GTK_PRINT_SETTINGS_RESOLUTION_Y. 744 * Since 2.16 745 * Returns: the vertical resolution in dpi 746 */ 747 public int getResolutionY() 748 { 749 // gint gtk_print_settings_get_resolution_y (GtkPrintSettings *settings); 750 return gtk_print_settings_get_resolution_y(gtkPrintSettings); 751 } 752 753 /** 754 * Gets the value of GTK_PRINT_SETTINGS_PRINTER_LPI. 755 * Since 2.16 756 * Returns: the resolution in lpi (lines per inch) 757 */ 758 public double getPrinterLpi() 759 { 760 // gdouble gtk_print_settings_get_printer_lpi (GtkPrintSettings *settings); 761 return gtk_print_settings_get_printer_lpi(gtkPrintSettings); 762 } 763 764 /** 765 * Sets the value of GTK_PRINT_SETTINGS_PRINTER_LPI. 766 * Since 2.16 767 * Params: 768 * lpi = the resolution in lpi (lines per inch) 769 */ 770 public void setPrinterLpi(double lpi) 771 { 772 // void gtk_print_settings_set_printer_lpi (GtkPrintSettings *settings, gdouble lpi); 773 gtk_print_settings_set_printer_lpi(gtkPrintSettings, lpi); 774 } 775 776 /** 777 * Gets the value of GTK_PRINT_SETTINGS_SCALE. 778 * Since 2.10 779 * Returns: the scale in percent 780 */ 781 public double getScale() 782 { 783 // gdouble gtk_print_settings_get_scale (GtkPrintSettings *settings); 784 return gtk_print_settings_get_scale(gtkPrintSettings); 785 } 786 787 /** 788 * Sets the value of GTK_PRINT_SETTINGS_SCALE. 789 * Since 2.10 790 * Params: 791 * scale = the scale in percent 792 */ 793 public void setScale(double scale) 794 { 795 // void gtk_print_settings_set_scale (GtkPrintSettings *settings, gdouble scale); 796 gtk_print_settings_set_scale(gtkPrintSettings, scale); 797 } 798 799 /** 800 * Gets the value of GTK_PRINT_SETTINGS_PRINT_PAGES. 801 * Since 2.10 802 * Returns: which pages to print 803 */ 804 public GtkPrintPages getPrintPages() 805 { 806 // GtkPrintPages gtk_print_settings_get_print_pages (GtkPrintSettings *settings); 807 return gtk_print_settings_get_print_pages(gtkPrintSettings); 808 } 809 810 /** 811 * Sets the value of GTK_PRINT_SETTINGS_PRINT_PAGES. 812 * Since 2.10 813 * Params: 814 * pages = a GtkPrintPages value 815 */ 816 public void setPrintPages(GtkPrintPages pages) 817 { 818 // void gtk_print_settings_set_print_pages (GtkPrintSettings *settings, GtkPrintPages pages); 819 gtk_print_settings_set_print_pages(gtkPrintSettings, pages); 820 } 821 822 /** 823 * Gets the value of GTK_PRINT_SETTINGS_PAGE_RANGES. 824 * Since 2.10 825 * Returns: an array of GtkPageRanges. Use g_free() to free the array when it is no longer needed. [array length=num_ranges][transfer full] 826 */ 827 public GtkPageRange[] getPageRanges() 828 { 829 // GtkPageRange * gtk_print_settings_get_page_ranges (GtkPrintSettings *settings, gint *num_ranges); 830 int numRanges; 831 auto p = gtk_print_settings_get_page_ranges(gtkPrintSettings, &numRanges); 832 833 if(p is null) 834 { 835 return null; 836 } 837 838 return p[0 .. numRanges]; 839 } 840 841 /** 842 * Sets the value of GTK_PRINT_SETTINGS_PAGE_RANGES. 843 * Since 2.10 844 * Params: 845 * pageRanges = an array of GtkPageRanges. [array length=num_ranges] 846 */ 847 public void setPageRanges(GtkPageRange[] pageRanges) 848 { 849 // void gtk_print_settings_set_page_ranges (GtkPrintSettings *settings, GtkPageRange *page_ranges, gint num_ranges); 850 gtk_print_settings_set_page_ranges(gtkPrintSettings, pageRanges.ptr, cast(int) pageRanges.length); 851 } 852 853 /** 854 * Gets the value of GTK_PRINT_SETTINGS_PAGE_SET. 855 * Since 2.10 856 * Returns: the set of pages to print 857 */ 858 public GtkPageSet getPageSet() 859 { 860 // GtkPageSet gtk_print_settings_get_page_set (GtkPrintSettings *settings); 861 return gtk_print_settings_get_page_set(gtkPrintSettings); 862 } 863 864 /** 865 * Sets the value of GTK_PRINT_SETTINGS_PAGE_SET. 866 * Since 2.10 867 * Params: 868 * pageSet = a GtkPageSet value 869 */ 870 public void setPageSet(GtkPageSet pageSet) 871 { 872 // void gtk_print_settings_set_page_set (GtkPrintSettings *settings, GtkPageSet page_set); 873 gtk_print_settings_set_page_set(gtkPrintSettings, pageSet); 874 } 875 876 /** 877 * Gets the value of GTK_PRINT_SETTINGS_DEFAULT_SOURCE. 878 * Since 2.10 879 * Returns: the default source 880 */ 881 public string getDefaultSource() 882 { 883 // const gchar * gtk_print_settings_get_default_source (GtkPrintSettings *settings); 884 return Str.toString(gtk_print_settings_get_default_source(gtkPrintSettings)); 885 } 886 887 /** 888 * Sets the value of GTK_PRINT_SETTINGS_DEFAULT_SOURCE. 889 * Since 2.10 890 * Params: 891 * defaultSource = the default source 892 */ 893 public void setDefaultSource(string defaultSource) 894 { 895 // void gtk_print_settings_set_default_source (GtkPrintSettings *settings, const gchar *default_source); 896 gtk_print_settings_set_default_source(gtkPrintSettings, Str.toStringz(defaultSource)); 897 } 898 899 /** 900 * Gets the value of GTK_PRINT_SETTINGS_MEDIA_TYPE. 901 * The set of media types is defined in PWG 5101.1-2002 PWG. 902 * Since 2.10 903 * Returns: the media type 904 */ 905 public string getMediaType() 906 { 907 // const gchar * gtk_print_settings_get_media_type (GtkPrintSettings *settings); 908 return Str.toString(gtk_print_settings_get_media_type(gtkPrintSettings)); 909 } 910 911 /** 912 * Sets the value of GTK_PRINT_SETTINGS_MEDIA_TYPE. 913 * The set of media types is defined in PWG 5101.1-2002 PWG. 914 * Since 2.10 915 * Params: 916 * mediaType = the media type 917 */ 918 public void setMediaType(string mediaType) 919 { 920 // void gtk_print_settings_set_media_type (GtkPrintSettings *settings, const gchar *media_type); 921 gtk_print_settings_set_media_type(gtkPrintSettings, Str.toStringz(mediaType)); 922 } 923 924 /** 925 * Gets the value of GTK_PRINT_SETTINGS_DITHER. 926 * Since 2.10 927 * Returns: the dithering that is used 928 */ 929 public string getDither() 930 { 931 // const gchar * gtk_print_settings_get_dither (GtkPrintSettings *settings); 932 return Str.toString(gtk_print_settings_get_dither(gtkPrintSettings)); 933 } 934 935 /** 936 * Sets the value of GTK_PRINT_SETTINGS_DITHER. 937 * Since 2.10 938 * Params: 939 * dither = the dithering that is used 940 */ 941 public void setDither(string dither) 942 { 943 // void gtk_print_settings_set_dither (GtkPrintSettings *settings, const gchar *dither); 944 gtk_print_settings_set_dither(gtkPrintSettings, Str.toStringz(dither)); 945 } 946 947 /** 948 * Gets the value of GTK_PRINT_SETTINGS_FINISHINGS. 949 * Since 2.10 950 * Returns: the finishings 951 */ 952 public string getFinishings() 953 { 954 // const gchar * gtk_print_settings_get_finishings (GtkPrintSettings *settings); 955 return Str.toString(gtk_print_settings_get_finishings(gtkPrintSettings)); 956 } 957 958 /** 959 * Sets the value of GTK_PRINT_SETTINGS_FINISHINGS. 960 * Since 2.10 961 * Params: 962 * finishings = the finishings 963 */ 964 public void setFinishings(string finishings) 965 { 966 // void gtk_print_settings_set_finishings (GtkPrintSettings *settings, const gchar *finishings); 967 gtk_print_settings_set_finishings(gtkPrintSettings, Str.toStringz(finishings)); 968 } 969 970 /** 971 * Gets the value of GTK_PRINT_SETTINGS_OUTPUT_BIN. 972 * Since 2.10 973 * Returns: the output bin 974 */ 975 public string getOutputBin() 976 { 977 // const gchar * gtk_print_settings_get_output_bin (GtkPrintSettings *settings); 978 return Str.toString(gtk_print_settings_get_output_bin(gtkPrintSettings)); 979 } 980 981 /** 982 * Sets the value of GTK_PRINT_SETTINGS_OUTPUT_BIN. 983 * Since 2.10 984 * Params: 985 * outputBin = the output bin 986 */ 987 public void setOutputBin(string outputBin) 988 { 989 // void gtk_print_settings_set_output_bin (GtkPrintSettings *settings, const gchar *output_bin); 990 gtk_print_settings_set_output_bin(gtkPrintSettings, Str.toStringz(outputBin)); 991 } 992 993 /** 994 * Reads the print settings from file_name. Returns a new GtkPrintSettings 995 * object with the restored settings, or NULL if an error occurred. If the 996 * file could not be loaded then error is set to either a GFileError or 997 * GKeyFileError. See gtk_print_settings_to_file(). 998 * Since 2.12 999 * Params: 1000 * fileName = the filename to read the settings from 1001 * Throws: GException on failure. 1002 * Throws: ConstructionException GTK+ fails to create the object. 1003 */ 1004 public this (string fileName) 1005 { 1006 // GtkPrintSettings * gtk_print_settings_new_from_file (const gchar *file_name, GError **error); 1007 GError* err = null; 1008 1009 auto p = gtk_print_settings_new_from_file(Str.toStringz(fileName), &err); 1010 1011 if (err !is null) 1012 { 1013 throw new GException( new ErrorG(err) ); 1014 } 1015 1016 if(p is null) 1017 { 1018 throw new ConstructionException("null returned by gtk_print_settings_new_from_file(Str.toStringz(fileName), &err)"); 1019 } 1020 this(cast(GtkPrintSettings*) p); 1021 } 1022 1023 /** 1024 * Reads the print settings from the group group_name in key_file. Returns a 1025 * new GtkPrintSettings object with the restored settings, or NULL if an 1026 * error occurred. If the file could not be loaded then error is set to either 1027 * a GFileError or GKeyFileError. 1028 * Since 2.12 1029 * Params: 1030 * keyFile = the GKeyFile to retrieve the settings from 1031 * groupName = the name of the group to use, or NULL to use 1032 * the default "Print Settings". [allow-none] 1033 * Throws: GException on failure. 1034 * Throws: ConstructionException GTK+ fails to create the object. 1035 */ 1036 public this (KeyFile keyFile, string groupName) 1037 { 1038 // GtkPrintSettings * gtk_print_settings_new_from_key_file (GKeyFile *key_file, const gchar *group_name, GError **error); 1039 GError* err = null; 1040 1041 auto p = gtk_print_settings_new_from_key_file((keyFile is null) ? null : keyFile.getKeyFileStruct(), Str.toStringz(groupName), &err); 1042 1043 if (err !is null) 1044 { 1045 throw new GException( new ErrorG(err) ); 1046 } 1047 1048 if(p is null) 1049 { 1050 throw new ConstructionException("null returned by gtk_print_settings_new_from_key_file((keyFile is null) ? null : keyFile.getKeyFileStruct(), Str.toStringz(groupName), &err)"); 1051 } 1052 this(cast(GtkPrintSettings*) p); 1053 } 1054 1055 /** 1056 * Reads the print settings from file_name. If the file could not be loaded 1057 * then error is set to either a GFileError or GKeyFileError. 1058 * See gtk_print_settings_to_file(). 1059 * Since 2.14 1060 * Params: 1061 * fileName = the filename to read the settings from 1062 * Returns: TRUE on success 1063 * Throws: GException on failure. 1064 */ 1065 public int loadFile(string fileName) 1066 { 1067 // gboolean gtk_print_settings_load_file (GtkPrintSettings *settings, const gchar *file_name, GError **error); 1068 GError* err = null; 1069 1070 auto p = gtk_print_settings_load_file(gtkPrintSettings, Str.toStringz(fileName), &err); 1071 1072 if (err !is null) 1073 { 1074 throw new GException( new ErrorG(err) ); 1075 } 1076 1077 return p; 1078 } 1079 1080 /** 1081 * Reads the print settings from the group group_name in key_file. If the 1082 * file could not be loaded then error is set to either a GFileError or 1083 * GKeyFileError. 1084 * Since 2.14 1085 * Params: 1086 * keyFile = the GKeyFile to retrieve the settings from 1087 * groupName = the name of the group to use, or NULL to use the default 1088 * "Print Settings". [allow-none] 1089 * Returns: TRUE on success 1090 * Throws: GException on failure. 1091 */ 1092 public int loadKeyFile(KeyFile keyFile, string groupName) 1093 { 1094 // gboolean gtk_print_settings_load_key_file (GtkPrintSettings *settings, GKeyFile *key_file, const gchar *group_name, GError **error); 1095 GError* err = null; 1096 1097 auto p = gtk_print_settings_load_key_file(gtkPrintSettings, (keyFile is null) ? null : keyFile.getKeyFileStruct(), Str.toStringz(groupName), &err); 1098 1099 if (err !is null) 1100 { 1101 throw new GException( new ErrorG(err) ); 1102 } 1103 1104 return p; 1105 } 1106 1107 /** 1108 * This function saves the print settings from settings to file_name. If the 1109 * file could not be loaded then error is set to either a GFileError or 1110 * GKeyFileError. 1111 * Since 2.12 1112 * Params: 1113 * fileName = the file to save to 1114 * Returns: TRUE on success 1115 * Throws: GException on failure. 1116 */ 1117 public int toFile(string fileName) 1118 { 1119 // gboolean gtk_print_settings_to_file (GtkPrintSettings *settings, const gchar *file_name, GError **error); 1120 GError* err = null; 1121 1122 auto p = gtk_print_settings_to_file(gtkPrintSettings, Str.toStringz(fileName), &err); 1123 1124 if (err !is null) 1125 { 1126 throw new GException( new ErrorG(err) ); 1127 } 1128 1129 return p; 1130 } 1131 1132 /** 1133 * This function adds the print settings from settings to key_file. 1134 * Since 2.12 1135 * Params: 1136 * keyFile = the GKeyFile to save the print settings to 1137 * groupName = the group to add the settings to in key_file, or 1138 * NULL to use the default "Print Settings" 1139 */ 1140 public void toKeyFile(KeyFile keyFile, string groupName) 1141 { 1142 // void gtk_print_settings_to_key_file (GtkPrintSettings *settings, GKeyFile *key_file, const gchar *group_name); 1143 gtk_print_settings_to_key_file(gtkPrintSettings, (keyFile is null) ? null : keyFile.getKeyFileStruct(), Str.toStringz(groupName)); 1144 } 1145 }