Class: Gtk::PrintOperation
- Inherits:
-
Object
- Object
- Gtk::PrintOperation
- Defined in:
- (unknown)
Instance Method Summary collapse
-
#allow_async=(allow_async) ⇒ TrueClass
Determines whether the print operation may run asynchronously or not.
-
#allow_async? ⇒ TrueClass
Determines whether the print operation may run asynchronously or not.
-
#cancel ⇒ nil
Cancels a running print operation.
-
#current_page ⇒ Integer
The current page in the document.
-
#current_page=(current_page) ⇒ Integer
The current page in the document.
-
#custom_tab_label ⇒ String
Used as the label of the tab containing custom widgets.
-
#custom_tab_label=(custom_tab_label) ⇒ String
Used as the label of the tab containing custom widgets.
-
#default_page_setup ⇒ Gtk::PageSetup
The Gtk::PageSetup used by default.
-
#default_page_setup=(default_page_setup) ⇒ Gtk::PageSetup
The Gtk::PageSetup used by default.
-
#draw_page_finish ⇒ nil
Signalize that drawing of particular page is complete.
-
#embed_page_setup ⇒ TrueClass
Gets the value of Gtk::PrintOperation:embed-page-setup property.
-
#embed_page_setup=(embed_page_setup) ⇒ TrueClass
If true, page size combo box and orientation combo box are embedded into page setup page.
-
#embed_page_setup? ⇒ TrueClass
If true, page size combo box and orientation combo box are embedded into page setup page.
-
#error ⇒ nil
Call this when the result of a print operation is %GTK_PRINT_OPERATION_RESULT_ERROR, either as returned by gtk_print_operation_run(), or in the Gtk::PrintOperation::done signal handler.
-
#export_filename ⇒ String
The name of a file to generate instead of showing the print dialog.
-
#export_filename=(export_filename) ⇒ String
The name of a file to generate instead of showing the print dialog.
-
#has_selection ⇒ TrueClass
Gets the value of Gtk::PrintOperation:has-selection property.
-
#has_selection=(has_selection) ⇒ TrueClass
Determines whether there is a selection in your application.
-
#has_selection? ⇒ TrueClass
Determines whether there is a selection in your application.
-
#is_finished ⇒ TrueClass
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).
-
#job_name ⇒ String
A string used to identify the job (e.g. in monitoring applications like eggcups).
-
#job_name=(job_name) ⇒ String
A string used to identify the job (e.g. in monitoring applications like eggcups).
-
#n_pages ⇒ Integer
The number of pages in the document.
-
#n_pages=(n_pages) ⇒ Integer
The number of pages in the document.
-
#n_pages_to_print ⇒ Integer
The number of pages that will be printed.
-
#n_pages_to_print=(n_pages_to_print) ⇒ Integer
The number of pages that will be printed.
-
#new ⇒ Gtk::PrintOperation
Creates a new Gtk::PrintOperation.
-
#print_settings ⇒ Gtk::PrintSettings
The Gtk::PrintSettings used for initializing the dialog.
-
#print_settings=(print_settings) ⇒ Gtk::PrintSettings
The Gtk::PrintSettings used for initializing the dialog.
-
#run(action, parent) ⇒ Gtk::PrintOperationResult
Runs the print operation, by first letting the user modify print settings in the print dialog, and then print the document.
-
#set_defer_drawing ⇒ nil
Sets up the Gtk::PrintOperation to wait for calling of gtk_print_operation_draw_page_finish() from application.
-
#show_progress=(show_progress) ⇒ TrueClass
Determines whether to show a progress dialog during the print operation.
-
#show_progress? ⇒ TrueClass
Determines whether to show a progress dialog during the print operation.
-
#status ⇒ Gtk::PrintStatus
The status of the print operation.
-
#status=(status) ⇒ Gtk::PrintStatus
The status of the print operation.
-
#status_string ⇒ String
A string representation of the status of the print operation.
-
#status_string=(status_string) ⇒ String
A string representation of the status of the print operation.
-
#support_selection ⇒ TrueClass
Gets the value of Gtk::PrintOperation:support-selection property.
-
#support_selection=(support_selection) ⇒ TrueClass
If true, the print operation will support print of selection.
-
#support_selection? ⇒ TrueClass
If true, the print operation will support print of selection.
-
#track_print_status=(track_print_status) ⇒ TrueClass
If true, the print operation will try to continue report on the status of the print job in the printer queues and printer.
-
#track_print_status? ⇒ TrueClass
If true, the print operation will try to continue report on the status of the print job in the printer queues and printer.
-
#unit ⇒ Gtk::Unit
The transformation for the cairo context obtained from Gtk::PrintContext is set up in such a way that distances are measured in units of unit.
-
#unit=(unit) ⇒ Gtk::Unit
The transformation for the cairo context obtained from Gtk::PrintContext is set up in such a way that distances are measured in units of unit.
-
#use_full_page=(use_full_page) ⇒ TrueClass
If 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).
-
#use_full_page? ⇒ TrueClass
If 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).
Instance Method Details
#allow_async=(allow_async) ⇒ TrueClass
Determines whether the print operation may run asynchronously or not.
Some systems don’t support asynchronous printing, but those that do will return %GTK_PRINT_OPERATION_RESULT_IN_PROGRESS as the status, and emit the Gtk::PrintOperation::done signal when the operation is actually done.
The Windows port does not support asynchronous operation at all (this is unlikely to change). On other platforms, all actions except for %GTK_PRINT_OPERATION_ACTION_EXPORT support asynchronous operation.
#allow_async? ⇒ TrueClass
Determines whether the print operation may run asynchronously or not.
Some systems don’t support asynchronous printing, but those that do will return %GTK_PRINT_OPERATION_RESULT_IN_PROGRESS as the status, and emit the Gtk::PrintOperation::done signal when the operation is actually done.
The Windows port does not support asynchronous operation at all (this is unlikely to change). On other platforms, all actions except for %GTK_PRINT_OPERATION_ACTION_EXPORT support asynchronous operation.
#cancel ⇒ nil
Cancels a running print operation. This function may be called from a Gtk::PrintOperation::begin-print, Gtk::PrintOperation::paginate or #GtkPrintOperation::draw-page signal handler to stop the currently running print operation.
#current_page ⇒ Integer
The current page in the document.
If this is set before gtk_print_operation_run(), the user will be able to select to print only the current page.
Note that this only makes sense for pre-paginated documents.
#current_page=(current_page) ⇒ Integer
The current page in the document.
If this is set before gtk_print_operation_run(), the user will be able to select to print only the current page.
Note that this only makes sense for pre-paginated documents.
#custom_tab_label ⇒ String
Used as the label of the tab containing custom widgets. Note that this property may be ignored on some platforms.
If this is nil, GTK+ uses a default label.
#custom_tab_label=(custom_tab_label) ⇒ String
Used as the label of the tab containing custom widgets. Note that this property may be ignored on some platforms.
If this is nil, GTK+ uses a default label.
#default_page_setup ⇒ Gtk::PageSetup
The Gtk::PageSetup used by default.
This page setup will be used by gtk_print_operation_run(), but it can be overridden on a per-page basis by connecting to the Gtk::PrintOperation::request-page-setup signal.
#default_page_setup=(default_page_setup) ⇒ Gtk::PageSetup
The Gtk::PageSetup used by default.
This page setup will be used by gtk_print_operation_run(), but it can be overridden on a per-page basis by connecting to the Gtk::PrintOperation::request-page-setup signal.
#draw_page_finish ⇒ nil
Signalize that drawing of particular page is complete.
It is called after completion of page drawing (e.g. drawing in another thread). If gtk_print_operation_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.
#embed_page_setup ⇒ TrueClass
Gets the value of Gtk::PrintOperation:embed-page-setup property.
#embed_page_setup=(embed_page_setup) ⇒ TrueClass
If true, page size combo box and orientation combo box are embedded into page setup page.
#embed_page_setup? ⇒ TrueClass
If true, page size combo box and orientation combo box are embedded into page setup page.
#error ⇒ nil
Call this when the result of a print operation is %GTK_PRINT_OPERATION_RESULT_ERROR, either as returned by gtk_print_operation_run(), or in the Gtk::PrintOperation::done signal handler. The returned #GError will contain more details on what went wrong.
#export_filename ⇒ String
The name of a file to generate instead of showing the print dialog. Currently, PDF is the only supported format.
The intended use of this property is for implementing “Export to PDF” actions.
“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.
#export_filename=(export_filename) ⇒ String
The name of a file to generate instead of showing the print dialog. Currently, PDF is the only supported format.
The intended use of this property is for implementing “Export to PDF” actions.
“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.
#has_selection ⇒ TrueClass
Gets the value of Gtk::PrintOperation:has-selection property.
#has_selection=(has_selection) ⇒ TrueClass
Determines whether there is a selection in your application. This can allow your application to print the selection. This is typically used to make a “Selection” button sensitive.
#has_selection? ⇒ TrueClass
Determines whether there is a selection in your application. This can allow your application to print the selection. This is typically used to make a “Selection” button sensitive.
#is_finished ⇒ TrueClass
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.
#job_name ⇒ String
A string 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.
#job_name=(job_name) ⇒ String
A string 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.
#n_pages ⇒ Integer
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.
#n_pages=(n_pages) ⇒ Integer
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.
#n_pages_to_print ⇒ Integer
The number of pages that will be printed.
Note that this value is set during print preparation phase (%GTK_PRINT_STATUS_PREPARING), so this value should never be get before the data generation phase (%GTK_PRINT_STATUS_GENERATING_DATA). You can connect to the Gtk::PrintOperation::status-changed signal and call gtk_print_operation_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.
#n_pages_to_print=(n_pages_to_print) ⇒ Integer
The number of pages that will be printed.
Note that this value is set during print preparation phase (%GTK_PRINT_STATUS_PREPARING), so this value should never be get before the data generation phase (%GTK_PRINT_STATUS_GENERATING_DATA). You can connect to the Gtk::PrintOperation::status-changed signal and call gtk_print_operation_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.
#new ⇒ Gtk::PrintOperation
Creates a new Gtk::PrintOperation.
#print_settings ⇒ Gtk::PrintSettings
The Gtk::PrintSettings used for initializing the dialog.
Setting this property is typically used to re-establish print settings from a previous print operation, see gtk_print_operation_run().
#print_settings=(print_settings) ⇒ Gtk::PrintSettings
The Gtk::PrintSettings used for initializing the dialog.
Setting this property is typically used to re-establish print settings from a previous print operation, see gtk_print_operation_run().
#run(action, parent) ⇒ Gtk::PrintOperationResult
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 gtk_print_operation_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 != NULL)
gtk_print_operation_set_print_settings (print, settings);
if (page_setup != NULL)
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:\n%s",
error->message);
g_signal_connect (error_dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
gtk_widget_show (error_dialog);
g_error_free (error);
}
else if (res == GTK_PRINT_OPERATION_RESULT_APPLY)
{
if (settings != NULL)
g_object_unref (settings);
settings = g_object_ref (gtk_print_operation_get_print_settings (print));
}
Note that gtk_print_operation_run() can only be called once on a given Gtk::PrintOperation.
#set_defer_drawing ⇒ nil
Sets up the Gtk::PrintOperation to wait for calling of gtk_print_operation_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.
#show_progress=(show_progress) ⇒ TrueClass
Determines whether to show a progress dialog during the print operation.
#show_progress? ⇒ TrueClass
Determines whether to show a progress dialog during the print operation.
#status ⇒ Gtk::PrintStatus
The status of the print operation.
#status=(status) ⇒ Gtk::PrintStatus
The status of the print operation.
#status_string ⇒ String
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.
See the Gtk::PrintOperation:status property for a status value that is suitable for programmatic use.
#status_string=(status_string) ⇒ String
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.
See the Gtk::PrintOperation:status property for a status value that is suitable for programmatic use.
#support_selection ⇒ TrueClass
Gets the value of Gtk::PrintOperation:support-selection property.
#support_selection=(support_selection) ⇒ TrueClass
If true, the print operation will support print of selection. This allows the print dialog to show a “Selection” button.
#support_selection? ⇒ TrueClass
If true, the print operation will support print of selection. This allows the print dialog to show a “Selection” button.
#track_print_status=(track_print_status) ⇒ TrueClass
If 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. However, this is often implemented using polling, and should not be enabled unless needed.
#track_print_status? ⇒ TrueClass
If 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. However, this is often implemented using polling, and should not be enabled unless needed.
#unit ⇒ Gtk::Unit
The transformation for the cairo context obtained from Gtk::PrintContext is set up in such a way that distances are measured in units of unit.
#unit=(unit) ⇒ Gtk::Unit
The transformation for the cairo context obtained from Gtk::PrintContext is set up in such a way that distances are measured in units of unit.
#use_full_page=(use_full_page) ⇒ TrueClass
If 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).
#use_full_page? ⇒ TrueClass
If 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).