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