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 = GtkSourcePrintCompositor.html 27 * outPack = gsv 28 * outFile = SourcePrintCompositor 29 * strct = GtkSourcePrintCompositor 30 * realStrct= 31 * ctorStrct= 32 * clss = SourcePrintCompositor 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_source_print_compositor_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - gsv.SourceBuffer 47 * - gsv.SourceView 48 * - gtk.PrintContext 49 * - glib.Str 50 * structWrap: 51 * - GtkPrintContext* -> PrintContext 52 * - GtkSourceBuffer* -> SourceBuffer 53 * - GtkSourceView* -> SourceView 54 * module aliases: 55 * local aliases: 56 * overrides: 57 */ 58 59 module gsv.SourcePrintCompositor; 60 61 public import gsvc.gsvtypes; 62 63 private import gsvc.gsv; 64 private import glib.ConstructionException; 65 private import gobject.ObjectG; 66 67 68 private import gsv.SourceBuffer; 69 private import gsv.SourceView; 70 private import gtk.PrintContext; 71 private import glib.Str; 72 73 74 75 private import gobject.ObjectG; 76 77 /** 78 * Description 79 * The GtkSourcePrintCompositor object is used to compose a GtkSourceBuffer 80 * for printing. You can set various configuration options to customize the 81 * printed output. GtkSourcePrintCompositor is designed to be used with the 82 * high-level printing API of gtk+, i.e. GtkPrintOperation. 83 * The margins specified in this object are the layout margins: they define the 84 * blank space bordering the printed area of the pages. They must not be 85 * confused with the "print margins", i.e. the parts of the page that the 86 * printer cannot print on, defined in the GtkPageSetup objects. If the 87 * specified layout margins are smaller than the "print margins", the latter 88 * ones are used as a fallback by the GtkSourcePrintCompositor object, so that 89 * the printed area is not clipped. 90 */ 91 public class SourcePrintCompositor : ObjectG 92 { 93 94 /** the main Gtk struct */ 95 protected GtkSourcePrintCompositor* gtkSourcePrintCompositor; 96 97 98 public GtkSourcePrintCompositor* getSourcePrintCompositorStruct() 99 { 100 return gtkSourcePrintCompositor; 101 } 102 103 104 /** the main Gtk struct as a void* */ 105 protected override void* getStruct() 106 { 107 return cast(void*)gtkSourcePrintCompositor; 108 } 109 110 /** 111 * Sets our main struct and passes it to the parent class 112 */ 113 public this (GtkSourcePrintCompositor* gtkSourcePrintCompositor) 114 { 115 super(cast(GObject*)gtkSourcePrintCompositor); 116 this.gtkSourcePrintCompositor = gtkSourcePrintCompositor; 117 } 118 119 protected override void setStruct(GObject* obj) 120 { 121 super.setStruct(obj); 122 gtkSourcePrintCompositor = cast(GtkSourcePrintCompositor*)obj; 123 } 124 125 /** 126 */ 127 128 /** 129 * Creates a new print compositor that can be used to print buffer. 130 * Since 2.2 131 * Params: 132 * buffer = the GtkSourceBuffer to print 133 * Throws: ConstructionException GTK+ fails to create the object. 134 */ 135 public this (SourceBuffer buffer) 136 { 137 // GtkSourcePrintCompositor * gtk_source_print_compositor_new (GtkSourceBuffer *buffer); 138 auto p = gtk_source_print_compositor_new((buffer is null) ? null : buffer.getSourceBufferStruct()); 139 if(p is null) 140 { 141 throw new ConstructionException("null returned by gtk_source_print_compositor_new((buffer is null) ? null : buffer.getSourceBufferStruct())"); 142 } 143 this(cast(GtkSourcePrintCompositor*) p); 144 } 145 146 /** 147 * Creates a new print compositor that can be used to print the buffer 148 * associated with view. 149 * This constructor sets some configuration properties to make the 150 * printed output match view as much as possible. The properties set are 151 * "tab-width", "highlight-syntax", 152 * "wrap-mode", "body-font-name" and 153 * "print-line-numbers". 154 * Since 2.2 155 * Params: 156 * view = a GtkSourceView to get configuration from. 157 * Throws: ConstructionException GTK+ fails to create the object. 158 */ 159 public this (SourceView view) 160 { 161 // GtkSourcePrintCompositor * gtk_source_print_compositor_new_from_view (GtkSourceView *view); 162 auto p = gtk_source_print_compositor_new_from_view((view is null) ? null : view.getSourceViewStruct()); 163 if(p is null) 164 { 165 throw new ConstructionException("null returned by gtk_source_print_compositor_new_from_view((view is null) ? null : view.getSourceViewStruct())"); 166 } 167 this(cast(GtkSourcePrintCompositor*) p); 168 } 169 170 /** 171 * Gets the GtkSourceBuffer associated with the compositor. The returned 172 * object reference is owned by the compositor object and 173 * should not be unreferenced. 174 * Since 2.2 175 * Returns: the GtkSourceBuffer associated with the compositor. 176 */ 177 public SourceBuffer getBuffer() 178 { 179 // GtkSourceBuffer * gtk_source_print_compositor_get_buffer (GtkSourcePrintCompositor *compositor); 180 auto p = gtk_source_print_compositor_get_buffer(gtkSourcePrintCompositor); 181 182 if(p is null) 183 { 184 return null; 185 } 186 187 return ObjectG.getDObject!(SourceBuffer)(cast(GtkSourceBuffer*) p); 188 } 189 190 /** 191 * Sets the width of tabulation in characters for printed text. 192 * This function cannot be called anymore after the first call to the 193 * gtk_source_print_compositor_paginate() function. 194 * Since 2.2 195 * Params: 196 * width = width of tab in characters. 197 */ 198 public void setTabWidth(uint width) 199 { 200 // void gtk_source_print_compositor_set_tab_width (GtkSourcePrintCompositor *compositor, guint width); 201 gtk_source_print_compositor_set_tab_width(gtkSourcePrintCompositor, width); 202 } 203 204 /** 205 * Returns the width of tabulation in characters for printed text. 206 * Since 2.2 207 * Returns: width of tab. 208 */ 209 public uint getTabWidth() 210 { 211 // guint gtk_source_print_compositor_get_tab_width (GtkSourcePrintCompositor *compositor); 212 return gtk_source_print_compositor_get_tab_width(gtkSourcePrintCompositor); 213 } 214 215 /** 216 * Sets the line wrapping mode for the printed text. 217 * This function cannot be called anymore after the first call to the 218 * gtk_source_print_compositor_paginate() function. 219 * Since 2.2 220 * Params: 221 * wrapMode = a GtkWrapMode. 222 */ 223 public void setWrapMode(GtkWrapMode wrapMode) 224 { 225 // void gtk_source_print_compositor_set_wrap_mode (GtkSourcePrintCompositor *compositor, GtkWrapMode wrap_mode); 226 gtk_source_print_compositor_set_wrap_mode(gtkSourcePrintCompositor, wrapMode); 227 } 228 229 /** 230 * Gets the line wrapping mode for the printed text. 231 * Since 2.2 232 * Returns: the line wrap mode. 233 */ 234 public GtkWrapMode getWrapMode() 235 { 236 // GtkWrapMode gtk_source_print_compositor_get_wrap_mode (GtkSourcePrintCompositor *compositor); 237 return gtk_source_print_compositor_get_wrap_mode(gtkSourcePrintCompositor); 238 } 239 240 /** 241 * Sets whether the printed text will be highlighted according to the 242 * buffer rules. Both color and font style are applied. 243 * This function cannot be called anymore after the first call to the 244 * gtk_source_print_compositor_paginate() function. 245 * Since 2.2 246 * Params: 247 * highlight = whether syntax should be highlighted. 248 */ 249 public void setHighlightSyntax(int highlight) 250 { 251 // void gtk_source_print_compositor_set_highlight_syntax (GtkSourcePrintCompositor *compositor, gboolean highlight); 252 gtk_source_print_compositor_set_highlight_syntax(gtkSourcePrintCompositor, highlight); 253 } 254 255 /** 256 * Determines whether the printed text will be highlighted according to the 257 * buffer rules. Note that highlighting will happen 258 * only if the buffer to print has highlighting activated. 259 * Since 2.2 260 * Returns: TRUE if the printed output will be highlighted. 261 */ 262 public int getHighlightSyntax() 263 { 264 // gboolean gtk_source_print_compositor_get_highlight_syntax (GtkSourcePrintCompositor *compositor); 265 return gtk_source_print_compositor_get_highlight_syntax(gtkSourcePrintCompositor); 266 } 267 268 /** 269 * Sets the interval for printed line numbers. If interval is 0 no 270 * numbers will be printed. If greater than 0, a number will be 271 * printed every interval lines (i.e. 1 will print all line numbers). 272 * Maximum accepted value for interval is 100. 273 * This function cannot be called anymore after the first call to the 274 * gtk_source_print_compositor_paginate() function. 275 * Since 2.2 276 * Params: 277 * interval = interval for printed line numbers. 278 */ 279 public void setPrintLineNumbers(uint interval) 280 { 281 // void gtk_source_print_compositor_set_print_line_numbers (GtkSourcePrintCompositor *compositor, guint interval); 282 gtk_source_print_compositor_set_print_line_numbers(gtkSourcePrintCompositor, interval); 283 } 284 285 /** 286 * Returns the interval used for line number printing. If the 287 * value is 0, no line numbers will be printed. The default value is 288 * 1 (i.e. numbers printed in all lines). 289 * Since 2.2 290 * Returns: the interval of printed line numbers. 291 */ 292 public uint getPrintLineNumbers() 293 { 294 // guint gtk_source_print_compositor_get_print_line_numbers (GtkSourcePrintCompositor *compositor); 295 return gtk_source_print_compositor_get_print_line_numbers(gtkSourcePrintCompositor); 296 } 297 298 /** 299 * Sets the default font for the printed text. 300 * font_name should be a 301 * string representation of a font description Pango can understand. 302 * (e.g. "Monospace 10"). See pango_font_description_from_string() 303 * for a description of the format of the string representation. 304 * This function cannot be called anymore after the first call to the 305 * gtk_source_print_compositor_paginate() function. 306 * Since 2.2 307 * Params: 308 * fontName = the name of the default font for the body text. 309 */ 310 public void setBodyFontName(string fontName) 311 { 312 // void gtk_source_print_compositor_set_body_font_name (GtkSourcePrintCompositor *compositor, const gchar *font_name); 313 gtk_source_print_compositor_set_body_font_name(gtkSourcePrintCompositor, Str.toStringz(fontName)); 314 } 315 316 /** 317 * Returns the name of the font used to print the text body. The returned string 318 * must be freed with g_free(). 319 * Since 2.2 320 * Returns: a new string containing the name of the font used to print the text body. 321 */ 322 public string getBodyFontName() 323 { 324 // gchar * gtk_source_print_compositor_get_body_font_name (GtkSourcePrintCompositor *compositor); 325 return Str.toString(gtk_source_print_compositor_get_body_font_name(gtkSourcePrintCompositor)); 326 } 327 328 /** 329 * Sets the font for printing line numbers on the left margin. If 330 * NULL is supplied, the default font (i.e. the one being used for the 331 * text) will be used instead. 332 * font_name should be a 333 * string representation of a font description Pango can understand. 334 * (e.g. "Monospace 10"). See pango_font_description_from_string() 335 * for a description of the format of the string representation. 336 * This function cannot be called anymore after the first call to the 337 * gtk_source_print_compositor_paginate() function. 338 * Since 2.2 339 * Params: 340 * fontName = the name of the font for line numbers, or NULL. 341 */ 342 public void setLineNumbersFontName(string fontName) 343 { 344 // void gtk_source_print_compositor_set_line_numbers_font_name (GtkSourcePrintCompositor *compositor, const gchar *font_name); 345 gtk_source_print_compositor_set_line_numbers_font_name(gtkSourcePrintCompositor, Str.toStringz(fontName)); 346 } 347 348 /** 349 * Returns the name of the font used to print line numbers on the left margin. 350 * The returned string must be freed with g_free()) 351 * Since 2.2 352 * Returns: a new string containing the name of the font used to print line numbers on the left margin. 353 */ 354 public string getLineNumbersFontName() 355 { 356 // gchar * gtk_source_print_compositor_get_line_numbers_font_name (GtkSourcePrintCompositor *compositor); 357 return Str.toString(gtk_source_print_compositor_get_line_numbers_font_name(gtkSourcePrintCompositor)); 358 } 359 360 /** 361 * Sets the font for printing the page header. If 362 * NULL is supplied, the default font (i.e. the one being used for the 363 * text) will be used instead. 364 * font_name should be a 365 * string representation of a font description Pango can understand. 366 * (e.g. "Monospace 10"). See pango_font_description_from_string() 367 * for a description of the format of the string representation. 368 * This function cannot be called anymore after the first call to the 369 * gtk_source_print_compositor_paginate() function. 370 * Since 2.2 371 * Params: 372 * fontName = the name of the font for header text, or NULL. 373 */ 374 public void setHeaderFontName(string fontName) 375 { 376 // void gtk_source_print_compositor_set_header_font_name (GtkSourcePrintCompositor *compositor, const gchar *font_name); 377 gtk_source_print_compositor_set_header_font_name(gtkSourcePrintCompositor, Str.toStringz(fontName)); 378 } 379 380 /** 381 * Returns the name of the font used to print the page header. 382 * The returned string must be freed with g_free()) 383 * Since 2.2 384 * Returns: a new string containing the name of the font used to print the page header. 385 */ 386 public string getHeaderFontName() 387 { 388 // gchar * gtk_source_print_compositor_get_header_font_name (GtkSourcePrintCompositor *compositor); 389 return Str.toString(gtk_source_print_compositor_get_header_font_name(gtkSourcePrintCompositor)); 390 } 391 392 /** 393 * Sets the font for printing the page footer. If 394 * NULL is supplied, the default font (i.e. the one being used for the 395 * text) will be used instead. 396 * font_name should be a 397 * string representation of a font description Pango can understand. 398 * (e.g. "Monospace 10"). See pango_font_description_from_string() 399 * for a description of the format of the string representation. 400 * This function cannot be called anymore after the first call to the 401 * gtk_source_print_compositor_paginate() function. 402 * Since 2.2 403 * Params: 404 * fontName = the name of the font for the footer text, or NULL. 405 */ 406 public void setFooterFontName(string fontName) 407 { 408 // void gtk_source_print_compositor_set_footer_font_name (GtkSourcePrintCompositor *compositor, const gchar *font_name); 409 gtk_source_print_compositor_set_footer_font_name(gtkSourcePrintCompositor, Str.toStringz(fontName)); 410 } 411 412 /** 413 * Returns the name of the font used to print the page footer. 414 * The returned string must be freed with g_free()) 415 * Since 2.2 416 * Returns: a new string containing the name of the font used to print the page footer. 417 */ 418 public string getFooterFontName() 419 { 420 // gchar * gtk_source_print_compositor_get_footer_font_name (GtkSourcePrintCompositor *compositor); 421 return Str.toString(gtk_source_print_compositor_get_footer_font_name(gtkSourcePrintCompositor)); 422 } 423 424 /** 425 * Gets the top margin in units of unit. 426 * Since 2.2 427 * Params: 428 * unit = the unit for the return value. 429 * Returns: the top margin. 430 */ 431 public double getTopMargin(GtkUnit unit) 432 { 433 // gdouble gtk_source_print_compositor_get_top_margin (GtkSourcePrintCompositor *compositor, GtkUnit unit); 434 return gtk_source_print_compositor_get_top_margin(gtkSourcePrintCompositor, unit); 435 } 436 437 /** 438 * Sets the top margin used by compositor. 439 * Since 2.2 440 * Params: 441 * margin = the new top margin in units of unit 442 * unit = the units for margin 443 */ 444 public void setTopMargin(double margin, GtkUnit unit) 445 { 446 // void gtk_source_print_compositor_set_top_margin (GtkSourcePrintCompositor *compositor, gdouble margin, GtkUnit unit); 447 gtk_source_print_compositor_set_top_margin(gtkSourcePrintCompositor, margin, unit); 448 } 449 450 /** 451 * Gets the bottom margin in units of unit. 452 * Since 2.2 453 * Params: 454 * unit = the unit for the return value. 455 * Returns: the bottom margin. 456 */ 457 public double getBottomMargin(GtkUnit unit) 458 { 459 // gdouble gtk_source_print_compositor_get_bottom_margin (GtkSourcePrintCompositor *compositor, GtkUnit unit); 460 return gtk_source_print_compositor_get_bottom_margin(gtkSourcePrintCompositor, unit); 461 } 462 463 /** 464 * Sets the bottom margin used by compositor. 465 * Since 2.2 466 * Params: 467 * margin = the new bottom margin in units of unit 468 * unit = the units for margin 469 */ 470 public void setBottomMargin(double margin, GtkUnit unit) 471 { 472 // void gtk_source_print_compositor_set_bottom_margin (GtkSourcePrintCompositor *compositor, gdouble margin, GtkUnit unit); 473 gtk_source_print_compositor_set_bottom_margin(gtkSourcePrintCompositor, margin, unit); 474 } 475 476 /** 477 * Gets the left margin in units of unit. 478 * Since 2.2 479 * Params: 480 * unit = the unit for the return value. 481 * Returns: the left margin 482 */ 483 public double getLeftMargin(GtkUnit unit) 484 { 485 // gdouble gtk_source_print_compositor_get_left_margin (GtkSourcePrintCompositor *compositor, GtkUnit unit); 486 return gtk_source_print_compositor_get_left_margin(gtkSourcePrintCompositor, unit); 487 } 488 489 /** 490 * Sets the left margin used by compositor. 491 * Since 2.2 492 * Params: 493 * margin = the new left margin in units of unit 494 * unit = the units for margin 495 */ 496 public void setLeftMargin(double margin, GtkUnit unit) 497 { 498 // void gtk_source_print_compositor_set_left_margin (GtkSourcePrintCompositor *compositor, gdouble margin, GtkUnit unit); 499 gtk_source_print_compositor_set_left_margin(gtkSourcePrintCompositor, margin, unit); 500 } 501 502 /** 503 * Gets the right margin in units of unit. 504 * Since 2.2 505 * Params: 506 * unit = the unit for the return value. 507 * Returns: the right margin 508 */ 509 public double getRightMargin(GtkUnit unit) 510 { 511 // gdouble gtk_source_print_compositor_get_right_margin (GtkSourcePrintCompositor *compositor, GtkUnit unit); 512 return gtk_source_print_compositor_get_right_margin(gtkSourcePrintCompositor, unit); 513 } 514 515 /** 516 * Sets the right margin used by compositor. 517 * Since 2.2 518 * Params: 519 * margin = the new right margin in units of unit 520 * unit = the units for margin 521 */ 522 public void setRightMargin(double margin, GtkUnit unit) 523 { 524 // void gtk_source_print_compositor_set_right_margin (GtkSourcePrintCompositor *compositor, gdouble margin, GtkUnit unit); 525 gtk_source_print_compositor_set_right_margin(gtkSourcePrintCompositor, margin, unit); 526 } 527 528 /** 529 * Sets whether you want to print a header in each page. The 530 * header consists of three pieces of text and an optional line 531 * separator, configurable with 532 * gtk_source_print_compositor_set_header_format(). 533 * Note that by default the header format is unspecified, and if it's 534 * empty it will not be printed, regardless of this setting. 535 * This function cannot be called anymore after the first call to the 536 * gtk_source_print_compositor_paginate() function. 537 * Since 2.2 538 * Params: 539 * print = TRUE if you want the header to be printed. 540 */ 541 public void setPrintHeader(int print) 542 { 543 // void gtk_source_print_compositor_set_print_header (GtkSourcePrintCompositor *compositor, gboolean print); 544 gtk_source_print_compositor_set_print_header(gtkSourcePrintCompositor, print); 545 } 546 547 /** 548 * Determines if a header is set to be printed for each page. A 549 * header will be printed if this function returns TRUE 550 * and some format strings have been specified 551 * with gtk_source_print_compositor_set_header_format(). 552 * Since 2.2 553 * Returns: TRUE if the header is set to be printed. 554 */ 555 public int getPrintHeader() 556 { 557 // gboolean gtk_source_print_compositor_get_print_header (GtkSourcePrintCompositor *compositor); 558 return gtk_source_print_compositor_get_print_header(gtkSourcePrintCompositor); 559 } 560 561 /** 562 * Sets whether you want to print a footer in each page. The 563 * footer consists of three pieces of text and an optional line 564 * separator, configurable with 565 * gtk_source_print_compositor_set_footer_format(). 566 * Note that by default the footer format is unspecified, and if it's 567 * empty it will not be printed, regardless of this setting. 568 * This function cannot be called anymore after the first call to the 569 * gtk_source_print_compositor_paginate() function. 570 * Since 2.2 571 * Params: 572 * print = TRUE if you want the footer to be printed. 573 */ 574 public void setPrintFooter(int print) 575 { 576 // void gtk_source_print_compositor_set_print_footer (GtkSourcePrintCompositor *compositor, gboolean print); 577 gtk_source_print_compositor_set_print_footer(gtkSourcePrintCompositor, print); 578 } 579 580 /** 581 * Determines if a footer is set to be printed for each page. A 582 * footer will be printed if this function returns TRUE 583 * and some format strings have been specified 584 * with gtk_source_print_compositor_set_footer_format(). 585 * Since 2.2 586 * Returns: TRUE if the footer is set to be printed. 587 */ 588 public int getPrintFooter() 589 { 590 // gboolean gtk_source_print_compositor_get_print_footer (GtkSourcePrintCompositor *compositor); 591 return gtk_source_print_compositor_get_print_footer(gtkSourcePrintCompositor); 592 } 593 594 /** 595 * Sets strftime like header format strings, to be printed on the 596 * left, center and right of the top of each page. The strings may 597 * include strftime(3) codes which will be expanded at print time. 598 * All strftime() codes are accepted, with the addition of N for the 599 * page number and Q for the page count. 600 * separator specifies if a solid line should be drawn to separate 601 * the header from the document text. 602 * If NULL is given for any of the three arguments, that particular 603 * string will not be printed. 604 * For the header to be printed, in 605 * addition to specifying format strings, you need to enable header 606 * printing with gtk_source_print_compositor_set_print_header(). 607 * This function cannot be called anymore after the first call to the 608 * gtk_source_print_compositor_paginate() function. 609 * Since 2.2 610 * Params: 611 * separator = TRUE if you want a separator line to be printed. 612 * left = a format string to print on the left of the header. 613 * center = a format string to print on the center of the header. 614 * right = a format string to print on the right of the header. 615 */ 616 public void setHeaderFormat(int separator, string left, string center, string right) 617 { 618 // void gtk_source_print_compositor_set_header_format (GtkSourcePrintCompositor *compositor, gboolean separator, const gchar *left, const gchar *center, const gchar *right); 619 gtk_source_print_compositor_set_header_format(gtkSourcePrintCompositor, separator, Str.toStringz(left), Str.toStringz(center), Str.toStringz(right)); 620 } 621 622 /** 623 * Sets strftime like header format strings, to be printed on the 624 * left, center and right of the bottom of each page. The strings may 625 * include strftime(3) codes which will be expanded at print time. 626 * All strftime() codes are accepted, with the addition of N for the 627 * page number and Q for the page count. 628 * separator specifies if a solid line should be drawn to separate 629 * the footer from the document text. 630 * If NULL is given for any of the three arguments, that particular 631 * string will not be printed. 632 * For the footer to be printed, in 633 * addition to specifying format strings, you need to enable footer 634 * printing with gtk_source_print_compositor_set_print_footer(). 635 * This function cannot be called anymore after the first call to the 636 * gtk_source_print_compositor_paginate() function. 637 * Since 2.2 638 * Params: 639 * separator = TRUE if you want a separator line to be printed. 640 * left = a format string to print on the left of the footer. 641 * center = a format string to print on the center of the footer. 642 * right = a format string to print on the right of the footer. 643 */ 644 public void setFooterFormat(int separator, string left, string center, string right) 645 { 646 // void gtk_source_print_compositor_set_footer_format (GtkSourcePrintCompositor *compositor, gboolean separator, const gchar *left, const gchar *center, const gchar *right); 647 gtk_source_print_compositor_set_footer_format(gtkSourcePrintCompositor, separator, Str.toStringz(left), Str.toStringz(center), Str.toStringz(right)); 648 } 649 650 /** 651 * Returns the number of pages in the document or -1 if the 652 * document has not been completely paginated. 653 * Since 2.2 654 * Returns: the number of pages in the document or -1 if the document has not been completely paginated. 655 */ 656 public int getNPages() 657 { 658 // gint gtk_source_print_compositor_get_n_pages (GtkSourcePrintCompositor *compositor); 659 return gtk_source_print_compositor_get_n_pages(gtkSourcePrintCompositor); 660 } 661 662 /** 663 * Paginate the document associated with the compositor. 664 * In order to support non-blocking pagination, document is paginated in small chunks. 665 * Each time gtk_source_print_compositor_paginate() is invoked, a chunk of the document 666 * is paginated. To paginate the entire document, gtk_source_print_compositor_paginate() 667 * must be invoked multiple times. 668 * It returns TRUE if the document has been completely paginated, otherwise it returns FALSE. 669 * This method has been designed to be invoked in the handler of the "paginate" signal, 670 * Since 2.2 671 * Params: 672 * context = the GtkPrintContext whose parameters (e.g. paper size, print margins, etc.) 673 * are used by the the compositor to paginate the document. 674 * Returns: TRUE if the document has been completely paginated, FALSE otherwise. 675 */ 676 public int paginate(PrintContext context) 677 { 678 // gboolean gtk_source_print_compositor_paginate (GtkSourcePrintCompositor *compositor, GtkPrintContext *context); 679 return gtk_source_print_compositor_paginate(gtkSourcePrintCompositor, (context is null) ? null : context.getPrintContextStruct()); 680 } 681 682 /** 683 * Returns the current fraction of the document pagination that has been completed. 684 * Since 2.2 685 * Returns: a fraction from 0.0 to 1.0 inclusive 686 */ 687 public double getPaginationProgress() 688 { 689 // gdouble gtk_source_print_compositor_get_pagination_progress (GtkSourcePrintCompositor *compositor); 690 return gtk_source_print_compositor_get_pagination_progress(gtkSourcePrintCompositor); 691 } 692 693 /** 694 * Draw page page_nr for printing on the the Cairo context encapsuled in context. 695 * This method has been designed to be called in the handler of the "draw_page" signal 696 * Params: 697 * context = the GtkPrintContext encapsulating the context information that is required when 698 * drawing the page for printing. 699 * pageNr = the number of the page to print. 700 */ 701 public void drawPage(PrintContext context, int pageNr) 702 { 703 // void gtk_source_print_compositor_draw_page (GtkSourcePrintCompositor *compositor, GtkPrintContext *context, gint page_nr); 704 gtk_source_print_compositor_draw_page(gtkSourcePrintCompositor, (context is null) ? null : context.getPrintContextStruct(), pageNr); 705 } 706 }