1 // Generated by gmmproc 2.60.0 -- DO NOT MODIFY! 2 #ifndef _GTKMM_PRINTOPERATION_H 3 #define _GTKMM_PRINTOPERATION_H 4 5 6 #include <glibmm/ustring.h> 7 #include <sigc++/sigc++.h> 8 9 /* Copyright (C) 2006 The gtkmm Development Team 10 * 11 * This library is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU Lesser General Public 13 * License as published by the Free Software Foundation; either 14 * version 2.1 of the License, or (at your option) any later version. 15 * 16 * This library is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 * Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public 22 * License along with this library; if not, write to the Free Software 23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 24 */ 25 26 #include <glibmm/object.h> 27 28 #include <gtkmm/pagesetup.h> 29 #include <gtkmm/printcontext.h> 30 #include <gtkmm/printoperationpreview.h> 31 #include <gtkmm/printsettings.h> 32 #include <gtkmm/window.h> 33 34 35 #ifndef DOXYGEN_SHOULD_SKIP_THIS 36 using GtkPrintOperation = struct _GtkPrintOperation; 37 using GtkPrintOperationClass = struct _GtkPrintOperationClass; 38 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 39 40 41 #ifndef DOXYGEN_SHOULD_SKIP_THIS 42 namespace Gtk 43 { class PrintOperation_Class; } // namespace Gtk 44 #endif //DOXYGEN_SHOULD_SKIP_THIS 45 46 namespace Gtk 47 { 48 49 /** @addtogroup gtkmmEnums gtkmm Enums and Flags */ 50 51 /** 52 * @var PrintStatus PRINT_STATUS_INITIAL 53 * The printing has not started yet; this 54 * status is set initially, and while the print dialog is shown. 55 * 56 * @var PrintStatus PRINT_STATUS_PREPARING 57 * This status is set while the begin-print 58 * signal is emitted and during pagination. 59 * 60 * @var PrintStatus PRINT_STATUS_GENERATING_DATA 61 * This status is set while the 62 * pages are being rendered. 63 * 64 * @var PrintStatus PRINT_STATUS_SENDING_DATA 65 * The print job is being sent off to the 66 * printer. 67 * 68 * @var PrintStatus PRINT_STATUS_PENDING 69 * The print job has been sent to the printer, 70 * but is not printed for some reason, e.g. the printer may be stopped. 71 * 72 * @var PrintStatus PRINT_STATUS_PENDING_ISSUE 73 * Some problem has occurred during 74 * printing, e.g. a paper jam. 75 * 76 * @var PrintStatus PRINT_STATUS_PRINTING 77 * The printer is processing the print job. 78 * 79 * @var PrintStatus PRINT_STATUS_FINISHED 80 * The printing has been completed successfully. 81 * 82 * @var PrintStatus PRINT_STATUS_FINISHED_ABORTED 83 * The printing has been aborted. 84 * 85 * @enum PrintStatus 86 * 87 * The status gives a rough indication of the completion of a running 88 * print operation. 89 * 90 * @ingroup gtkmmEnums 91 */ 92 enum PrintStatus 93 { 94 PRINT_STATUS_INITIAL, 95 PRINT_STATUS_PREPARING, 96 PRINT_STATUS_GENERATING_DATA, 97 PRINT_STATUS_SENDING_DATA, 98 PRINT_STATUS_PENDING, 99 PRINT_STATUS_PENDING_ISSUE, 100 PRINT_STATUS_PRINTING, 101 PRINT_STATUS_FINISHED, 102 PRINT_STATUS_FINISHED_ABORTED 103 }; 104 105 } // namespace Gtk 106 107 #ifndef DOXYGEN_SHOULD_SKIP_THIS 108 namespace Glib 109 { 110 111 template <> 112 class Value<Gtk::PrintStatus> : public Glib::Value_Enum<Gtk::PrintStatus> 113 { 114 public: 115 static GType value_type() G_GNUC_CONST; 116 }; 117 118 } // namespace Glib 119 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 120 121 namespace Gtk 122 { 123 124 /** 125 * @var PrintOperationResult PRINT_OPERATION_RESULT_ERROR 126 * An error has occurred. 127 * 128 * @var PrintOperationResult PRINT_OPERATION_RESULT_APPLY 129 * The print settings should be stored. 130 * 131 * @var PrintOperationResult PRINT_OPERATION_RESULT_CANCEL 132 * The print operation has been canceled, 133 * the print settings should not be stored. 134 * 135 * @var PrintOperationResult PRINT_OPERATION_RESULT_IN_PROGRESS 136 * The print operation is not complete 137 * yet. This value will only be returned when running asynchronously. 138 * 139 * @enum PrintOperationResult 140 * 141 * A value of this type is returned by Gtk::PrintOperation::run(). 142 * 143 * @ingroup gtkmmEnums 144 */ 145 enum PrintOperationResult 146 { 147 PRINT_OPERATION_RESULT_ERROR, 148 PRINT_OPERATION_RESULT_APPLY, 149 PRINT_OPERATION_RESULT_CANCEL, 150 PRINT_OPERATION_RESULT_IN_PROGRESS 151 }; 152 153 } // namespace Gtk 154 155 #ifndef DOXYGEN_SHOULD_SKIP_THIS 156 namespace Glib 157 { 158 159 template <> 160 class Value<Gtk::PrintOperationResult> : public Glib::Value_Enum<Gtk::PrintOperationResult> 161 { 162 public: 163 static GType value_type() G_GNUC_CONST; 164 }; 165 166 } // namespace Glib 167 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 168 169 namespace Gtk 170 { 171 172 /** 173 * @var PrintOperationAction PRINT_OPERATION_ACTION_PRINT_DIALOG 174 * Show the print dialog. 175 * 176 * @var PrintOperationAction PRINT_OPERATION_ACTION_PRINT 177 * Start to print without showing 178 * the print dialog, based on the current print settings. 179 * 180 * @var PrintOperationAction PRINT_OPERATION_ACTION_PREVIEW 181 * Show the print preview. 182 * 183 * @var PrintOperationAction PRINT_OPERATION_ACTION_EXPORT 184 * Export to a file. This requires 185 * the export-filename property to be set. 186 * 187 * @enum PrintOperationAction 188 * 189 * The @a action parameter to Gtk::PrintOperation::run() 190 * determines what action the print operation should perform. 191 * 192 * @ingroup gtkmmEnums 193 */ 194 enum PrintOperationAction 195 { 196 PRINT_OPERATION_ACTION_PRINT_DIALOG, 197 PRINT_OPERATION_ACTION_PRINT, 198 PRINT_OPERATION_ACTION_PREVIEW, 199 PRINT_OPERATION_ACTION_EXPORT 200 }; 201 202 } // namespace Gtk 203 204 #ifndef DOXYGEN_SHOULD_SKIP_THIS 205 namespace Glib 206 { 207 208 template <> 209 class Value<Gtk::PrintOperationAction> : public Glib::Value_Enum<Gtk::PrintOperationAction> 210 { 211 public: 212 static GType value_type() G_GNUC_CONST; 213 }; 214 215 } // namespace Glib 216 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 217 218 namespace Gtk 219 { 220 221 class PrintError : public Glib::Error 222 { 223 public: 224 /** @var Code GENERAL 225 * An unspecified error occurred. 226 * 227 * @var Code INTERNAL_ERROR 228 * An internal error occurred. 229 * 230 * @var Code NOMEM 231 * A memory allocation failed. 232 * 233 * @var Code INVALID_FILE 234 * An error occurred while loading a page setup 235 * or paper size from a key file. 236 * 237 * @enum Code 238 * 239 * %Error codes that identify various errors that can occur while 240 * using the GTK+ printing support. 241 */ 242 enum Code 243 { 244 GENERAL, 245 INTERNAL_ERROR, 246 NOMEM, 247 INVALID_FILE 248 }; 249 250 PrintError(Code error_code, const Glib::ustring& error_message); 251 explicit PrintError(GError* gobject); 252 Code code() const; 253 254 #ifndef DOXYGEN_SHOULD_SKIP_THIS 255 private: 256 257 static void throw_func(GError* gobject); 258 259 friend void wrap_init(); // uses throw_func() 260 261 #endif //DOXYGEN_SHOULD_SKIP_THIS 262 }; 263 264 } // namespace Gtk 265 266 #ifndef DOXYGEN_SHOULD_SKIP_THIS 267 namespace Glib 268 { 269 270 template <> 271 class Value<Gtk::PrintError::Code> : public Glib::Value_Enum<Gtk::PrintError::Code> 272 { 273 public: 274 static GType value_type() G_GNUC_CONST; 275 }; 276 277 } // namespace Glib 278 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 279 280 namespace Gtk 281 { 282 283 284 /** @defgroup Printing Printing 285 */ 286 287 /** PrintOperation is the high-level, portable printing API. It looks a bit different than other 288 * GTK+ dialogs such as the FileChooser, since some platforms don't expose enough infrastructure 289 * to implement a good print dialog. On such platforms, PrintOperation uses the native print 290 * dialog. On platforms which do not provide a native print dialog, GTK+ uses its own, see PrintUnixDialog. 291 * 292 * The typical way to use the high-level printing API is to create a PrintOperation object 293 * when the user chooses to print. Then you set some properties on it,such as the page size, any PrintSettings 294 * from previous print operations, the number of pages, the current page, etc. 295 * 296 * Then you start the print operation by calling run(). It will then show a dialog to 297 * let the user select a printer and options. When the user finishes the dialog various signals will be 298 * emitted by the PrintOperation for you to handle, the main one being draw_page. You should then 299 * render the page on the provided PrintContext using Cairo. 300 * 301 * @newin{2,10} 302 * 303 * @ingroup Printing 304 */ 305 306 class PrintOperation : 307 public Glib::Object, 308 public PrintOperationPreview 309 { 310 311 #ifndef DOXYGEN_SHOULD_SKIP_THIS 312 313 public: 314 using CppObjectType = PrintOperation; 315 using CppClassType = PrintOperation_Class; 316 using BaseObjectType = GtkPrintOperation; 317 using BaseClassType = GtkPrintOperationClass; 318 319 // noncopyable 320 PrintOperation(const PrintOperation&) = delete; 321 PrintOperation& operator=(const PrintOperation&) = delete; 322 323 private: friend class PrintOperation_Class; 324 static CppClassType printoperation_class_; 325 326 protected: 327 explicit PrintOperation(const Glib::ConstructParams& construct_params); 328 explicit PrintOperation(GtkPrintOperation* castitem); 329 330 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 331 332 public: 333 334 PrintOperation(PrintOperation&& src) noexcept; 335 PrintOperation& operator=(PrintOperation&& src) noexcept; 336 337 ~PrintOperation() noexcept override; 338 339 /** Get the GType for this class, for use with the underlying GObject type system. 340 */ 341 static GType get_type() G_GNUC_CONST; 342 343 #ifndef DOXYGEN_SHOULD_SKIP_THIS 344 345 346 static GType get_base_type() G_GNUC_CONST; 347 #endif 348 349 ///Provides access to the underlying C GObject. gobj()350 GtkPrintOperation* gobj() { return reinterpret_cast<GtkPrintOperation*>(gobject_); } 351 352 ///Provides access to the underlying C GObject. gobj()353 const GtkPrintOperation* gobj() const { return reinterpret_cast<GtkPrintOperation*>(gobject_); } 354 355 ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. 356 GtkPrintOperation* gobj_copy(); 357 358 private: 359 360 361 protected: 362 PrintOperation(); 363 364 public: 365 366 static Glib::RefPtr<PrintOperation> create(); 367 368 369 /** Makes @a default_page_setup the default page setup for @a op. 370 * 371 * This page setup will be used by run(), 372 * but it can be overridden on a per-page basis by connecting 373 * to the Gtk::PrintOperation::signal_request_page_setup() signal. 374 * 375 * @newin{2,10} 376 * 377 * @param default_page_setup A Gtk::PageSetup, or <tt>nullptr</tt>. 378 */ 379 void set_default_page_setup(const Glib::RefPtr<PageSetup>& default_page_setup); 380 381 382 /** Returns the default page setup, see 383 * set_default_page_setup(). 384 * 385 * @newin{2,10} 386 * 387 * @return The default page setup. 388 */ 389 Glib::RefPtr<PageSetup> get_default_page_setup(); 390 391 /** Returns the default page setup, see 392 * set_default_page_setup(). 393 * 394 * @newin{2,10} 395 * 396 * @return The default page setup. 397 */ 398 Glib::RefPtr<const PageSetup> get_default_page_setup() const; 399 400 401 /** Sets the print settings for @a op. This is typically used to 402 * re-establish print settings from a previous print operation, 403 * see run(). 404 * 405 * @newin{2,10} 406 * 407 * @param print_settings Gtk::PrintSettings. 408 */ 409 void set_print_settings(const Glib::RefPtr<PrintSettings>& print_settings); 410 411 412 /** Returns the current print settings. 413 * 414 * Note that the return value is <tt>nullptr</tt> until either 415 * set_print_settings() or 416 * run() have been called. 417 * 418 * @newin{2,10} 419 * 420 * @return The current print settings of @a op. 421 */ 422 Glib::RefPtr<PrintSettings> get_print_settings(); 423 424 /** Returns the current print settings. 425 * 426 * Note that the return value is <tt>nullptr</tt> until either 427 * set_print_settings() or 428 * run() have been called. 429 * 430 * @newin{2,10} 431 * 432 * @return The current print settings of @a op. 433 */ 434 Glib::RefPtr<const PrintSettings> get_print_settings() const; 435 436 437 /** Sets the name of the print job. The name is used to identify 438 * the job (e.g. in monitoring applications like eggcups). 439 * 440 * If you don’t set a job name, GTK+ picks a default one by 441 * numbering successive print jobs. 442 * 443 * @newin{2,10} 444 * 445 * @param job_name A string that identifies the print job. 446 */ 447 void set_job_name(const Glib::ustring& job_name); 448 449 /** Sets the number of pages in the document. 450 * 451 * This must be set to a positive number 452 * before the rendering starts. It may be set in a 453 * Gtk::PrintOperation::signal_begin_print() signal hander. 454 * 455 * Note that the page numbers passed to the 456 * Gtk::PrintOperation::signal_request_page_setup() 457 * and Gtk::PrintOperation::signal_draw_page() signals are 0-based, i.e. if 458 * the user chooses to print all pages, the last signal_draw_page() signal 459 * will be for page @a n_pages - 1. 460 * 461 * @newin{2,10} 462 * 463 * @param n_pages The number of pages. 464 */ 465 void set_n_pages(int n_pages); 466 467 /** Sets the current page. 468 * 469 * If this is called before run(), 470 * the user will be able to select to print only the current page. 471 * 472 * Note that this only makes sense for pre-paginated documents. 473 * 474 * @newin{2,10} 475 * 476 * @param current_page The current page, 0-based. 477 */ 478 void set_current_page(int current_page); 479 480 /** If @a use_full_page is <tt>true</tt>, the transformation for the cairo context 481 * obtained from Gtk::PrintContext puts the origin at the top left 482 * corner of the page (which may not be the top left corner of the 483 * sheet, depending on page orientation and the number of pages per 484 * sheet). Otherwise, the origin is at the top left corner of the 485 * imageable area (i.e. inside the margins). 486 * 487 * @newin{2,10} 488 * 489 * @param use_full_page <tt>true</tt> to set up the Gtk::PrintContext for the full page. 490 */ 491 void set_use_full_page(bool use_full_page = true); 492 493 /** Sets up the transformation for the cairo context obtained from 494 * Gtk::PrintContext in such a way that distances are measured in 495 * units of @a unit. 496 * 497 * @newin{2,10} 498 * 499 * @param unit The unit to use. 500 */ 501 void set_unit(Unit unit); 502 503 /** Sets up the Gtk::PrintOperation to generate a file instead 504 * of showing the print dialog. The indended use of this function 505 * is for implementing “Export to PDF” actions. Currently, PDF 506 * is the only supported format. 507 * 508 * “Print to PDF” support is independent of this and is done 509 * by letting the user pick the “Print to PDF” item from the list 510 * of printers in the print dialog. 511 * 512 * @newin{2,10} 513 * 514 * @param filename The filename for the exported file. 515 */ 516 void set_export_filename(const std::string& filename); 517 518 /** If track_status is <tt>true</tt>, the print operation will try to continue report 519 * on the status of the print job in the printer queues and printer. This 520 * can allow your application to show things like “out of paper” issues, 521 * and when the print job actually reaches the printer. 522 * 523 * This function is often implemented using some form of polling, so it should 524 * not be enabled unless needed. 525 * 526 * @newin{2,10} 527 * 528 * @param track_status <tt>true</tt> to track status after printing. 529 */ 530 void set_track_print_status(bool track_status = true); 531 532 /** If @a show_progress is <tt>true</tt>, the print operation will show a 533 * progress dialog during the print operation. 534 * 535 * @newin{2,10} 536 * 537 * @param show_progress <tt>true</tt> to show a progress dialog. 538 */ 539 void set_show_progress(bool show_progress = true); 540 541 /** Sets whether the run() may return 542 * before the print operation is completed. Note that 543 * some platforms may not allow asynchronous operation. 544 * 545 * @newin{2,10} 546 * 547 * @param allow_async <tt>true</tt> to allow asynchronous operation. 548 */ 549 void set_allow_async(bool allow_async = true); 550 551 /** Sets the label for the tab holding custom widgets. 552 * 553 * @newin{2,10} 554 * 555 * @param label The label to use, or <tt>nullptr</tt> to use the default label. 556 */ 557 void set_custom_tab_label(const Glib::ustring& label); 558 559 560 /** See the run() method that takes both action and parent parameters. 561 */ 562 PrintOperationResult run(PrintOperationAction action = PRINT_OPERATION_ACTION_PRINT_DIALOG); 563 564 565 /** Runs the print operation, by first letting the user modify 566 * print settings in the print dialog, and then print the document. 567 * 568 * Normally that this function does not return until the rendering of all 569 * pages is complete. You can connect to the 570 * Gtk::PrintOperation::signal_status_changed() signal on @a op to obtain some 571 * information about the progress of the print operation. 572 * Furthermore, it may use a recursive mainloop to show the print dialog. 573 * 574 * If you call set_allow_async() or set the 575 * Gtk::PrintOperation::property_allow_async() property the operation will run 576 * asynchronously if this is supported on the platform. The 577 * Gtk::PrintOperation::signal_done() signal will be emitted with the result of the 578 * operation when the it is done (i.e. when the dialog is canceled, or when 579 * the print succeeds or fails). 580 * 581 * [C example ellipted] 582 * 583 * Note that run() can only be called once on a 584 * given Gtk::PrintOperation. 585 * 586 * @newin{2,10} 587 * 588 * @param action The action to start. 589 * @param parent Transient parent of the dialog. 590 * @return The result of the print operation. A return value of 591 * Gtk::PRINT_OPERATION_RESULT_APPLY indicates that the printing was 592 * completed successfully. In this case, it is a good idea to obtain 593 * the used print settings with get_print_settings() 594 * and store them for reuse with the next print operation. A value of 595 * Gtk::PRINT_OPERATION_RESULT_IN_PROGRESS means the operation is running 596 * asynchronously, and will emit the Gtk::PrintOperation::signal_done() signal when 597 * done. 598 * 599 * @throws Glib::Error 600 */ 601 PrintOperationResult run(PrintOperationAction action, Window& parent); 602 603 604 /** Returns the status of the print operation. 605 * Also see get_status_string(). 606 * 607 * @newin{2,10} 608 * 609 * @return The status of the print operation. 610 */ 611 PrintStatus get_status() const; 612 613 /** Returns a string representation of the status of the 614 * print operation. The string is translated and suitable 615 * for displaying the print status e.g. in a Gtk::Statusbar. 616 * 617 * Use get_status() to obtain a status 618 * value that is suitable for programmatic use. 619 * 620 * @newin{2,10} 621 * 622 * @return A string representation of the status 623 * of the print operation. 624 */ 625 Glib::ustring get_status_string() const; 626 627 /** Cancels a running print operation. This function may 628 * be called from a Gtk::PrintOperation::signal_begin_print(), 629 * Gtk::PrintOperation::signal_paginate() or Gtk::PrintOperation::signal_draw_page() 630 * signal handler to stop the currently running print 631 * operation. 632 * 633 * @newin{2,10} 634 */ 635 void cancel(); 636 637 /** A convenience function to find out if the print operation 638 * is finished, either successfully (Gtk::PRINT_STATUS_FINISHED) 639 * or unsuccessfully (Gtk::PRINT_STATUS_FINISHED_ABORTED). 640 * 641 * @note when you enable print status tracking the print operation 642 * can be in a non-finished state even after done has been called, as 643 * the operation status then tracks the print job status on the printer. 644 * 645 * @newin{2,10} 646 * 647 * @return <tt>true</tt>, if the print operation is finished. 648 */ 649 bool is_finished() const; 650 651 652 /** Signalize that drawing of particular page is complete. 653 * 654 * It is called after completion of page drawing (e.g. drawing in another 655 * thread). 656 * If set_defer_drawing() was called before, then this function 657 * has to be called by application. In another case it is called by the library 658 * itself. 659 * 660 * @newin{2,16} 661 */ 662 void draw_page_finish(); 663 664 /** Sets up the Gtk::PrintOperation to wait for calling of 665 * draw_page_finish() from application. It can 666 * be used for drawing page in another thread. 667 * 668 * This function must be called in the callback of “draw-page” signal. 669 * 670 * @newin{2,16} 671 */ 672 void set_defer_drawing(); 673 674 675 /** Sets whether selection is supported by Gtk::PrintOperation. 676 * 677 * @newin{2,18} 678 * 679 * @param support_selection <tt>true</tt> to support selection. 680 */ 681 void set_support_selection(bool support_selection = true); 682 683 /** Gets the value of Gtk::PrintOperation::property_support_selection() property. 684 * 685 * @newin{2,18} 686 * 687 * @return Whether the application supports print of selection. 688 */ 689 bool get_support_selection() const; 690 691 /** Sets whether there is a selection to print. 692 * 693 * Application has to set number of pages to which the selection 694 * will draw by set_n_pages() in a callback of 695 * Gtk::PrintOperation::signal_begin_print(). 696 * 697 * @newin{2,18} 698 * 699 * @param has_selection <tt>true</tt> indicates that a selection exists. 700 */ 701 void set_has_selection(bool has_selection = true); 702 703 /** Gets the value of Gtk::PrintOperation::property_has_selection() property. 704 * 705 * @newin{2,18} 706 * 707 * @return Whether there is a selection. 708 */ 709 bool get_has_selection() const; 710 711 712 /** Embed page size combo box and orientation combo box into page setup page. 713 * Selected page setup is stored as default page setup in Gtk::PrintOperation. 714 * 715 * @newin{2,18} 716 * 717 * @param embed <tt>true</tt> to embed page setup selection in the Gtk::PrintUnixDialog. 718 */ 719 void set_embed_page_setup(bool embed = true); 720 721 /** Gets the value of Gtk::PrintOperation::property_embed_page_setup() property. 722 * 723 * @newin{2,18} 724 * 725 * @return Whether page setup selection combos are embedded. 726 */ 727 bool get_embed_page_setup() const; 728 729 /** Returns the number of pages that will be printed. 730 * 731 * Note that this value is set during print preparation phase 732 * (Gtk::PRINT_STATUS_PREPARING), so this function should never be 733 * called before the data generation phase (Gtk::PRINT_STATUS_GENERATING_DATA). 734 * You can connect to the Gtk::PrintOperation::signal_status_changed() signal 735 * and call get_n_pages_to_print() when 736 * print status is Gtk::PRINT_STATUS_GENERATING_DATA. 737 * This is typically used to track the progress of print operation. 738 * 739 * @newin{2,18} 740 * 741 * @return The number of pages that will be printed. 742 */ 743 int get_n_pages_to_print() const; 744 745 746 //TODO: point out in the docs that the PrintOperationResult enum may also indicate 747 // that an error occurred, and in that case it is up to him to handle it. 748 749 /** 750 * @par Slot Prototype: 751 * <tt>void on_my_%done(PrintOperationResult result)</tt> 752 * 753 * Flags: Run Last 754 * 755 * Emitted when the print operation run has finished doing 756 * everything required for printing. 757 * 758 * @a result gives you information about what happened during the run. 759 * If @a result is Gtk::PRINT_OPERATION_RESULT_ERROR then you can call 760 * Gtk::PrintOperation::get_error() for more information. 761 * 762 * If you enabled print status tracking then 763 * Gtk::PrintOperation::is_finished() may still return <tt>false</tt> 764 * after Gtk::PrintOperation::signal_done() was emitted. 765 * 766 * @newin{2,10} 767 * 768 * @param result The result of the print operation. 769 */ 770 771 Glib::SignalProxy< void,PrintOperationResult > signal_done(); 772 773 774 /** 775 * @par Slot Prototype: 776 * <tt>void on_my_%begin_print(const Glib::RefPtr<PrintContext>& context)</tt> 777 * 778 * Flags: Run Last 779 * 780 * Emitted after the user has finished changing print settings 781 * in the dialog, before the actual rendering starts. 782 * 783 * A typical use for signal_begin_print() is to use the parameters from the 784 * Gtk::PrintContext and paginate the document accordingly, and then 785 * set the number of pages with Gtk::PrintOperation::set_n_pages(). 786 * 787 * @newin{2,10} 788 * 789 * @param context The Gtk::PrintContext for the current operation. 790 */ 791 792 Glib::SignalProxy< void,const Glib::RefPtr<PrintContext>& > signal_begin_print(); 793 794 795 /** 796 * @par Slot Prototype: 797 * <tt>bool on_my_%paginate(const Glib::RefPtr<PrintContext>& context)</tt> 798 * 799 * Flags: Run Last 800 * 801 * Emitted after the Gtk::PrintOperation::signal_begin_print() signal, but before 802 * the actual rendering starts. It keeps getting emitted until a connected 803 * signal handler returns <tt>true</tt>. 804 * 805 * The signal_paginate() signal is intended to be used for paginating a document 806 * in small chunks, to avoid blocking the user interface for a long 807 * time. The signal handler should update the number of pages using 808 * Gtk::PrintOperation::set_n_pages(), and return <tt>true</tt> if the document 809 * has been completely paginated. 810 * 811 * If you don't need to do pagination in chunks, you can simply do 812 * it all in the signal_begin_print() handler, and set the number of pages 813 * from there. 814 * 815 * @newin{2,10} 816 * 817 * @param context The Gtk::PrintContext for the current operation. 818 * @return <tt>true</tt> if pagination is complete. 819 */ 820 821 Glib::SignalProxy< bool,const Glib::RefPtr<PrintContext>& > signal_paginate(); 822 823 824 /** 825 * @par Slot Prototype: 826 * <tt>void on_my_%request_page_setup(const Glib::RefPtr<PrintContext>& context, int page_no, const Glib::RefPtr<PageSetup>& setup)</tt> 827 * 828 * Flags: Run Last 829 * 830 * Emitted once for every page that is printed, to give 831 * the application a chance to modify the page setup. Any changes 832 * done to @a setup will be in force only for printing this page. 833 * 834 * @newin{2,10} 835 * 836 * @param context The Gtk::PrintContext for the current operation. 837 * @param page_no The number of the currently printed page (0-based). 838 * @param setup The Gtk::PageSetup. 839 */ 840 841 Glib::SignalProxy< void,const Glib::RefPtr<PrintContext>&,int,const Glib::RefPtr<PageSetup>& > signal_request_page_setup(); 842 843 844 /** 845 * @par Slot Prototype: 846 * <tt>void on_my_%draw_page(const Glib::RefPtr<PrintContext>& context, int page_nr)</tt> 847 * 848 * Flags: Run Last 849 * 850 * Emitted for every page that is printed. The signal handler 851 * must render the @a page_nr's page onto the cairo context obtained 852 * from @a context using Gtk::PrintContext::get_cairo_context(). 853 * 854 * [C example ellipted] 855 * 856 * Use Gtk::PrintOperation::set_use_full_page() and 857 * Gtk::PrintOperation::set_unit() before starting the print operation 858 * to set up the transformation of the cairo context according to your 859 * needs. 860 * 861 * @newin{2,10} 862 * 863 * @param context The Gtk::PrintContext for the current operation. 864 * @param page_nr The number of the currently printed page (0-based). 865 */ 866 867 Glib::SignalProxy< void,const Glib::RefPtr<PrintContext>&,int > signal_draw_page(); 868 869 870 /** 871 * @par Slot Prototype: 872 * <tt>void on_my_%end_print(const Glib::RefPtr<PrintContext>& context)</tt> 873 * 874 * Flags: Run Last 875 * 876 * Emitted after all pages have been rendered. 877 * A handler for this signal can clean up any resources that have 878 * been allocated in the Gtk::PrintOperation::signal_begin_print() handler. 879 * 880 * @newin{2,10} 881 * 882 * @param context The Gtk::PrintContext for the current operation. 883 */ 884 885 Glib::SignalProxy< void,const Glib::RefPtr<PrintContext>& > signal_end_print(); 886 887 888 /** 889 * @par Slot Prototype: 890 * <tt>void on_my_%status_changed()</tt> 891 * 892 * Flags: Run Last 893 * 894 * Emitted at between the various phases of the print operation. 895 * See Gtk::PrintStatus for the phases that are being discriminated. 896 * Use Gtk::PrintOperation::get_status() to find out the current 897 * status. 898 * 899 * @newin{2,10} 900 */ 901 902 Glib::SignalProxy< void > signal_status_changed(); 903 904 905 /** 906 * @par Slot Prototype: 907 * <tt>Widget* on_my_%create_custom_widget()</tt> 908 * 909 * Flags: Run Last 910 * 911 * Emitted when displaying the print dialog. If you return a 912 * widget in a handler for this signal it will be added to a custom 913 * tab in the print dialog. You typically return a container widget 914 * with multiple widgets in it. 915 * 916 * The print dialog owns the returned widget, and its lifetime is not 917 * controlled by the application. However, the widget is guaranteed 918 * to stay around until the Gtk::PrintOperation::signal_custom_widget_apply() 919 * signal is emitted on the operation. Then you can read out any 920 * information you need from the widgets. 921 * 922 * @newin{2,10} 923 * 924 * @return A custom widget that gets embedded in 925 * the print dialog, or <tt>nullptr</tt>. 926 */ 927 928 Glib::SignalProxy< Widget* > signal_create_custom_widget(); 929 930 931 /** 932 * @par Slot Prototype: 933 * <tt>void on_my_%custom_widget_apply(Widget* widget)</tt> 934 * 935 * Flags: Run Last 936 * 937 * Emitted right before Gtk::PrintOperation::signal_begin_print() if you added 938 * a custom widget in the Gtk::PrintOperation::signal_create_custom_widget() handler. 939 * When you get this signal you should read the information from the 940 * custom widgets, as the widgets are not guaraneed to be around at a 941 * later time. 942 * 943 * @newin{2,10} 944 * 945 * @param widget The custom widget added in create-custom-widget. 946 */ 947 948 Glib::SignalProxy< void,Widget* > signal_custom_widget_apply(); 949 950 951 //TODO: This is causing crashes. Is it still causing crashes? murrayc. 952 953 /** 954 * @par Slot Prototype: 955 * <tt>bool on_my_%preview(const Glib::RefPtr<PrintOperationPreview>& preview, const Glib::RefPtr<PrintContext>& context, Window* parent)</tt> 956 * 957 * Flags: Run Last 958 * 959 * Gets emitted when a preview is requested from the native dialog. 960 * 961 * The default handler for this signal uses an external viewer 962 * application to preview. 963 * 964 * To implement a custom print preview, an application must return 965 * <tt>true</tt> from its handler for this signal. In order to use the 966 * provided @a context for the preview implementation, it must be 967 * given a suitable cairo context with Gtk::PrintContext::set_cairo_context(). 968 * 969 * The custom preview implementation can use 970 * Gtk::PrintOperationPreview::is_selected() and 971 * Gtk::PrintOperationPreview::render_page() to find pages which 972 * are selected for print and render them. The preview must be 973 * finished by calling Gtk::PrintOperationPreview::end_preview() 974 * (typically in response to the user clicking a close button). 975 * 976 * @newin{2,10} 977 * 978 * @param preview The Gtk::PrintOperationPreview for the current operation. 979 * @param context The Gtk::PrintContext that will be used. 980 * @param parent The Gtk::Window to use as window parent, or <tt>nullptr</tt>. 981 * @return <tt>true</tt> if the listener wants to take over control of the preview. 982 */ 983 984 Glib::SignalProxy< bool,const Glib::RefPtr<PrintOperationPreview>&,const Glib::RefPtr<PrintContext>&,Window* > signal_preview(); 985 986 987 //TODO: Remove no_default_handler when we can break ABI. 988 989 990 /** 991 * @par Slot Prototype: 992 * <tt>void on_my_%update_custom_widget(Widget* widget, const Glib::RefPtr<PageSetup>& setup, const Glib::RefPtr<PrintSettings>& settings)</tt> 993 * 994 * Flags: Run Last 995 * 996 * Emitted after change of selected printer. The actual page setup and 997 * print settings are passed to the custom widget, which can actualize 998 * itself according to this change. 999 * 1000 * @newin{2,18} 1001 * 1002 * @param widget The custom widget added in create-custom-widget. 1003 * @param setup Actual page setup. 1004 * @param settings Actual print settings. 1005 */ 1006 1007 Glib::SignalProxy< void,Widget*,const Glib::RefPtr<PageSetup>&,const Glib::RefPtr<PrintSettings>& > signal_update_custom_widget(); 1008 1009 1010 /** The Gtk::PageSetup used by default. 1011 * 1012 * This page setup will be used by Gtk::PrintOperation::run(), 1013 * but it can be overridden on a per-page basis by connecting 1014 * to the Gtk::PrintOperation::signal_request_page_setup() signal. 1015 * 1016 * @newin{2,10} 1017 * 1018 * @return A PropertyProxy that allows you to get or set the value of the property, 1019 * or receive notification when the value of the property changes. 1020 */ 1021 Glib::PropertyProxy< Glib::RefPtr<PageSetup> > property_default_page_setup() ; 1022 1023 /** The Gtk::PageSetup used by default. 1024 * 1025 * This page setup will be used by Gtk::PrintOperation::run(), 1026 * but it can be overridden on a per-page basis by connecting 1027 * to the Gtk::PrintOperation::signal_request_page_setup() signal. 1028 * 1029 * @newin{2,10} 1030 * 1031 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1032 * or receive notification when the value of the property changes. 1033 */ 1034 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<PageSetup> > property_default_page_setup() const; 1035 1036 /** The Gtk::PrintSettings used for initializing the dialog. 1037 * 1038 * Setting this property is typically used to re-establish 1039 * print settings from a previous print operation, see 1040 * Gtk::PrintOperation::run(). 1041 * 1042 * @newin{2,10} 1043 * 1044 * @return A PropertyProxy that allows you to get or set the value of the property, 1045 * or receive notification when the value of the property changes. 1046 */ 1047 Glib::PropertyProxy< Glib::RefPtr<PrintSettings> > property_print_settings() ; 1048 1049 /** The Gtk::PrintSettings used for initializing the dialog. 1050 * 1051 * Setting this property is typically used to re-establish 1052 * print settings from a previous print operation, see 1053 * Gtk::PrintOperation::run(). 1054 * 1055 * @newin{2,10} 1056 * 1057 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1058 * or receive notification when the value of the property changes. 1059 */ 1060 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<PrintSettings> > property_print_settings() const; 1061 1062 /** A string used to identify the job (e.g.\ in monitoring 1063 * applications like eggcups). 1064 * 1065 * If you don't set a job name, GTK+ picks a default one 1066 * by numbering successive print jobs. 1067 * 1068 * @newin{2,10} 1069 * 1070 * Default value: "" 1071 * 1072 * @return A PropertyProxy that allows you to get or set the value of the property, 1073 * or receive notification when the value of the property changes. 1074 */ 1075 Glib::PropertyProxy< Glib::ustring > property_job_name() ; 1076 1077 /** A string used to identify the job (e.g.\ in monitoring 1078 * applications like eggcups). 1079 * 1080 * If you don't set a job name, GTK+ picks a default one 1081 * by numbering successive print jobs. 1082 * 1083 * @newin{2,10} 1084 * 1085 * Default value: "" 1086 * 1087 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1088 * or receive notification when the value of the property changes. 1089 */ 1090 Glib::PropertyProxy_ReadOnly< Glib::ustring > property_job_name() const; 1091 1092 /** The number of pages in the document. 1093 * 1094 * This must be set to a positive number 1095 * before the rendering starts. It may be set in a 1096 * Gtk::PrintOperation::signal_begin_print() signal hander. 1097 * 1098 * Note that the page numbers passed to the 1099 * Gtk::PrintOperation::signal_request_page_setup() and 1100 * Gtk::PrintOperation::signal_draw_page() signals are 0-based, i.e. if 1101 * the user chooses to print all pages, the last signal_draw_page() signal 1102 * will be for page @a n_pages - 1. 1103 * 1104 * @newin{2,10} 1105 * 1106 * Default value: -1 1107 * 1108 * @return A PropertyProxy that allows you to get or set the value of the property, 1109 * or receive notification when the value of the property changes. 1110 */ 1111 Glib::PropertyProxy< int > property_n_pages() ; 1112 1113 /** The number of pages in the document. 1114 * 1115 * This must be set to a positive number 1116 * before the rendering starts. It may be set in a 1117 * Gtk::PrintOperation::signal_begin_print() signal hander. 1118 * 1119 * Note that the page numbers passed to the 1120 * Gtk::PrintOperation::signal_request_page_setup() and 1121 * Gtk::PrintOperation::signal_draw_page() signals are 0-based, i.e. if 1122 * the user chooses to print all pages, the last signal_draw_page() signal 1123 * will be for page @a n_pages - 1. 1124 * 1125 * @newin{2,10} 1126 * 1127 * Default value: -1 1128 * 1129 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1130 * or receive notification when the value of the property changes. 1131 */ 1132 Glib::PropertyProxy_ReadOnly< int > property_n_pages() const; 1133 1134 /** The current page in the document. 1135 * 1136 * If this is set before Gtk::PrintOperation::run(), 1137 * the user will be able to select to print only the current page. 1138 * 1139 * Note that this only makes sense for pre-paginated documents. 1140 * 1141 * @newin{2,10} 1142 * 1143 * Default value: -1 1144 * 1145 * @return A PropertyProxy that allows you to get or set the value of the property, 1146 * or receive notification when the value of the property changes. 1147 */ 1148 Glib::PropertyProxy< int > property_current_page() ; 1149 1150 /** The current page in the document. 1151 * 1152 * If this is set before Gtk::PrintOperation::run(), 1153 * the user will be able to select to print only the current page. 1154 * 1155 * Note that this only makes sense for pre-paginated documents. 1156 * 1157 * @newin{2,10} 1158 * 1159 * Default value: -1 1160 * 1161 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1162 * or receive notification when the value of the property changes. 1163 */ 1164 Glib::PropertyProxy_ReadOnly< int > property_current_page() const; 1165 1166 /** If <tt>true</tt>, the transformation for the cairo context obtained 1167 * from Gtk::PrintContext puts the origin at the top left corner 1168 * of the page (which may not be the top left corner of the sheet, 1169 * depending on page orientation and the number of pages per sheet). 1170 * Otherwise, the origin is at the top left corner of the imageable 1171 * area (i.e. inside the margins). 1172 * 1173 * @newin{2,10} 1174 * 1175 * Default value: <tt>false</tt> 1176 * 1177 * @return A PropertyProxy that allows you to get or set the value of the property, 1178 * or receive notification when the value of the property changes. 1179 */ 1180 Glib::PropertyProxy< bool > property_use_full_page() ; 1181 1182 /** If <tt>true</tt>, the transformation for the cairo context obtained 1183 * from Gtk::PrintContext puts the origin at the top left corner 1184 * of the page (which may not be the top left corner of the sheet, 1185 * depending on page orientation and the number of pages per sheet). 1186 * Otherwise, the origin is at the top left corner of the imageable 1187 * area (i.e. inside the margins). 1188 * 1189 * @newin{2,10} 1190 * 1191 * Default value: <tt>false</tt> 1192 * 1193 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1194 * or receive notification when the value of the property changes. 1195 */ 1196 Glib::PropertyProxy_ReadOnly< bool > property_use_full_page() const; 1197 1198 /** If <tt>true</tt>, the print operation will try to continue report on 1199 * the status of the print job in the printer queues and printer. 1200 * This can allow your application to show things like “out of paper” 1201 * issues, and when the print job actually reaches the printer. 1202 * However, this is often implemented using polling, and should 1203 * not be enabled unless needed. 1204 * 1205 * @newin{2,10} 1206 * 1207 * Default value: <tt>false</tt> 1208 * 1209 * @return A PropertyProxy that allows you to get or set the value of the property, 1210 * or receive notification when the value of the property changes. 1211 */ 1212 Glib::PropertyProxy< bool > property_track_print_status() ; 1213 1214 /** If <tt>true</tt>, the print operation will try to continue report on 1215 * the status of the print job in the printer queues and printer. 1216 * This can allow your application to show things like “out of paper” 1217 * issues, and when the print job actually reaches the printer. 1218 * However, this is often implemented using polling, and should 1219 * not be enabled unless needed. 1220 * 1221 * @newin{2,10} 1222 * 1223 * Default value: <tt>false</tt> 1224 * 1225 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1226 * or receive notification when the value of the property changes. 1227 */ 1228 Glib::PropertyProxy_ReadOnly< bool > property_track_print_status() const; 1229 1230 /** The transformation for the cairo context obtained from 1231 * Gtk::PrintContext is set up in such a way that distances 1232 * are measured in units of @a unit. 1233 * 1234 * @newin{2,10} 1235 * 1236 * Default value: Gtk::UNIT_NONE 1237 * 1238 * @return A PropertyProxy that allows you to get or set the value of the property, 1239 * or receive notification when the value of the property changes. 1240 */ 1241 Glib::PropertyProxy< Unit > property_unit() ; 1242 1243 /** The transformation for the cairo context obtained from 1244 * Gtk::PrintContext is set up in such a way that distances 1245 * are measured in units of @a unit. 1246 * 1247 * @newin{2,10} 1248 * 1249 * Default value: Gtk::UNIT_NONE 1250 * 1251 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1252 * or receive notification when the value of the property changes. 1253 */ 1254 Glib::PropertyProxy_ReadOnly< Unit > property_unit() const; 1255 1256 /** Determines whether to show a progress dialog during the 1257 * print operation. 1258 * 1259 * @newin{2,10} 1260 * 1261 * Default value: <tt>false</tt> 1262 * 1263 * @return A PropertyProxy that allows you to get or set the value of the property, 1264 * or receive notification when the value of the property changes. 1265 */ 1266 Glib::PropertyProxy< bool > property_show_progress() ; 1267 1268 /** Determines whether to show a progress dialog during the 1269 * print operation. 1270 * 1271 * @newin{2,10} 1272 * 1273 * Default value: <tt>false</tt> 1274 * 1275 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1276 * or receive notification when the value of the property changes. 1277 */ 1278 Glib::PropertyProxy_ReadOnly< bool > property_show_progress() const; 1279 1280 /** Determines whether the print operation may run asynchronously or not. 1281 * 1282 * Some systems don't support asynchronous printing, but those that do 1283 * will return Gtk::PRINT_OPERATION_RESULT_IN_PROGRESS as the status, and 1284 * emit the Gtk::PrintOperation::signal_done() signal when the operation is actually 1285 * done. 1286 * 1287 * The Windows port does not support asynchronous operation at all (this 1288 * is unlikely to change). On other platforms, all actions except for 1289 * Gtk::PRINT_OPERATION_ACTION_EXPORT support asynchronous operation. 1290 * 1291 * @newin{2,10} 1292 * 1293 * Default value: <tt>false</tt> 1294 * 1295 * @return A PropertyProxy that allows you to get or set the value of the property, 1296 * or receive notification when the value of the property changes. 1297 */ 1298 Glib::PropertyProxy< bool > property_allow_async() ; 1299 1300 /** Determines whether the print operation may run asynchronously or not. 1301 * 1302 * Some systems don't support asynchronous printing, but those that do 1303 * will return Gtk::PRINT_OPERATION_RESULT_IN_PROGRESS as the status, and 1304 * emit the Gtk::PrintOperation::signal_done() signal when the operation is actually 1305 * done. 1306 * 1307 * The Windows port does not support asynchronous operation at all (this 1308 * is unlikely to change). On other platforms, all actions except for 1309 * Gtk::PRINT_OPERATION_ACTION_EXPORT support asynchronous operation. 1310 * 1311 * @newin{2,10} 1312 * 1313 * Default value: <tt>false</tt> 1314 * 1315 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1316 * or receive notification when the value of the property changes. 1317 */ 1318 Glib::PropertyProxy_ReadOnly< bool > property_allow_async() const; 1319 1320 /** The name of a file to generate instead of showing the print dialog. 1321 * Currently, PDF is the only supported format. 1322 * 1323 * The intended use of this property is for implementing 1324 * “Export to PDF” actions. 1325 * 1326 * “Print to PDF” support is independent of this and is done 1327 * by letting the user pick the “Print to PDF” item from the 1328 * list of printers in the print dialog. 1329 * 1330 * @newin{2,10} 1331 * 1332 * Default value: "" 1333 * 1334 * @return A PropertyProxy that allows you to get or set the value of the property, 1335 * or receive notification when the value of the property changes. 1336 */ 1337 Glib::PropertyProxy< std::string > property_export_filename() ; 1338 1339 /** The name of a file to generate instead of showing the print dialog. 1340 * Currently, PDF is the only supported format. 1341 * 1342 * The intended use of this property is for implementing 1343 * “Export to PDF” actions. 1344 * 1345 * “Print to PDF” support is independent of this and is done 1346 * by letting the user pick the “Print to PDF” item from the 1347 * list of printers in the print dialog. 1348 * 1349 * @newin{2,10} 1350 * 1351 * Default value: "" 1352 * 1353 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1354 * or receive notification when the value of the property changes. 1355 */ 1356 Glib::PropertyProxy_ReadOnly< std::string > property_export_filename() const; 1357 1358 /** The status of the print operation. 1359 * 1360 * @newin{2,10} 1361 * 1362 * Default value: Gtk::PRINT_STATUS_INITIAL 1363 * 1364 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1365 * or receive notification when the value of the property changes. 1366 */ 1367 Glib::PropertyProxy_ReadOnly< PrintStatus > property_status() const; 1368 1369 1370 /** A string representation of the status of the print operation. 1371 * The string is translated and suitable for displaying the print 1372 * status e.g. in a Gtk::Statusbar. 1373 * 1374 * See the Gtk::PrintOperation::property_status() property for a status value that 1375 * is suitable for programmatic use. 1376 * 1377 * @newin{2,10} 1378 * 1379 * Default value: "" 1380 * 1381 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1382 * or receive notification when the value of the property changes. 1383 */ 1384 Glib::PropertyProxy_ReadOnly< Glib::ustring > property_status_string() const; 1385 1386 1387 /** Used as the label of the tab containing custom widgets. 1388 * Note that this property may be ignored on some platforms. 1389 * 1390 * If this is <tt>nullptr</tt>, GTK+ uses a default label. 1391 * 1392 * @newin{2,10} 1393 * 1394 * Default value: "" 1395 * 1396 * @return A PropertyProxy that allows you to get or set the value of the property, 1397 * or receive notification when the value of the property changes. 1398 */ 1399 Glib::PropertyProxy< Glib::ustring > property_custom_tab_label() ; 1400 1401 /** Used as the label of the tab containing custom widgets. 1402 * Note that this property may be ignored on some platforms. 1403 * 1404 * If this is <tt>nullptr</tt>, GTK+ uses a default label. 1405 * 1406 * @newin{2,10} 1407 * 1408 * Default value: "" 1409 * 1410 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1411 * or receive notification when the value of the property changes. 1412 */ 1413 Glib::PropertyProxy_ReadOnly< Glib::ustring > property_custom_tab_label() const; 1414 1415 /** If <tt>true</tt>, the print operation will support print of selection. 1416 * This allows the print dialog to show a "Selection" button. 1417 * 1418 * @newin{2,18} 1419 * 1420 * Default value: <tt>false</tt> 1421 * 1422 * @return A PropertyProxy that allows you to get or set the value of the property, 1423 * or receive notification when the value of the property changes. 1424 */ 1425 Glib::PropertyProxy< bool > property_support_selection() ; 1426 1427 /** If <tt>true</tt>, the print operation will support print of selection. 1428 * This allows the print dialog to show a "Selection" button. 1429 * 1430 * @newin{2,18} 1431 * 1432 * Default value: <tt>false</tt> 1433 * 1434 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1435 * or receive notification when the value of the property changes. 1436 */ 1437 Glib::PropertyProxy_ReadOnly< bool > property_support_selection() const; 1438 1439 /** Determines whether there is a selection in your application. 1440 * This can allow your application to print the selection. 1441 * This is typically used to make a "Selection" button sensitive. 1442 * 1443 * @newin{2,18} 1444 * 1445 * Default value: <tt>false</tt> 1446 * 1447 * @return A PropertyProxy that allows you to get or set the value of the property, 1448 * or receive notification when the value of the property changes. 1449 */ 1450 Glib::PropertyProxy< bool > property_has_selection() ; 1451 1452 /** Determines whether there is a selection in your application. 1453 * This can allow your application to print the selection. 1454 * This is typically used to make a "Selection" button sensitive. 1455 * 1456 * @newin{2,18} 1457 * 1458 * Default value: <tt>false</tt> 1459 * 1460 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1461 * or receive notification when the value of the property changes. 1462 */ 1463 Glib::PropertyProxy_ReadOnly< bool > property_has_selection() const; 1464 1465 /** If <tt>true</tt>, page size combo box and orientation combo box are embedded into page setup page. 1466 * 1467 * @newin{2,18} 1468 * 1469 * Default value: <tt>false</tt> 1470 * 1471 * @return A PropertyProxy that allows you to get or set the value of the property, 1472 * or receive notification when the value of the property changes. 1473 */ 1474 Glib::PropertyProxy< bool > property_embed_page_setup() ; 1475 1476 /** If <tt>true</tt>, page size combo box and orientation combo box are embedded into page setup page. 1477 * 1478 * @newin{2,18} 1479 * 1480 * Default value: <tt>false</tt> 1481 * 1482 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1483 * or receive notification when the value of the property changes. 1484 */ 1485 Glib::PropertyProxy_ReadOnly< bool > property_embed_page_setup() const; 1486 1487 /** The number of pages that will be printed. 1488 * 1489 * Note that this value is set during print preparation phase 1490 * (Gtk::PRINT_STATUS_PREPARING), so this value should never be 1491 * get before the data generation phase (Gtk::PRINT_STATUS_GENERATING_DATA). 1492 * You can connect to the Gtk::PrintOperation::signal_status_changed() signal 1493 * and call Gtk::PrintOperation::get_n_pages_to_print() when 1494 * print status is Gtk::PRINT_STATUS_GENERATING_DATA. 1495 * This is typically used to track the progress of print operation. 1496 * 1497 * @newin{2,18} 1498 * 1499 * Default value: -1 1500 * 1501 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1502 * or receive notification when the value of the property changes. 1503 */ 1504 Glib::PropertyProxy_ReadOnly< int > property_n_pages_to_print() const; 1505 1506 1507 public: 1508 1509 public: 1510 //C++ methods used to invoke GTK+ virtual functions: 1511 1512 protected: 1513 //GTK+ Virtual Functions (override these to change behaviour): 1514 1515 //Default Signal Handlers:: 1516 /// This is a default handler for the signal signal_done(). 1517 virtual void on_done(PrintOperationResult result); 1518 /// This is a default handler for the signal signal_begin_print(). 1519 virtual void on_begin_print(const Glib::RefPtr<PrintContext>& context); 1520 /// This is a default handler for the signal signal_paginate(). 1521 virtual bool on_paginate(const Glib::RefPtr<PrintContext>& context); 1522 /// This is a default handler for the signal signal_request_page_setup(). 1523 virtual void on_request_page_setup(const Glib::RefPtr<PrintContext>& context, int page_no, const Glib::RefPtr<PageSetup>& setup); 1524 /// This is a default handler for the signal signal_draw_page(). 1525 virtual void on_draw_page(const Glib::RefPtr<PrintContext>& context, int page_nr); 1526 /// This is a default handler for the signal signal_end_print(). 1527 virtual void on_end_print(const Glib::RefPtr<PrintContext>& context); 1528 /// This is a default handler for the signal signal_status_changed(). 1529 virtual void on_status_changed(); 1530 /// This is a default handler for the signal signal_create_custom_widget(). 1531 virtual Widget* on_create_custom_widget(); 1532 /// This is a default handler for the signal signal_custom_widget_apply(). 1533 virtual void on_custom_widget_apply(Widget* widget); 1534 /// This is a default handler for the signal signal_preview(). 1535 virtual bool on_preview(const Glib::RefPtr<PrintOperationPreview>& preview, const Glib::RefPtr<PrintContext>& context, Window* parent); 1536 1537 1538 }; 1539 1540 //TODO: Make these static members of a class instead of non-class functions? 1541 1542 //Note: gtk_run_page_setup_dialog() can take a null page_setup object, but the application should always 1543 //store and reuse a page_setup object, so I see no need to provide an overload for that. murrayc. 1544 //TODO: The parent parameter may also be null, so maybe we should add an overload for that. 1545 1546 /** Runs a page setup dialog, letting the user modify the values from page_setup. 1547 * If the user cancels the dialog, the returned PageSetup is identical to that passed in @a page_setup, 1548 * otherwise it contains the modifications done in the dialog. 1549 * 1550 * Note that this function may use a recursive mainloop to show the page setup dialog. 1551 * See run_page_setup_dialog_async() if this is a problem. 1552 * 1553 * @param parent Transient parent. 1554 * @param page_setup An existing GtkPageSetup. 1555 * @param print_settings Print settings. 1556 * @result A new PageSetup object. 1557 * 1558 * @since 2.10 1559 */ 1560 Glib::RefPtr<PageSetup> run_page_setup_dialog(Window& parent, 1561 const Glib::RefPtr<const PageSetup>& page_setup, 1562 const Glib::RefPtr<const PrintSettings>& print_settings); 1563 1564 /** Runs a page setup dialog, letting the user modify the values from page_setup. 1565 * If the user cancels the dialog, the returned PageSetup is identical to that passed in @a page_setup, 1566 * otherwise it contains the modifications done in the dialog. 1567 * 1568 * Note that this function may use a recursive mainloop to show the page setup dialog. 1569 * See run_page_setup_dialog_async() if this is a problem. 1570 * 1571 * @param parent Transient parent. 1572 * @param print_settings Print settings. 1573 * @result A new PageSetup object. 1574 * 1575 * @since 2.22 1576 */ 1577 Glib::RefPtr<PageSetup> run_page_setup_dialog(Window& parent, 1578 const Glib::RefPtr<const PrintSettings>& print_settings); 1579 1580 /** For example, 1581 * void on_setup_done(const Glib::RefPtr<PageSetup>& page_setup); 1582 */ 1583 typedef sigc::slot< void, const Glib::RefPtr<PageSetup>& > SlotPrintSetupDone; 1584 1585 /** Runs a page setup dialog, letting the user modify the values from page_setup. 1586 * 1587 * In contrast to run_page_setup_dialog(), this function returns after showing the 1588 * page setup dialog on platforms that support this, and calls the @a slot from a 1589 * signal handler for the ::response signal of the dialog. 1590 * 1591 * @param parent Transient parent. 1592 * @param page_setup An existing GtkPageSetup. 1593 * @param print_settings Print settings. 1594 * @result A new PageSetup object. 1595 * @param slot 1596 * 1597 * @since 2.10 1598 */ 1599 void run_page_setup_dialog_async(Window& parent, 1600 const Glib::RefPtr<const PageSetup>& page_setup, 1601 const Glib::RefPtr<const PrintSettings>& print_settings, 1602 const SlotPrintSetupDone& slot); 1603 1604 /** Runs a page setup dialog, letting the user modify the values from page_setup. 1605 * 1606 * In contrast to run_page_setup_dialog(), this function returns after showing the 1607 * page setup dialog on platforms that support this, and calls the @a slot from a 1608 * signal handler for the ::response signal of the dialog. 1609 * 1610 * @param parent Transient parent. 1611 * @param print_settings Print settings. 1612 * @result A new PageSetup object. 1613 * @param slot 1614 * 1615 * @since 2.22 1616 */ 1617 void run_page_setup_dialog_async(Window& parent, 1618 const Glib::RefPtr<const PrintSettings>& print_settings, 1619 const SlotPrintSetupDone& slot); 1620 1621 } // namespace Gtk 1622 1623 1624 namespace Glib 1625 { 1626 /** A Glib::wrap() method for this object. 1627 * 1628 * @param object The C instance. 1629 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. 1630 * @result A C++ instance that wraps this C instance. 1631 * 1632 * @relates Gtk::PrintOperation 1633 */ 1634 Glib::RefPtr<Gtk::PrintOperation> wrap(GtkPrintOperation* object, bool take_copy = false); 1635 } 1636 1637 1638 #endif /* _GTKMM_PRINTOPERATION_H */ 1639 1640