1 // -*- c++ -*- 2 // Generated by gmmproc 2.45.3 -- DO NOT MODIFY! 3 #ifndef _GTKMM_PRINTOPERATION_H 4 #define _GTKMM_PRINTOPERATION_H 5 6 7 #include <glibmm/ustring.h> 8 #include <sigc++/sigc++.h> 9 10 /* Copyright (C) 2006 The gtkmm Development Team 11 * 12 * This library is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU Lesser General Public 14 * License as published by the Free Software Foundation; either 15 * version 2.1 of the License, or (at your option) any later version. 16 * 17 * This library is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 * Lesser General Public License for more details. 21 * 22 * You should have received a copy of the GNU Lesser General Public 23 * License along with this library; if not, write to the Free 24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 */ 26 27 #include <glibmm/object.h> 28 29 #include <gtkmm/pagesetup.h> 30 #include <gtkmm/printcontext.h> 31 #include <gtkmm/printoperationpreview.h> 32 #include <gtkmm/printsettings.h> 33 #include <gtkmm/window.h> 34 35 36 #ifndef DOXYGEN_SHOULD_SKIP_THIS 37 typedef struct _GtkPrintOperation GtkPrintOperation; 38 typedef struct _GtkPrintOperationClass GtkPrintOperationClass; 39 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 40 41 42 #ifndef DOXYGEN_SHOULD_SKIP_THIS 43 namespace Gtk 44 { class PrintOperation_Class; } // namespace Gtk 45 #endif //DOXYGEN_SHOULD_SKIP_THIS 46 47 namespace Gtk 48 { 49 50 /** @addtogroup gtkmmEnums gtkmm Enums and Flags */ 51 52 /** 53 * 54 * @ingroup gtkmmEnums 55 */ 56 enum PrintStatus 57 { 58 PRINT_STATUS_INITIAL, 59 PRINT_STATUS_PREPARING, 60 PRINT_STATUS_GENERATING_DATA, 61 PRINT_STATUS_SENDING_DATA, 62 PRINT_STATUS_PENDING, 63 PRINT_STATUS_PENDING_ISSUE, 64 PRINT_STATUS_PRINTING, 65 PRINT_STATUS_FINISHED, 66 PRINT_STATUS_FINISHED_ABORTED 67 }; 68 69 } // namespace Gtk 70 71 72 #ifndef DOXYGEN_SHOULD_SKIP_THIS 73 namespace Glib 74 { 75 76 template <> 77 class Value<Gtk::PrintStatus> : public Glib::Value_Enum<Gtk::PrintStatus> 78 { 79 public: 80 static GType value_type() G_GNUC_CONST; 81 }; 82 83 } // namespace Glib 84 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 85 86 87 namespace Gtk 88 { 89 90 /** 91 * 92 * @ingroup gtkmmEnums 93 */ 94 enum PrintOperationResult 95 { 96 PRINT_OPERATION_RESULT_ERROR, 97 PRINT_OPERATION_RESULT_APPLY, 98 PRINT_OPERATION_RESULT_CANCEL, 99 PRINT_OPERATION_RESULT_IN_PROGRESS 100 }; 101 102 } // namespace Gtk 103 104 105 #ifndef DOXYGEN_SHOULD_SKIP_THIS 106 namespace Glib 107 { 108 109 template <> 110 class Value<Gtk::PrintOperationResult> : public Glib::Value_Enum<Gtk::PrintOperationResult> 111 { 112 public: 113 static GType value_type() G_GNUC_CONST; 114 }; 115 116 } // namespace Glib 117 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 118 119 120 namespace Gtk 121 { 122 123 /** 124 * 125 * @ingroup gtkmmEnums 126 */ 127 enum PrintOperationAction 128 { 129 PRINT_OPERATION_ACTION_PRINT_DIALOG, 130 PRINT_OPERATION_ACTION_PRINT, 131 PRINT_OPERATION_ACTION_PREVIEW, 132 PRINT_OPERATION_ACTION_EXPORT 133 }; 134 135 } // namespace Gtk 136 137 138 #ifndef DOXYGEN_SHOULD_SKIP_THIS 139 namespace Glib 140 { 141 142 template <> 143 class Value<Gtk::PrintOperationAction> : public Glib::Value_Enum<Gtk::PrintOperationAction> 144 { 145 public: 146 static GType value_type() G_GNUC_CONST; 147 }; 148 149 } // namespace Glib 150 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 151 152 153 namespace Gtk 154 { 155 156 class PrintError : public Glib::Error 157 { 158 public: 159 /** 160 */ 161 enum Code 162 { 163 GENERAL, 164 INTERNAL_ERROR, 165 NOMEM, 166 INVALID_FILE 167 }; 168 169 PrintError(Code error_code, const Glib::ustring& error_message); 170 explicit PrintError(GError* gobject); 171 Code code() const; 172 173 #ifndef DOXYGEN_SHOULD_SKIP_THIS 174 private: 175 176 static void throw_func(GError* gobject); 177 178 friend void wrap_init(); // uses throw_func() 179 180 #endif //DOXYGEN_SHOULD_SKIP_THIS 181 }; 182 183 } // namespace Gtk 184 185 #ifndef DOXYGEN_SHOULD_SKIP_THIS 186 namespace Glib 187 { 188 189 template <> 190 class Value<Gtk::PrintError::Code> : public Glib::Value_Enum<Gtk::PrintError::Code> 191 { 192 public: 193 static GType value_type() G_GNUC_CONST; 194 }; 195 196 } // namespace Glib 197 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 198 199 200 namespace Gtk 201 { 202 203 204 /** @defgroup Printing Printing 205 */ 206 207 /** PrintOperation is the high-level, portable printing API. It looks a bit different than other 208 * GTK+ dialogs such as the FileChooser, since some platforms don't expose enough infrastructure 209 * to implement a good print dialog. On such platforms, PrintOperation uses the native print 210 * dialog. On platforms which do not provide a native print dialog, GTK+ uses its own, see PrintUnixDialog. 211 * 212 * The typical way to use the high-level printing API is to create a PrintOperation object 213 * when the user chooses to print. Then you set some properties on it,such as the page size, any PrintSettings 214 * from previous print operations, the number of pages, the current page, etc. 215 * 216 * Then you start the print operation by calling run(). It will then show a dialog to 217 * let the user select a printer and options. When the user finishes the dialog various signals will be 218 * emitted by the PrintOperation for you to handle, the main one being draw_page. You should then 219 * render the page on the provided PrintContext using Cairo. 220 * 221 * @newin{2,10} 222 * 223 * @ingroup Printing 224 */ 225 226 class PrintOperation : 227 public Glib::Object, 228 public PrintOperationPreview 229 { 230 231 #ifndef DOXYGEN_SHOULD_SKIP_THIS 232 233 public: 234 typedef PrintOperation CppObjectType; 235 typedef PrintOperation_Class CppClassType; 236 typedef GtkPrintOperation BaseObjectType; 237 typedef GtkPrintOperationClass BaseClassType; 238 239 private: friend class PrintOperation_Class; 240 static CppClassType printoperation_class_; 241 242 private: 243 // noncopyable 244 PrintOperation(const PrintOperation&); 245 PrintOperation& operator=(const PrintOperation&); 246 247 protected: 248 explicit PrintOperation(const Glib::ConstructParams& construct_params); 249 explicit PrintOperation(GtkPrintOperation* castitem); 250 251 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 252 253 public: 254 virtual ~PrintOperation(); 255 256 /** Get the GType for this class, for use with the underlying GObject type system. 257 */ 258 static GType get_type() G_GNUC_CONST; 259 260 #ifndef DOXYGEN_SHOULD_SKIP_THIS 261 262 263 static GType get_base_type() G_GNUC_CONST; 264 #endif 265 266 ///Provides access to the underlying C GObject. gobj()267 GtkPrintOperation* gobj() { return reinterpret_cast<GtkPrintOperation*>(gobject_); } 268 269 ///Provides access to the underlying C GObject. gobj()270 const GtkPrintOperation* gobj() const { return reinterpret_cast<GtkPrintOperation*>(gobject_); } 271 272 ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. 273 GtkPrintOperation* gobj_copy(); 274 275 private: 276 277 278 protected: 279 PrintOperation(); 280 281 public: 282 283 static Glib::RefPtr<PrintOperation> create(); 284 285 286 /** Makes @a default_page_setup the default page setup for @a op. 287 * 288 * This page setup will be used by run(), 289 * but it can be overridden on a per-page basis by connecting 290 * to the Gtk::PrintOperation::signal_request_page_setup() signal. 291 * 292 * @newin{2,10} 293 * 294 * @param default_page_setup A Gtk::PageSetup, or <tt>0</tt>. 295 */ 296 void set_default_page_setup(const Glib::RefPtr<PageSetup>& default_page_setup); 297 298 /** Returns the default page setup, see 299 * set_default_page_setup(). 300 * 301 * @newin{2,10} 302 * 303 * @return The default page setup. 304 */ 305 Glib::RefPtr<PageSetup> get_default_page_setup() const; 306 307 308 /** Sets the print settings for @a op. This is typically used to 309 * re-establish print settings from a previous print operation, 310 * see run(). 311 * 312 * @newin{2,10} 313 * 314 * @param print_settings Gtk::PrintSettings. 315 */ 316 void set_print_settings(const Glib::RefPtr<PrintSettings>& print_settings); 317 318 /** Returns the current print settings. 319 * 320 * Note that the return value is <tt>0</tt> until either 321 * set_print_settings() or 322 * run() have been called. 323 * 324 * @newin{2,10} 325 * 326 * @return The current print settings of @a op. 327 */ 328 Glib::RefPtr<PrintSettings> get_print_settings() const; 329 330 331 /** Sets the name of the print job. The name is used to identify 332 * the job (e.g. in monitoring applications like eggcups). 333 * 334 * If you don't set a job name, GTK+ picks a default one by 335 * numbering successive print jobs. 336 * 337 * @newin{2,10} 338 * 339 * @param job_name A string that identifies the print job. 340 */ 341 void set_job_name(const Glib::ustring& job_name); 342 343 /** Sets the number of pages in the document. 344 * 345 * This <em>must</em> be set to a positive number 346 * before the rendering starts. It may be set in a 347 * Gtk::PrintOperation::signal_begin_print() signal hander. 348 * 349 * Note that the page numbers passed to the 350 * Gtk::PrintOperation::signal_request_page_setup() 351 * and Gtk::PrintOperation::signal_draw_page() signals are 0-based, i.e. if 352 * the user chooses to print all pages, the last signal_draw_page() signal 353 * will be for page @a n_pages - 1. 354 * 355 * @newin{2,10} 356 * 357 * @param n_pages The number of pages. 358 */ 359 void set_n_pages(int n_pages); 360 361 /** Sets the current page. 362 * 363 * If this is called before run(), 364 * the user will be able to select to print only the current page. 365 * 366 * Note that this only makes sense for pre-paginated documents. 367 * 368 * @newin{2,10} 369 * 370 * @param current_page The current page, 0-based. 371 */ 372 void set_current_page(int current_page); 373 374 /** If @a full_page is <tt>true</tt>, the transformation for the cairo context 375 * obtained from Gtk::PrintContext puts the origin at the top left 376 * corner of the page (which may not be the top left corner of the 377 * sheet, depending on page orientation and the number of pages per 378 * sheet). Otherwise, the origin is at the top left corner of the 379 * imageable area (i.e. inside the margins). 380 * 381 * @newin{2,10} 382 * 383 * @param full_page <tt>true</tt> to set up the Gtk::PrintContext for the full page. 384 */ 385 void set_use_full_page(bool use_full_page = true); 386 387 /** Sets up the transformation for the cairo context obtained from 388 * Gtk::PrintContext in such a way that distances are measured in 389 * units of @a unit. 390 * 391 * @newin{2,10} 392 * 393 * @param unit The unit to use. 394 */ 395 void set_unit(Unit unit); 396 397 /** Sets up the Gtk::PrintOperation to generate a file instead 398 * of showing the print dialog. The indended use of this function 399 * is for implementing "Export to PDF" actions. Currently, PDF 400 * is the only supported format. 401 * 402 * "Print to PDF" support is independent of this and is done 403 * by letting the user pick the "Print to PDF" item from the list 404 * of printers in the print dialog. 405 * 406 * @newin{2,10} 407 * 408 * @param filename The filename for the exported file. 409 */ 410 void set_export_filename(const std::string& filename); 411 412 /** If track_status is <tt>true</tt>, the print operation will try to continue report 413 * on the status of the print job in the printer queues and printer. This 414 * can allow your application to show things like "out of paper" issues, 415 * and when the print job actually reaches the printer. 416 * 417 * This function is often implemented using some form of polling, so it should 418 * not be enabled unless needed. 419 * 420 * @newin{2,10} 421 * 422 * @param track_status <tt>true</tt> to track status after printing. 423 */ 424 void set_track_print_status(bool track_status = true); 425 426 /** If @a show_progress is <tt>true</tt>, the print operation will show a 427 * progress dialog during the print operation. 428 * 429 * @newin{2,10} 430 * 431 * @param show_progress <tt>true</tt> to show a progress dialog. 432 */ 433 void set_show_progress(bool show_progress = true); 434 435 /** Sets whether the run() may return 436 * before the print operation is completed. Note that 437 * some platforms may not allow asynchronous operation. 438 * 439 * @newin{2,10} 440 * 441 * @param allow_async <tt>true</tt> to allow asynchronous operation. 442 */ 443 void set_allow_async(bool allow_async = true); 444 445 /** Sets the label for the tab holding custom widgets. 446 * 447 * @newin{2,10} 448 * 449 * @param label The label to use, or <tt>0</tt> to use the default label. 450 */ 451 void set_custom_tab_label(const Glib::ustring& label); 452 453 454 PrintOperationResult run(PrintOperationAction action = PRINT_OPERATION_ACTION_PRINT_DIALOG); 455 456 457 /** Runs the print operation, by first letting the user modify 458 * print settings in the print dialog, and then print the document. 459 * 460 * Normally that this function does not return until the rendering of all 461 * pages is complete. You can connect to the 462 * Gtk::PrintOperation::signal_status_changed() signal on @a op to obtain some 463 * information about the progress of the print operation. 464 * Furthermore, it may use a recursive mainloop to show the print dialog. 465 * 466 * If you call set_allow_async() or set the 467 * Gtk::PrintOperation::property_allow_async() property the operation will run 468 * asynchronously if this is supported on the platform. The 469 * Gtk::PrintOperation::signal_done() signal will be emitted with the result of the 470 * operation when the it is done (i.e. when the dialog is canceled, or when 471 * the print succeeds or fails). 472 * 473 * [C example ellipted] 474 * 475 * Note that run() can only be called once on a 476 * given Gtk::PrintOperation. 477 * 478 * @newin{2,10} 479 * 480 * @param action The action to start. 481 * @param parent Transient parent of the dialog. 482 * @return The result of the print operation. A return value of 483 * Gtk::PRINT_OPERATION_RESULT_APPLY indicates that the printing was 484 * completed successfully. In this case, it is a good idea to obtain 485 * the used print settings with get_print_settings() 486 * and store them for reuse with the next print operation. A value of 487 * Gtk::PRINT_OPERATION_RESULT_IN_PROGRESS means the operation is running 488 * asynchronously, and will emit the Gtk::PrintOperation::signal_done() signal when 489 * done. 490 */ 491 PrintOperationResult run(PrintOperationAction action, Window& parent); 492 493 /** Returns the status of the print operation. 494 * Also see get_status_string(). 495 * 496 * @newin{2,10} 497 * 498 * @return The status of the print operation. 499 */ 500 PrintStatus get_status() const; 501 502 /** Returns a string representation of the status of the 503 * print operation. The string is translated and suitable 504 * for displaying the print status e.g. in a Gtk::Statusbar. 505 * 506 * Use get_status() to obtain a status 507 * value that is suitable for programmatic use. 508 * 509 * @newin{2,10} 510 * 511 * @return A string representation of the status 512 * of the print operation. 513 */ 514 Glib::ustring get_status_string() const; 515 516 /** Cancels a running print operation. This function may 517 * be called from a Gtk::PrintOperation::signal_begin_print(), 518 * Gtk::PrintOperation::signal_paginate() or Gtk::PrintOperation::signal_draw_page() 519 * signal handler to stop the currently running print 520 * operation. 521 * 522 * @newin{2,10} 523 */ 524 void cancel(); 525 526 /** A convenience function to find out if the print operation 527 * is finished, either successfully (Gtk::PRINT_STATUS_FINISHED) 528 * or unsuccessfully (Gtk::PRINT_STATUS_FINISHED_ABORTED). 529 * 530 * @note when you enable print status tracking the print operation 531 * can be in a non-finished state even after done has been called, as 532 * the operation status then tracks the print job status on the printer. 533 * 534 * @newin{2,10} 535 * 536 * @return <tt>true</tt>, if the print operation is finished. 537 */ 538 bool is_finished() const; 539 540 541 /** Signalize that drawing of particular page is complete. 542 * 543 * It is called after completion of page drawing (e.g. drawing in another 544 * thread). 545 * If set_defer_drawing() was called before, then this function 546 * has to be called by application. In another case it is called by the library 547 * itself. 548 * 549 * @newin{2,16} 550 */ 551 void draw_page_finish(); 552 553 /** Sets up the Gtk::PrintOperation to wait for calling of 554 * draw_page_finish() from application. It can 555 * be used for drawing page in another thread. 556 * 557 * This function must be called in the callback of "draw-page" signal. 558 * 559 * @newin{2,16} 560 */ 561 void set_defer_drawing(); 562 563 564 /** Sets whether selection is supported by Gtk::PrintOperation. 565 * 566 * @newin{2,18} 567 * 568 * @param support_selection <tt>true</tt> to support selection. 569 */ 570 void set_support_selection(bool support_selection = true); 571 572 /** Gets the value of Gtk::PrintOperation::property_support_selection() property. 573 * 574 * @newin{2,18} 575 * 576 * @return Whether the application supports print of selection. 577 */ 578 bool get_support_selection() const; 579 580 /** Sets whether there is a selection to print. 581 * 582 * Application has to set number of pages to which the selection 583 * will draw by set_n_pages() in a callback of 584 * Gtk::PrintOperation::signal_begin_print(). 585 * 586 * @newin{2,18} 587 * 588 * @param has_selection <tt>true</tt> indicates that a selection exists. 589 */ 590 void set_has_selection(bool has_selection = true); 591 592 /** Gets the value of Gtk::PrintOperation::property_has_selection() property. 593 * 594 * @newin{2,18} 595 * 596 * @return Whether there is a selection. 597 */ 598 bool get_has_selection() const; 599 600 601 /** Embed page size combo box and orientation combo box into page setup page. 602 * Selected page setup is stored as default page setup in Gtk::PrintOperation. 603 * 604 * @newin{2,18} 605 * 606 * @param embed <tt>true</tt> to embed page setup selection in the Gtk::PrintDialog. 607 */ 608 void set_embed_page_setup(bool embed = true); 609 610 /** Gets the value of Gtk::PrintOperation::property_embed_page_setup() property. 611 * 612 * @newin{2,18} 613 * 614 * @return Whether page setup selection combos are embedded. 615 */ 616 bool get_embed_page_setup() const; 617 618 /** Returns the number of pages that will be printed. 619 * 620 * Note that this value is set during print preparation phase 621 * (Gtk::PRINT_STATUS_PREPARING), so this function should never be 622 * called before the data generation phase (Gtk::PRINT_STATUS_GENERATING_DATA). 623 * You can connect to the Gtk::PrintOperation::signal_status_changed() signal 624 * and call get_n_pages_to_print() when 625 * print status is Gtk::PRINT_STATUS_GENERATING_DATA. 626 * This is typically used to track the progress of print operation. 627 * 628 * @newin{2,18} 629 * 630 * @return The number of pages that will be printed. 631 */ 632 int get_n_pages_to_print() const; 633 634 635 //TODO: point out in the docs that the PrintOperationResult enum may also indicate 636 // that an error occurred, and in that case it is up to him to handle it. 637 638 /** 639 * @par Slot Prototype: 640 * <tt>void on_my_%done(PrintOperationResult result)</tt> 641 * 642 */ 643 644 Glib::SignalProxy1< void,PrintOperationResult > signal_done(); 645 646 647 /** 648 * @par Slot Prototype: 649 * <tt>void on_my_%begin_print(const Glib::RefPtr<PrintContext>& context)</tt> 650 * 651 */ 652 653 Glib::SignalProxy1< void,const Glib::RefPtr<PrintContext>& > signal_begin_print(); 654 655 656 /** 657 * @par Slot Prototype: 658 * <tt>bool on_my_%paginate(const Glib::RefPtr<PrintContext>& context)</tt> 659 * 660 */ 661 662 Glib::SignalProxy1< bool,const Glib::RefPtr<PrintContext>& > signal_paginate(); 663 664 665 /** 666 * @par Slot Prototype: 667 * <tt>void on_my_%request_page_setup(const Glib::RefPtr<PrintContext>& context, int page_no, const Glib::RefPtr<PageSetup>& setup)</tt> 668 * 669 */ 670 671 Glib::SignalProxy3< void,const Glib::RefPtr<PrintContext>&,int,const Glib::RefPtr<PageSetup>& > signal_request_page_setup(); 672 673 674 /** 675 * @par Slot Prototype: 676 * <tt>void on_my_%draw_page(const Glib::RefPtr<PrintContext>& context, int page_nr)</tt> 677 * 678 */ 679 680 Glib::SignalProxy2< void,const Glib::RefPtr<PrintContext>&,int > signal_draw_page(); 681 682 683 /** 684 * @par Slot Prototype: 685 * <tt>void on_my_%end_print(const Glib::RefPtr<PrintContext>& context)</tt> 686 * 687 */ 688 689 Glib::SignalProxy1< void,const Glib::RefPtr<PrintContext>& > signal_end_print(); 690 691 692 /** 693 * @par Slot Prototype: 694 * <tt>void on_my_%status_changed()</tt> 695 * 696 */ 697 698 Glib::SignalProxy0< void > signal_status_changed(); 699 700 701 /** 702 * @par Slot Prototype: 703 * <tt>Widget* on_my_%create_custom_widget()</tt> 704 * 705 */ 706 707 Glib::SignalProxy0< Widget* > signal_create_custom_widget(); 708 709 710 /** 711 * @par Slot Prototype: 712 * <tt>void on_my_%custom_widget_apply(Widget* widget)</tt> 713 * 714 */ 715 716 Glib::SignalProxy1< void,Widget* > signal_custom_widget_apply(); 717 718 719 //TODO: This is causing crashes. Is it still causing crashes? murrayc. 720 721 /** 722 * @par Slot Prototype: 723 * <tt>bool on_my_%preview(const Glib::RefPtr<PrintOperationPreview>& preview, const Glib::RefPtr<PrintContext>& context, Window* parent)</tt> 724 * 725 */ 726 727 Glib::SignalProxy3< bool,const Glib::RefPtr<PrintOperationPreview>&,const Glib::RefPtr<PrintContext>&,Window* > signal_preview(); 728 729 730 //TODO: Remove no_default_handler when we can break ABI. 731 732 733 /** 734 * @par Slot Prototype: 735 * <tt>void on_my_%update_custom_widget(Gtk::Widget* widget, const Glib::RefPtr<PageSetup>& setup, const Glib::RefPtr<PrintSettings>& settings)</tt> 736 * 737 */ 738 739 Glib::SignalProxy3< void,Gtk::Widget*,const Glib::RefPtr<PageSetup>&,const Glib::RefPtr<PrintSettings>& > signal_update_custom_widget(); 740 741 742 /** The GtkPageSetup used by default. 743 * 744 * @return A PropertyProxy that allows you to get or set the value of the property, 745 * or receive notification when the value of the property changes. 746 */ 747 Glib::PropertyProxy< Glib::RefPtr<PageSetup> > property_default_page_setup() ; 748 749 /** The GtkPageSetup used by default. 750 * 751 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 752 * or receive notification when the value of the property changes. 753 */ 754 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<PageSetup> > property_default_page_setup() const; 755 756 /** The GtkPrintSettings used for initializing the dialog. 757 * 758 * @return A PropertyProxy that allows you to get or set the value of the property, 759 * or receive notification when the value of the property changes. 760 */ 761 Glib::PropertyProxy< Glib::RefPtr<PrintSettings> > property_print_settings() ; 762 763 /** The GtkPrintSettings used for initializing the dialog. 764 * 765 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 766 * or receive notification when the value of the property changes. 767 */ 768 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<PrintSettings> > property_print_settings() const; 769 770 /** A string used for identifying the print job. 771 * 772 * @return A PropertyProxy that allows you to get or set the value of the property, 773 * or receive notification when the value of the property changes. 774 */ 775 Glib::PropertyProxy< Glib::ustring > property_job_name() ; 776 777 /** A string used for identifying the print job. 778 * 779 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 780 * or receive notification when the value of the property changes. 781 */ 782 Glib::PropertyProxy_ReadOnly< Glib::ustring > property_job_name() const; 783 784 /** The number of pages in the document. 785 * 786 * @return A PropertyProxy that allows you to get or set the value of the property, 787 * or receive notification when the value of the property changes. 788 */ 789 Glib::PropertyProxy< int > property_n_pages() ; 790 791 /** The number of pages in the document. 792 * 793 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 794 * or receive notification when the value of the property changes. 795 */ 796 Glib::PropertyProxy_ReadOnly< int > property_n_pages() const; 797 798 /** The current page in the document. 799 * 800 * @return A PropertyProxy that allows you to get or set the value of the property, 801 * or receive notification when the value of the property changes. 802 */ 803 Glib::PropertyProxy< int > property_current_page() ; 804 805 /** The current page in the document. 806 * 807 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 808 * or receive notification when the value of the property changes. 809 */ 810 Glib::PropertyProxy_ReadOnly< int > property_current_page() const; 811 812 /** TRUE if the origin of the context should be at the corner of the page and not the corner of the imageable area. 813 * 814 * @return A PropertyProxy that allows you to get or set the value of the property, 815 * or receive notification when the value of the property changes. 816 */ 817 Glib::PropertyProxy< bool > property_use_full_page() ; 818 819 /** TRUE if the origin of the context should be at the corner of the page and not the corner of the imageable area. 820 * 821 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 822 * or receive notification when the value of the property changes. 823 */ 824 Glib::PropertyProxy_ReadOnly< bool > property_use_full_page() const; 825 826 /** TRUE if the print operation will continue to report on the print job status after the print data has been sent to the printer or print server. 827 * 828 * @return A PropertyProxy that allows you to get or set the value of the property, 829 * or receive notification when the value of the property changes. 830 */ 831 Glib::PropertyProxy< bool > property_track_print_status() ; 832 833 /** TRUE if the print operation will continue to report on the print job status after the print data has been sent to the printer or print server. 834 * 835 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 836 * or receive notification when the value of the property changes. 837 */ 838 Glib::PropertyProxy_ReadOnly< bool > property_track_print_status() const; 839 840 /** The unit in which distances can be measured in the context. 841 * 842 * @return A PropertyProxy that allows you to get or set the value of the property, 843 * or receive notification when the value of the property changes. 844 */ 845 Glib::PropertyProxy< Unit > property_unit() ; 846 847 /** The unit in which distances can be measured in the context. 848 * 849 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 850 * or receive notification when the value of the property changes. 851 */ 852 Glib::PropertyProxy_ReadOnly< Unit > property_unit() const; 853 854 /** TRUE if a progress dialog is shown while printing. 855 * 856 * @return A PropertyProxy that allows you to get or set the value of the property, 857 * or receive notification when the value of the property changes. 858 */ 859 Glib::PropertyProxy< bool > property_show_progress() ; 860 861 /** TRUE if a progress dialog is shown while printing. 862 * 863 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 864 * or receive notification when the value of the property changes. 865 */ 866 Glib::PropertyProxy_ReadOnly< bool > property_show_progress() const; 867 868 /** TRUE if print process may run asynchronous. 869 * 870 * @return A PropertyProxy that allows you to get or set the value of the property, 871 * or receive notification when the value of the property changes. 872 */ 873 Glib::PropertyProxy< bool > property_allow_async() ; 874 875 /** TRUE if print process may run asynchronous. 876 * 877 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 878 * or receive notification when the value of the property changes. 879 */ 880 Glib::PropertyProxy_ReadOnly< bool > property_allow_async() const; 881 882 /** Export filename. 883 * 884 * @return A PropertyProxy that allows you to get or set the value of the property, 885 * or receive notification when the value of the property changes. 886 */ 887 Glib::PropertyProxy< std::string > property_export_filename() ; 888 889 /** Export filename. 890 * 891 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 892 * or receive notification when the value of the property changes. 893 */ 894 Glib::PropertyProxy_ReadOnly< std::string > property_export_filename() const; 895 896 /** The status of the print operation. 897 * 898 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 899 * or receive notification when the value of the property changes. 900 */ 901 Glib::PropertyProxy_ReadOnly< PrintStatus > property_status() const; 902 903 904 /** A human-readable description of the status. 905 * 906 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 907 * or receive notification when the value of the property changes. 908 */ 909 Glib::PropertyProxy_ReadOnly< Glib::ustring > property_status_string() const; 910 911 912 /** Label for the tab containing custom widgets. 913 * 914 * @return A PropertyProxy that allows you to get or set the value of the property, 915 * or receive notification when the value of the property changes. 916 */ 917 Glib::PropertyProxy< Glib::ustring > property_custom_tab_label() ; 918 919 /** Label for the tab containing custom widgets. 920 * 921 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 922 * or receive notification when the value of the property changes. 923 */ 924 Glib::PropertyProxy_ReadOnly< Glib::ustring > property_custom_tab_label() const; 925 926 /** TRUE if the print operation will support print of selection. 927 * 928 * @return A PropertyProxy that allows you to get or set the value of the property, 929 * or receive notification when the value of the property changes. 930 */ 931 Glib::PropertyProxy< bool > property_support_selection() ; 932 933 /** TRUE if the print operation will support print of selection. 934 * 935 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 936 * or receive notification when the value of the property changes. 937 */ 938 Glib::PropertyProxy_ReadOnly< bool > property_support_selection() const; 939 940 /** TRUE if a selection exists. 941 * 942 * @return A PropertyProxy that allows you to get or set the value of the property, 943 * or receive notification when the value of the property changes. 944 */ 945 Glib::PropertyProxy< bool > property_has_selection() ; 946 947 /** TRUE if a selection exists. 948 * 949 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 950 * or receive notification when the value of the property changes. 951 */ 952 Glib::PropertyProxy_ReadOnly< bool > property_has_selection() const; 953 954 /** TRUE if page setup combos are embedded in GtkPrintDialog. 955 * 956 * @return A PropertyProxy that allows you to get or set the value of the property, 957 * or receive notification when the value of the property changes. 958 */ 959 Glib::PropertyProxy< bool > property_embed_page_setup() ; 960 961 /** TRUE if page setup combos are embedded in GtkPrintDialog. 962 * 963 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 964 * or receive notification when the value of the property changes. 965 */ 966 Glib::PropertyProxy_ReadOnly< bool > property_embed_page_setup() const; 967 968 /** The number of pages that will be printed. 969 * 970 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 971 * or receive notification when the value of the property changes. 972 */ 973 Glib::PropertyProxy_ReadOnly< int > property_n_pages_to_print() const; 974 975 976 public: 977 978 public: 979 //C++ methods used to invoke GTK+ virtual functions: 980 981 protected: 982 //GTK+ Virtual Functions (override these to change behaviour): 983 984 //Default Signal Handlers:: 985 /// This is a default handler for the signal signal_done(). 986 virtual void on_done(PrintOperationResult result); 987 /// This is a default handler for the signal signal_begin_print(). 988 virtual void on_begin_print(const Glib::RefPtr<PrintContext>& context); 989 /// This is a default handler for the signal signal_paginate(). 990 virtual bool on_paginate(const Glib::RefPtr<PrintContext>& context); 991 /// This is a default handler for the signal signal_request_page_setup(). 992 virtual void on_request_page_setup(const Glib::RefPtr<PrintContext>& context, int page_no, const Glib::RefPtr<PageSetup>& setup); 993 /// This is a default handler for the signal signal_draw_page(). 994 virtual void on_draw_page(const Glib::RefPtr<PrintContext>& context, int page_nr); 995 /// This is a default handler for the signal signal_end_print(). 996 virtual void on_end_print(const Glib::RefPtr<PrintContext>& context); 997 /// This is a default handler for the signal signal_status_changed(). 998 virtual void on_status_changed(); 999 /// This is a default handler for the signal signal_create_custom_widget(). 1000 virtual Widget* on_create_custom_widget(); 1001 /// This is a default handler for the signal signal_custom_widget_apply(). 1002 virtual void on_custom_widget_apply(Widget* widget); 1003 /// This is a default handler for the signal signal_preview(). 1004 virtual bool on_preview(const Glib::RefPtr<PrintOperationPreview>& preview, const Glib::RefPtr<PrintContext>& context, Window* parent); 1005 1006 1007 }; 1008 1009 //TODO: Make these static members of a class instead of non-class functions? 1010 1011 //Note: gtk_run_page_setup_dialog() can take a null page_setup object, but the application should always 1012 //store and reuse a page_setup object, so I see no need to provide an overload for that. murrayc. 1013 //TODO: The parent parameter may also be null, so maybe we should add an overload for that. 1014 1015 /** Runs a page setup dialog, letting the user modify the values from page_setup. 1016 * If the user cancels the dialog, the returned PageSetup is identical to that passed in @a page_setup, 1017 * otherwise it contains the modifications done in the dialog. 1018 * 1019 * Note that this function may use a recursive mainloop to show the page setup dialog. 1020 * See run_page_setup_dialog_async() if this is a problem. 1021 * 1022 * @param parent Transient parent. 1023 * @param page_setup An existing GtkPageSetup. 1024 * @param settings Print settings. 1025 * @result A new PageSetup object. 1026 * 1027 * @since 2.10 1028 */ 1029 Glib::RefPtr<PageSetup> run_page_setup_dialog(Window& parent, 1030 const Glib::RefPtr<const PageSetup>& page_setup, 1031 const Glib::RefPtr<const PrintSettings>& print_settings); 1032 1033 /** Runs a page setup dialog, letting the user modify the values from page_setup. 1034 * If the user cancels the dialog, the returned PageSetup is identical to that passed in @a page_setup, 1035 * otherwise it contains the modifications done in the dialog. 1036 * 1037 * Note that this function may use a recursive mainloop to show the page setup dialog. 1038 * See run_page_setup_dialog_async() if this is a problem. 1039 * 1040 * @param parent Transient parent. 1041 * @param settings Print settings. 1042 * @result A new PageSetup object. 1043 * 1044 * @since 2.22 1045 */ 1046 Glib::RefPtr<PageSetup> run_page_setup_dialog(Window& parent, 1047 const Glib::RefPtr<const PrintSettings>& print_settings); 1048 1049 /** For example, 1050 * void on_setup_done(const Glib::RefPtr<PageSetup>& page_setup); 1051 */ 1052 typedef sigc::slot< void, const Glib::RefPtr<PageSetup>& > SlotPrintSetupDone; 1053 1054 /** Runs a page setup dialog, letting the user modify the values from page_setup. 1055 * 1056 * In contrast to run_page_setup_dialog(), this function returns after showing the 1057 * page setup dialog on platforms that support this, and calls the @a slot from a 1058 * signal handler for the ::response signal of the dialog. 1059 * 1060 * @param parent Transient parent. 1061 * @param page_setup An existing GtkPageSetup. 1062 * @param settings Print settings. 1063 * @result A new PageSetup object. 1064 * @param slot 1065 * 1066 * @since 2.10 1067 */ 1068 void run_page_setup_dialog_async(Window& parent, 1069 const Glib::RefPtr<const PageSetup>& page_setup, 1070 const Glib::RefPtr<const PrintSettings>& print_settings, 1071 const SlotPrintSetupDone& slot); 1072 1073 /** Runs a page setup dialog, letting the user modify the values from page_setup. 1074 * 1075 * In contrast to run_page_setup_dialog(), this function returns after showing the 1076 * page setup dialog on platforms that support this, and calls the @a slot from a 1077 * signal handler for the ::response signal of the dialog. 1078 * 1079 * @param parent Transient parent. 1080 * @param page_setup An existing GtkPageSetup. 1081 * @param settings Print settings. 1082 * @result A new PageSetup object. 1083 * @param slot 1084 * 1085 * @since 2.22 1086 */ 1087 void run_page_setup_dialog_async(Window& parent, 1088 const Glib::RefPtr<const PrintSettings>& print_settings, 1089 const SlotPrintSetupDone& slot); 1090 1091 } // namespace Gtk 1092 1093 1094 namespace Glib 1095 { 1096 /** A Glib::wrap() method for this object. 1097 * 1098 * @param object The C instance. 1099 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. 1100 * @result A C++ instance that wraps this C instance. 1101 * 1102 * @relates Gtk::PrintOperation 1103 */ 1104 Glib::RefPtr<Gtk::PrintOperation> wrap(GtkPrintOperation* object, bool take_copy = false); 1105 } 1106 1107 1108 #endif /* _GTKMM_PRINTOPERATION_H */ 1109 1110