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