gtkmm 3.0.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions

# Gtk::PrintOperation Class Reference
Printing

PrintOperation is the high-level, portable printing API. More...

Inheritance diagram for Gtk::PrintOperation:
[legend]
Collaboration diagram for Gtk::PrintOperation:
[legend]

List of all members.

## Public Member Functions
virtual | ~PrintOperation ()
GtkPrintOperation* | gobj ()
| Provides access to the underlying C GObject.
const GtkPrintOperation* | gobj () const
| Provides access to the underlying C GObject.
GtkPrintOperation* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
void | set_default_page_setup (const Glib::RefPtr< PageSetup >& default_page_setup)
| Makes default_page_setup the default page setup for op.
Glib::RefPtr< PageSetup > | get_default_page_setup ()
| Returns the default page setup, see set_default_page_setup().
Glib::RefPtr< const PageSetup > | get_default_page_setup () const
| Returns the default page setup, see set_default_page_setup().
void | set_print_settings (const Glib::RefPtr< PrintSettings >& print_settings)
| Sets the print settings for op.
Glib::RefPtr< PrintSettings > | get_print_settings ()
| Returns the current print settings.
Glib::RefPtr< const PrintSettings > | get_print_settings () const
| Returns the current print settings.
void | set_job_name (const Glib::ustring& job_name)
| Sets the name of the print job.
void | set_n_pages (int n_pages)
| Sets the number of pages in the document.
void | set_current_page (int current_page)
| Sets the current page.
void | set_use_full_page (bool use_full_page=true)
| If full_page is `true`, the transformation for the cairo context obtained from Gtk::PrintContext puts the origin at the top left corner of the page (which may not be the top left corner of the sheet, depending on page orientation and the number of pages per sheet).
void | set_unit (Unit unit)
| Sets up the transformation for the cairo context obtained from Gtk::PrintContext in such a way that distances are measured in units of unit.
void | set_export_filename (const std::string& filename)
| Sets up the Gtk::PrintOperation to generate a file instead of showing the print dialog.
void | set_track_print_status (bool track_status=true)
| If track_status is `true`, the print operation will try to continue report on the status of the print job in the printer queues and printer.
void | set_show_progress (bool show_progress=true)
| If show_progress is `true`, the print operation will show a progress dialog during the print operation.
void | set_allow_async (bool allow_async=true)
| Sets whether the run() may return before the print operation is completed.
void | set_custom_tab_label (const Glib::ustring& label)
| Sets the label for the tab holding custom widgets.
PrintOperationResult | run (PrintOperationAction action=PRINT_OPERATION_ACTION_PRINT_DIALOG)
PrintOperationResult | run (PrintOperationAction action, Window& parent)
| Runs the print operation, by first letting the user modify print settings in the print dialog, and then print the document.
PrintStatus | get_status () const
| Returns the status of the print operation.
Glib::ustring | get_status_string () const
| Returns a string representation of the status of the print operation.
void | cancel ()
| Cancels a running print operation.
bool | is_finished () const
| A convenience function to find out if the print operation is finished, either successfully (Gtk::PRINT_STATUS_FINISHED) or unsuccessfully (Gtk::PRINT_STATUS_FINISHED_ABORTED).
void | draw_page_finish ()
| Signalize that drawing of particular page is complete.
void | set_defer_drawing ()
| Sets up the Gtk::PrintOperation to wait for calling of draw_page_finish() from application.
void | set_support_selection (bool support_selection=true)
| Sets whether selection is supported by Gtk::PrintOperation.
bool | get_support_selection () const
| Gets the value of Gtk::PrintOperation::support-selection property.
void | set_has_selection (bool has_selection=true)
| Sets whether there is a selection to print.
bool | get_has_selection () const
| Gets the value of Gtk::PrintOperation::has-selection property.
void | set_embed_page_setup (bool embed=true)
| Embed page size combo box and orientation combo box into page setup page.
bool | get_embed_page_setup () const
| Gets the value of Gtk::PrintOperation::embed-page-setup property.
int | get_n_pages_to_print () const
| Returns the number of pages that will be printed.
Glib::SignalProxy1< void, PrintOperationResult > | signal_done ()
Glib::SignalProxy1< void, const Glib::RefPtr < PrintContext >& > | signal_begin_print ()
Glib::SignalProxy1< bool, const Glib::RefPtr < PrintContext >& > | signal_paginate ()
Glib::SignalProxy3< void, const Glib::RefPtr < PrintContext >&, int, const Glib::RefPtr< PageSetup >& > | signal_request_page_setup ()
Glib::SignalProxy2< void, const Glib::RefPtr < PrintContext >&, int > | signal_draw_page ()
Glib::SignalProxy1< void, const Glib::RefPtr < PrintContext >& > | signal_end_print ()
Glib::SignalProxy0< void > | signal_status_changed ()
Glib::SignalProxy0< Widget* > | signal_create_custom_widget ()
Glib::SignalProxy1< void, Widget* > | signal_custom_widget_apply ()
Glib::SignalProxy3< bool, const Glib::RefPtr < PrintOperationPreview > &, const Glib::RefPtr < PrintContext >&, Window* > | signal_preview ()
Glib::SignalProxy3< void, Widget*, const Glib::RefPtr < PageSetup >&, const Glib::RefPtr< PrintSettings >& > | signal_update_custom_widget ()
Glib::PropertyProxy < Glib::RefPtr< PageSetup > > | property_default_page_setup ()
| The GtkPageSetup used by default.
Glib::PropertyProxy_ReadOnly < Glib::RefPtr< PageSetup > > | property_default_page_setup () const
| The GtkPageSetup used by default.
Glib::PropertyProxy < Glib::RefPtr< PrintSettings > > | property_print_settings ()
| The GtkPrintSettings used for initializing the dialog.
Glib::PropertyProxy_ReadOnly < Glib::RefPtr< PrintSettings > > | property_print_settings () const
| The GtkPrintSettings used for initializing the dialog.
Glib::PropertyProxy < Glib::ustring > | property_job_name ()
| A string used for identifying the print job.
Glib::PropertyProxy_ReadOnly < Glib::ustring > | property_job_name () const
| A string used for identifying the print job.
Glib::PropertyProxy< int > | property_n_pages ()
| The number of pages in the document.
Glib::PropertyProxy_ReadOnly< int > | property_n_pages () const
| The number of pages in the document.
Glib::PropertyProxy< int > | property_current_page ()
| The current page in the document.
Glib::PropertyProxy_ReadOnly< int > | property_current_page () const
| The current page in the document.
Glib::PropertyProxy< bool > | property_use_full_page ()
| TRUE if the origin of the context should be at the corner of the page and not the corner of the imageable area.
Glib::PropertyProxy_ReadOnly < bool > | property_use_full_page () const
| TRUE if the origin of the context should be at the corner of the page and not the corner of the imageable area.
Glib::PropertyProxy< bool > | property_track_print_status ()
| 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.
Glib::PropertyProxy_ReadOnly < bool > | property_track_print_status () const
| 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.
Glib::PropertyProxy< Unit > | property_unit ()
| The unit in which distances can be measured in the context.
Glib::PropertyProxy_ReadOnly < Unit > | property_unit () const
| The unit in which distances can be measured in the context.
Glib::PropertyProxy< bool > | property_show_progress ()
| TRUE if a progress dialog is shown while printing.
Glib::PropertyProxy_ReadOnly < bool > | property_show_progress () const
| TRUE if a progress dialog is shown while printing.
Glib::PropertyProxy< bool > | property_allow_async ()
| TRUE if print process may run asynchronous.
Glib::PropertyProxy_ReadOnly < bool > | property_allow_async () const
| TRUE if print process may run asynchronous.
Glib::PropertyProxy< std::string > | property_export_filename ()
| Export filename.
Glib::PropertyProxy_ReadOnly < std::string > | property_export_filename () const
| Export filename.
Glib::PropertyProxy_ReadOnly < PrintStatus > | property_status () const
| The status of the print operation.
Glib::PropertyProxy_ReadOnly < Glib::ustring > | property_status_string () const
| A human-readable description of the status.
Glib::PropertyProxy < Glib::ustring > | property_custom_tab_label ()
| Label for the tab containing custom widgets.
Glib::PropertyProxy_ReadOnly < Glib::ustring > | property_custom_tab_label () const
| Label for the tab containing custom widgets.
Glib::PropertyProxy< bool > | property_support_selection ()
| TRUE if the print operation will support print of selection.
Glib::PropertyProxy_ReadOnly < bool > | property_support_selection () const
| TRUE if the print operation will support print of selection.
Glib::PropertyProxy< bool > | property_has_selection ()
| TRUE if a selection exists.
Glib::PropertyProxy_ReadOnly < bool > | property_has_selection () const
| TRUE if a selection exists.
Glib::PropertyProxy< bool > | property_embed_page_setup ()
| TRUE if page setup combos are embedded in GtkPrintDialog.
Glib::PropertyProxy_ReadOnly < bool > | property_embed_page_setup () const
| TRUE if page setup combos are embedded in GtkPrintDialog.
Glib::PropertyProxy_ReadOnly< int > | property_n_pages_to_print () const
| The number of pages that will be printed.
## Static Public Member Functions
static Glib::RefPtr < PrintOperation > | create ()
## Protected Member Functions
| PrintOperation ()
virtual void | on_done (PrintOperationResult result)
virtual void | on_begin_print (const Glib::RefPtr< PrintContext >& context)
virtual bool | on_paginate (const Glib::RefPtr< PrintContext >& context)
virtual void | on_request_page_setup (const Glib::RefPtr< PrintContext >& context, int page_no, const Glib::RefPtr< PageSetup >& setup)
virtual void | on_draw_page (const Glib::RefPtr< PrintContext >& context, int page_nr)
virtual void | on_end_print (const Glib::RefPtr< PrintContext >& context)
virtual void | on_status_changed ()
virtual Widget* | on_create_custom_widget ()
virtual void | on_custom_widget_apply (Widget* widget)
virtual bool | on_preview (const Glib::RefPtr< PrintOperationPreview >& preview, const Glib::RefPtr< PrintContext >& context, Window* parent)
## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gtk::PrintOperation > | wrap (GtkPrintOperation* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

PrintOperation is the high-level, portable printing API.

It looks a bit different than other GTK+ dialogs such as the FileChooser, since some platforms don't expose enough infrastructure to implement a good print dialog. On such platforms, PrintOperation uses the native print dialog. On platforms which do not provide a native print dialog, GTK+ uses its own, see PrintUnixDialog.

The typical way to use the high-level printing API is to create a PrintOperation object when the user chooses to print. Then you set some properties on it,such as the page size, any PrintSettings from previous print operations, the number of pages, the current page, etc.

Then you start the print operation by calling run(). It will then show a dialog to let the user select a printer and options. When the user finishes the dialog various signals will be emitted by the PrintOperation for you to handle, the main one being draw_page. You should then render the page on the provided PrintContext using Cairo.

Since gtkmm 2.10:

## Constructor & Destructor Documentation

virtual Gtk::PrintOperation::~PrintOperation | ( |  | ) | `[virtual]`

Gtk::PrintOperation::PrintOperation | ( |  | ) | `[protected]`

## Member Function Documentation

void Gtk::PrintOperation::cancel | ( |  | ) |

Cancels a running print operation.

This function may be called from a Gtk::PrintOperation::begin-print, Gtk::PrintOperation::paginate or Gtk::PrintOperation::draw-page signal handler to stop the currently running print operation.

Since gtkmm 2.10:

static Glib::RefPtr<PrintOperation> Gtk::PrintOperation::create | ( |  | ) | `[static]`

void Gtk::PrintOperation::draw_page_finish | ( |  | ) |

Signalize that drawing of particular page is complete.

It is called after completion of page drawing (e.g. drawing in another thread). If set_defer_drawing() was called before, then this function has to be called by application. In another case it is called by the library itself.

Since gtkmm 2.16:

Glib::RefPtr<PageSetup> Gtk::PrintOperation::get_default_page_setup | ( |  | ) |

Returns the default page setup, see set_default_page_setup().

Since gtkmm 2.10:

Returns:
  The default page setup.

Glib::RefPtr<const PageSetup> Gtk::PrintOperation::get_default_page_setup | ( |  | ) | const

Returns the default page setup, see set_default_page_setup().

Since gtkmm 2.10:

Returns:
  The default page setup.

bool Gtk::PrintOperation::get_embed_page_setup | ( |  | ) | const

Gets the value of Gtk::PrintOperation::embed-page-setup property.

Since gtkmm 2.18:

Returns:
  Whether page setup selection combos are embedded.

bool Gtk::PrintOperation::get_has_selection | ( |  | ) | const

Gets the value of Gtk::PrintOperation::has-selection property.

Since gtkmm 2.18:

Returns:
  Whether there is a selection.

int Gtk::PrintOperation::get_n_pages_to_print | ( |  | ) | const

Returns the number of pages that will be printed.

Note that this value is set during print preparation phase (Gtk::PRINT_STATUS_PREPARING), so this function should never be called before the data generation phase (Gtk::PRINT_STATUS_GENERATING_DATA). You can connect to the Gtk::PrintOperation::status-changed signal and call get_n_pages_to_print() when print status is Gtk::PRINT_STATUS_GENERATING_DATA. This is typically used to track the progress of print operation.

Since gtkmm 2.18:

Returns:
  The number of pages that will be printed.

Glib::RefPtr<PrintSettings> Gtk::PrintOperation::get_print_settings | ( |  | ) |

Returns the current print settings.

Note that the return value is `0` until either set_print_settings() or run() have been called.

Since gtkmm 2.10:

Returns:
  The current print settings of op.

Glib::RefPtr<const PrintSettings> Gtk::PrintOperation::get_print_settings | ( |  | ) | const

Returns the current print settings.

Note that the return value is `0` until either set_print_settings() or run() have been called.

Since gtkmm 2.10:

Returns:
  The current print settings of op.

PrintStatus Gtk::PrintOperation::get_status | ( |  | ) | const

Returns the status of the print operation.

Also see get_status_string().

Since gtkmm 2.10:

Returns:
  The status of the print operation.

Glib::ustring Gtk::PrintOperation::get_status_string | ( |  | ) | const

Returns a string representation of the status of the print operation.

The string is translated and suitable for displaying the print status e.g. in a Gtk::Statusbar.

Use get_status() to obtain a status value that is suitable for programmatic use.

Since gtkmm 2.10:

Returns:
  A string representation of the status of the print operation.

bool Gtk::PrintOperation::get_support_selection | ( |  | ) | const

Gets the value of Gtk::PrintOperation::support-selection property.

Since gtkmm 2.18:

Returns:
  Whether the application supports print of selection.

GtkPrintOperation* Gtk::PrintOperation::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gtk::PrintOperationPreview.

const GtkPrintOperation* Gtk::PrintOperation::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gtk::PrintOperationPreview.

GtkPrintOperation* Gtk::PrintOperation::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

bool Gtk::PrintOperation::is_finished | ( |  | ) | const

A convenience function to find out if the print operation is finished, either successfully (Gtk::PRINT_STATUS_FINISHED) or unsuccessfully (Gtk::PRINT_STATUS_FINISHED_ABORTED).

Note:
  when you enable print status tracking the print operation can be in a non-finished state even after done has been called, as the operation status then tracks the print job status on the printer.

Since gtkmm 2.10:

Returns:
  `true`, if the print operation is finished.

virtual void Gtk::PrintOperation::on_begin_print | ( | const Glib::RefPtr< PrintContext >& | context | ) | `[protected, virtual]`

virtual Widget* Gtk::PrintOperation::on_create_custom_widget | ( |  | ) | `[protected, virtual]`

virtual void Gtk::PrintOperation::on_custom_widget_apply | ( | Widget* | widget | ) | `[protected, virtual]`

virtual void Gtk::PrintOperation::on_done | ( | PrintOperationResult | result | ) | `[protected, virtual]`

virtual void Gtk::PrintOperation::on_draw_page | ( | const Glib::RefPtr< PrintContext >& | context,
|  | int | page_nr
| ) |  | `[protected, virtual]`

virtual void Gtk::PrintOperation::on_end_print | ( | const Glib::RefPtr< PrintContext >& | context | ) | `[protected, virtual]`

virtual bool Gtk::PrintOperation::on_paginate | ( | const Glib::RefPtr< PrintContext >& | context | ) | `[protected, virtual]`

virtual bool Gtk::PrintOperation::on_preview | ( | const Glib::RefPtr< PrintOperationPreview >& | preview,
|  | const Glib::RefPtr< PrintContext >& | context,
|  | Window* | parent
| ) |  | `[protected, virtual]`

virtual void Gtk::PrintOperation::on_request_page_setup | ( | const Glib::RefPtr< PrintContext >& | context,
|  | int | page_no,
|  | const Glib::RefPtr< PageSetup >& | setup
| ) |  | `[protected, virtual]`

virtual void Gtk::PrintOperation::on_status_changed | ( |  | ) | `[protected, virtual]`

Glib::PropertyProxy<bool> Gtk::PrintOperation::property_allow_async | ( |  | ) |

TRUE if print process may run asynchronous.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::PrintOperation::property_allow_async | ( |  | ) | const

TRUE if print process may run asynchronous.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<int> Gtk::PrintOperation::property_current_page | ( |  | ) |

The current page in the document.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<int> Gtk::PrintOperation::property_current_page | ( |  | ) | const

The current page in the document.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<Glib::ustring> Gtk::PrintOperation::property_custom_tab_label | ( |  | ) |

Label for the tab containing custom widgets.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Glib::ustring> Gtk::PrintOperation::property_custom_tab_label | ( |  | ) | const

Label for the tab containing custom widgets.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< Glib::RefPtr<PageSetup> > Gtk::PrintOperation::property_default_page_setup | ( |  | ) |

The GtkPageSetup used by default.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<PageSetup> > Gtk::PrintOperation::property_default_page_setup | ( |  | ) | const

The GtkPageSetup used by default.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::PrintOperation::property_embed_page_setup | ( |  | ) |

TRUE if page setup combos are embedded in GtkPrintDialog.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::PrintOperation::property_embed_page_setup | ( |  | ) | const

TRUE if page setup combos are embedded in GtkPrintDialog.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<std::string> Gtk::PrintOperation::property_export_filename | ( |  | ) |

Export filename.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<std::string> Gtk::PrintOperation::property_export_filename | ( |  | ) | const

Export filename.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::PrintOperation::property_has_selection | ( |  | ) |

TRUE if a selection exists.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::PrintOperation::property_has_selection | ( |  | ) | const

TRUE if a selection exists.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<Glib::ustring> Gtk::PrintOperation::property_job_name | ( |  | ) |

A string used for identifying the print job.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Glib::ustring> Gtk::PrintOperation::property_job_name | ( |  | ) | const

A string used for identifying the print job.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<int> Gtk::PrintOperation::property_n_pages | ( |  | ) |

The number of pages in the document.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<int> Gtk::PrintOperation::property_n_pages | ( |  | ) | const

The number of pages in the document.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<int> Gtk::PrintOperation::property_n_pages_to_print | ( |  | ) | const

The number of pages that will be printed.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< Glib::RefPtr<PrintSettings> > Gtk::PrintOperation::property_print_settings | ( |  | ) |

The GtkPrintSettings used for initializing the dialog.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<PrintSettings> > Gtk::PrintOperation::property_print_settings | ( |  | ) | const

The GtkPrintSettings used for initializing the dialog.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::PrintOperation::property_show_progress | ( |  | ) | const

TRUE if a progress dialog is shown while printing.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::PrintOperation::property_show_progress | ( |  | ) |

TRUE if a progress dialog is shown while printing.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<PrintStatus> Gtk::PrintOperation::property_status | ( |  | ) | const

The status of the print operation.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Glib::ustring> Gtk::PrintOperation::property_status_string | ( |  | ) | const

A human-readable description of the status.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::PrintOperation::property_support_selection | ( |  | ) |

TRUE if the print operation will support print of selection.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::PrintOperation::property_support_selection | ( |  | ) | const

TRUE if the print operation will support print of selection.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::PrintOperation::property_track_print_status | ( |  | ) |

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.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::PrintOperation::property_track_print_status | ( |  | ) | const

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.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Unit> Gtk::PrintOperation::property_unit | ( |  | ) | const

The unit in which distances can be measured in the context.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<Unit> Gtk::PrintOperation::property_unit | ( |  | ) |

The unit in which distances can be measured in the context.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::PrintOperation::property_use_full_page | ( |  | ) |

TRUE if the origin of the context should be at the corner of the page and not the corner of the imageable area.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::PrintOperation::property_use_full_page | ( |  | ) | const

TRUE if the origin of the context should be at the corner of the page and not the corner of the imageable area.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

PrintOperationResult Gtk::PrintOperation::run | ( | PrintOperationAction | action = `PRINT_OPERATION_ACTION_PRINT_DIALOG` | ) |

PrintOperationResult Gtk::PrintOperation::run | ( | PrintOperationAction | action,
|  | Window& | parent
| ) |  |

Runs the print operation, by first letting the user modify print settings in the print dialog, and then print the document.

Normally that this function does not return until the rendering of all pages is complete. You can connect to the Gtk::PrintOperation::status-changed signal on op to obtain some information about the progress of the print operation. Furthermore, it may use a recursive mainloop to show the print dialog.

If you call set_allow_async() or set the Gtk::PrintOperation:allow-async property the operation will run asynchronously if this is supported on the platform. The Gtk::PrintOperation::done signal will be emitted with the result of the operation when the it is done (i.e. when the dialog is canceled, or when the print succeeds or fails). |[ if (settings != `0`) gtk_print_operation_set_print_settings (print, settings);

if (page_setup != `0`) gtk_print_operation_set_default_page_setup (print, page_setup);

g_signal_connect (print, "begin-print", G_CALLBACK (begin_print), &data); g_signal_connect (print, "draw-page", G_CALLBACK (draw_page), &data);

res = gtk_print_operation_run (print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, parent, &error);

if (res == GTK_PRINT_OPERATION_RESULT_ERROR) { error_dialog = gtk_message_dialog_new (GTK_WINDOW (parent), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Error printing file:<tt>\\n</tt>%s", error->message); g_signal_connect (error_dialog, "response", G_CALLBACK (gtk_widget_destroy), `0`); gtk_widget_show (error_dialog); g_error_free (error); } else if (res == GTK_PRINT_OPERATION_RESULT_APPLY) { if (settings != `0`) g_object_unref (settings); settings = g_object_ref (gtk_print_operation_get_print_settings (print)); } ]|

Note that run() can only be called once on a given Gtk::PrintOperation.

Since gtkmm 2.10:

Parameters:

  action | The action to start.
  parent | Transient parent of the dialog.

Returns:
  The result of the print operation. A return value of Gtk::PRINT_OPERATION_RESULT_APPLY indicates that the printing was completed successfully. In this case, it is a good idea to obtain the used print settings with get_print_settings() and store them for reuse with the next print operation. A value of Gtk::PRINT_OPERATION_RESULT_IN_PROGRESS means the operation is running asynchronously, and will emit the Gtk::PrintOperation::done signal when done.

void Gtk::PrintOperation::set_allow_async | ( | bool | allow_async = `true` | ) |

Sets whether the run() may return before the print operation is completed.

Note that some platforms may not allow asynchronous operation.

Since gtkmm 2.10:

Parameters:

  allow_async | `true` to allow asynchronous operation.

void Gtk::PrintOperation::set_current_page | ( | int | current_page | ) |

Sets the current page.

If this is called before run(), the user will be able to select to print only the current page.

Note that this only makes sense for pre-paginated documents.

Since gtkmm 2.10:

Parameters:

  current_page | The current page, 0-based.

void Gtk::PrintOperation::set_custom_tab_label | ( | const Glib::ustring & | label | ) |

Sets the label for the tab holding custom widgets.

Since gtkmm 2.10:

Parameters:

  label | The label to use, or `0` to use the default label.

void Gtk::PrintOperation::set_default_page_setup | ( | const Glib::RefPtr< PageSetup >& | default_page_setup | ) |

Makes default_page_setup the default page setup for op.

This page setup will be used by run(), but it can be overridden on a per-page basis by connecting to the Gtk::PrintOperation::request-page-setup signal.

Since gtkmm 2.10:

Parameters:

  default_page_setup | A Gtk::PageSetup, or `0`.

void Gtk::PrintOperation::set_defer_drawing | ( |  | ) |

Sets up the Gtk::PrintOperation to wait for calling of draw_page_finish() from application.

It can be used for drawing page in another thread.

This function must be called in the callback of "draw-page" signal.

Since gtkmm 2.16:

void Gtk::PrintOperation::set_embed_page_setup | ( | bool | embed = `true` | ) |

Embed page size combo box and orientation combo box into page setup page.

Selected page setup is stored as default page setup in Gtk::PrintOperation.

Since gtkmm 2.18:

Parameters:

  embed | `true` to embed page setup selection in the Gtk::PrintDialog.

void Gtk::PrintOperation::set_export_filename | ( | const std::string & | filename | ) |

Sets up the Gtk::PrintOperation to generate a file instead of showing the print dialog.

The indended use of this function is for implementing "Export to PDF" actions. Currently, PDF is the only supported format.

"Print to PDF" support is independent of this and is done by letting the user pick the "Print to PDF" item from the list of printers in the print dialog.

Since gtkmm 2.10:

Parameters:

  filename | The filename for the exported file.

void Gtk::PrintOperation::set_has_selection | ( | bool | has_selection = `true` | ) |

Sets whether there is a selection to print.

Application has to set number of pages to which the selection will draw by set_n_pages() in a callback of Gtk::PrintOperation::begin-print.

Since gtkmm 2.18:

Parameters:

  has_selection | `true` indicates that a selection exists.

void Gtk::PrintOperation::set_job_name | ( | const Glib::ustring & | job_name | ) |

Sets the name of the print job.

The name is used to identify the job (e.g. in monitoring applications like eggcups).

If you don't set a job name, GTK+ picks a default one by numbering successive print jobs.

Since gtkmm 2.10:

Parameters:

  job_name | A string that identifies the print job.

void Gtk::PrintOperation::set_n_pages | ( | int | n_pages | ) |

Sets the number of pages in the document.

This must be set to a positive number before the rendering starts. It may be set in a Gtk::PrintOperation::begin-print signal hander.

Note that the page numbers passed to the Gtk::PrintOperation::request-page-setup and Gtk::PrintOperation::draw-page signals are 0-based, i.e. if the user chooses to print all pages, the last ::draw-page signal will be for page n_pages - 1.

Since gtkmm 2.10:

Parameters:

  n_pages | The number of pages.

void Gtk::PrintOperation::set_print_settings | ( | const Glib::RefPtr< PrintSettings >& | print_settings | ) |

Sets the print settings for op.

This is typically used to re-establish print settings from a previous print operation, see run().

Since gtkmm 2.10:

Parameters:

  print_settings | Gtk::PrintSettings.

void Gtk::PrintOperation::set_show_progress | ( | bool | show_progress = `true` | ) |

If show_progress is `true`, the print operation will show a progress dialog during the print operation.

Since gtkmm 2.10:

Parameters:

  show_progress | `true` to show a progress dialog.

void Gtk::PrintOperation::set_support_selection | ( | bool | support_selection = `true` | ) |

Sets whether selection is supported by Gtk::PrintOperation.

Since gtkmm 2.18:

Parameters:

  support_selection | `true` to support selection.

void Gtk::PrintOperation::set_track_print_status | ( | bool | track_status = `true` | ) |

If track_status is `true`, the print operation will try to continue report on the status of the print job in the printer queues and printer.

This can allow your application to show things like "out of paper" issues, and when the print job actually reaches the printer.

This function is often implemented using some form of polling, so it should not be enabled unless needed.

Since gtkmm 2.10:

Parameters:

  track_status | `true` to track status after printing.

void Gtk::PrintOperation::set_unit | ( | Unit | unit | ) |

Sets up the transformation for the cairo context obtained from Gtk::PrintContext in such a way that distances are measured in units of unit.

Since gtkmm 2.10:

Parameters:

  unit | The unit to use.

void Gtk::PrintOperation::set_use_full_page | ( | bool | use_full_page = `true` | ) |

If full_page is `true`, the transformation for the cairo context obtained from Gtk::PrintContext puts the origin at the top left corner of the page (which may not be the top left corner of the sheet, depending on page orientation and the number of pages per sheet).

Otherwise, the origin is at the top left corner of the imageable area (i.e. inside the margins).

Since gtkmm 2.10:

Parameters:

  full_page | `true` to set up the Gtk::PrintContext for the full page.

Glib::SignalProxy1< void,const Glib::RefPtr<PrintContext>& > Gtk::PrintOperation::signal_begin_print | ( |  | ) |

Prototype:
  `void on_my_begin_print(const Glib::RefPtr<PrintContext>& context)`

Glib::SignalProxy0< Widget* > Gtk::PrintOperation::signal_create_custom_widget | ( |  | ) |

Prototype:
  `Widget* on_my_create_custom_widget()`

Glib::SignalProxy1< void,Widget* > Gtk::PrintOperation::signal_custom_widget_apply | ( |  | ) |

Prototype:
  `void on_my_custom_widget_apply(Widget* widget)`

Glib::SignalProxy1< void,PrintOperationResult > Gtk::PrintOperation::signal_done | ( |  | ) |

Prototype:
  `void on_my_done(PrintOperationResult result)`

Glib::SignalProxy2< void,const Glib::RefPtr<PrintContext>&,int > Gtk::PrintOperation::signal_draw_page | ( |  | ) |

Prototype:
  `void on_my_draw_page(const Glib::RefPtr<PrintContext>& context, int page_nr)`

Glib::SignalProxy1< void,const Glib::RefPtr<PrintContext>& > Gtk::PrintOperation::signal_end_print | ( |  | ) |

Prototype:
  `void on_my_end_print(const Glib::RefPtr<PrintContext>& context)`

Glib::SignalProxy1< bool,const Glib::RefPtr<PrintContext>& > Gtk::PrintOperation::signal_paginate | ( |  | ) |

Prototype:
  `bool on_my_paginate(const Glib::RefPtr<PrintContext>& context)`

Glib::SignalProxy3< bool,const Glib::RefPtr<PrintOperationPreview>&,const Glib::RefPtr<PrintContext>&,Window* > Gtk::PrintOperation::signal_preview | ( |  | ) |

Prototype:
  `bool on_my_preview(const Glib::RefPtr<PrintOperationPreview>& preview, const Glib::RefPtr<PrintContext>& context, Window* parent)`

Glib::SignalProxy3< void,const Glib::RefPtr<PrintContext>&,int,const Glib::RefPtr<PageSetup>& > Gtk::PrintOperation::signal_request_page_setup | ( |  | ) |

Prototype:
  `void on_my_request_page_setup(const Glib::RefPtr<PrintContext>& context, int page_no, const Glib::RefPtr<PageSetup>& setup)`

Glib::SignalProxy0< void > Gtk::PrintOperation::signal_status_changed | ( |  | ) |

Prototype:
  `void on_my_status_changed()`

Glib::SignalProxy3< void,Widget*,const Glib::RefPtr<PageSetup>&,const Glib::RefPtr<PrintSettings>& > Gtk::PrintOperation::signal_update_custom_widget | ( |  | ) |

Prototype:
  `void on_my_update_custom_widget(Widget* widget, const Glib::RefPtr<PageSetup>& setup, const Glib::RefPtr<PrintSettings>& settings)`

## Friends And Related Function Documentation

Glib::RefPtr< Gtk::PrintOperation > wrap | ( | GtkPrintOperation * | object,
|  | bool | take_copy = `false`
| ) |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- gtkmm/printoperation.h