Class: Gtk::PrintOperation
- Inherits:
-
Object
- Object
- Gtk::PrintOperation
- Extended by:
- GLib::Deprecatable
- Defined in:
- lib/gtk3/deprecated.rb
Instance Method Summary collapse
-
#allow_async=(allow_async) ⇒ Boolean
Determines whether the print operation may run asynchronously or not.
-
#allow_async? ⇒ Boolean
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
GtkPageSetupused by default. -
#default_page_setup=(default_page_setup) ⇒ Gtk::PageSetup
The
GtkPageSetupused by default. -
#draw_page_finish ⇒ nil
Signal that drawing of particular page is complete.
-
#embed_page_setup ⇒ Boolean
Gets whether page setup selection combos are embedded.
-
#embed_page_setup=(embed_page_setup) ⇒ Boolean
If true, page size combo box and orientation combo box are embedded into page setup page.
-
#embed_page_setup? ⇒ Boolean
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.
-
#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 ⇒ Boolean
Gets whether there is a selection.
-
#has_selection=(has_selection) ⇒ Boolean
Determines whether there is a selection in your application.
-
#has_selection? ⇒ Boolean
Determines whether there is a selection in your application.
-
#initialize ⇒ Gtk::PrintOperation
constructor
Creates a new
GtkPrintOperation. -
#is_finished ⇒ Boolean
A convenience function to find out if the print operation is finished.
-
#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.
-
#print_settings ⇒ Gtk::PrintSettings
The
GtkPrintSettingsused for initializing the dialog. -
#print_settings=(print_settings) ⇒ Gtk::PrintSettings
The
GtkPrintSettingsused for initializing the dialog. -
#run(action, parent) ⇒ Gtk::PrintOperationResult
Runs the print operation.
-
#set_defer_drawing ⇒ nil
Sets up the
GtkPrintOperationto wait for calling of [methodGtk.PrintOperation.draw_page_finish from application. -
#show_progress=(show_progress) ⇒ Boolean
Determines whether to show a progress dialog during the print operation.
-
#show_progress? ⇒ Boolean
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 ⇒ Boolean
Gets whether the application supports print of selection.
-
#support_selection=(support_selection) ⇒ Boolean
If true, the print operation will support print of selection.
-
#support_selection? ⇒ Boolean
If true, the print operation will support print of selection.
-
#track_print_status=(track_print_status) ⇒ Boolean
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? ⇒ Boolean
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
GtkPrintContextis 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
GtkPrintContextis set up in such a way that distances are measured in units of unit. -
#use_full_page=(use_full_page) ⇒ Boolean
If true, the transformation for the cairo context obtained from
GtkPrintContextputs the origin at the top left corner of the page. -
#use_full_page? ⇒ Boolean
If true, the transformation for the cairo context obtained from
GtkPrintContextputs the origin at the top left corner of the page.
Constructor Details
#initialize ⇒ Gtk::PrintOperation
Creates a new GtkPrintOperation.
Instance Method Details
#allow_async=(allow_async) ⇒ Boolean
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 [signalGtk.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? ⇒ Boolean
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 [signalGtk.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 [signalGtk.PrintOperation::begin-print], [signalGtk.PrintOperation::paginate] or [signalGtk.PrintOperation::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 [methodGtk.PrintOperation.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 [methodGtk.PrintOperation.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 GtkPageSetup used by default.
This page setup will be used by [methodGtk.PrintOperation.run], but it can be overridden on a per-page basis by connecting to the [signalGtk.PrintOperation::request-page-setup] signal.
#default_page_setup=(default_page_setup) ⇒ Gtk::PageSetup
The GtkPageSetup used by default.
This page setup will be used by [methodGtk.PrintOperation.run], but it can be overridden on a per-page basis by connecting to the [signalGtk.PrintOperation::request-page-setup] signal.
#draw_page_finish ⇒ nil
Signal that drawing of particular page is complete.
It is called after completion of page drawing (e.g. drawing in another thread). If [methodGtk.PrintOperation.set_defer_drawing] was called before, then this function has to be called by application. Otherwise it is called by GTK itself.
#embed_page_setup ⇒ Boolean
Gets whether page setup selection combos are embedded
#embed_page_setup=(embed_page_setup) ⇒ Boolean
If true, page size combo box and orientation combo box are embedded into page setup page.
#embed_page_setup? ⇒ Boolean
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.
It can be called either after [methodGtk.PrintOperation.run] returns, or in the [signalGtk.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 ⇒ Boolean
Gets whether there is a selection.
#has_selection=(has_selection) ⇒ Boolean
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? ⇒ Boolean
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 ⇒ Boolean
A convenience function to find out if the print operation is finished.
a print operation is finished if its status is either %GTK_PRINT_STATUS_FINISHED or %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 [signalGtk.PrintOperation::begin-print] signal handler.
Note that the page numbers passed to the [signalGtk.PrintOperation::request-page-setup] and [signalGtk.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 [signalGtk.PrintOperation::begin-print] signal handler.
Note that the page numbers passed to the [signalGtk.PrintOperation::request-page-setup] and [signalGtk.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 [signalGtk.PrintOperation::status-changed] signal and call [methodGtk.PrintOperation.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 [signalGtk.PrintOperation::status-changed] signal and call [methodGtk.PrintOperation.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.
#print_settings ⇒ Gtk::PrintSettings
The GtkPrintSettings used for initializing the dialog.
Setting this property is typically used to re-establish print settings from a previous print operation, see [methodGtk.PrintOperation.run].
#print_settings=(print_settings) ⇒ Gtk::PrintSettings
The GtkPrintSettings used for initializing the dialog.
Setting this property is typically used to re-establish print settings from a previous print operation, see [methodGtk.PrintOperation.run].
#run(action, parent) ⇒ Gtk::PrintOperationResult
Runs the print operation.
Normally that this function does not return until the rendering of all pages is complete. You can connect to the [signalGtk.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 set the [Gtk.PrintOperation:allow-async] property, the operation will run asynchronously if this is supported on the platform. The [signalGtk.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_window_destroy), NULL);
gtk_window_present (GTK_WINDOW (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 GtkPrintOperation.
#set_defer_drawing ⇒ nil
Sets up the GtkPrintOperation to wait for calling of
[methodGtk.PrintOperation.draw_page_finish from application.
This can be used for drawing page in another thread.
This function must be called in the callback of the [signalGtk.PrintOperation::draw-page] signal.
#show_progress=(show_progress) ⇒ Boolean
Determines whether to show a progress dialog during the print operation.
#show_progress? ⇒ Boolean
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 GtkStatusbar.
See the [propertyGtk.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 GtkStatusbar.
See the [propertyGtk.PrintOperation:status] property for a status value that is suitable for programmatic use.
#support_selection ⇒ Boolean
Gets whether the application supports print of selection
#support_selection=(support_selection) ⇒ Boolean
If true, the print operation will support print of selection.
This allows the print dialog to show a "Selection" button.
#support_selection? ⇒ Boolean
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) ⇒ Boolean
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? ⇒ Boolean
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
GtkPrintContext 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
GtkPrintContext is set up in such a way that distances
are measured in units of unit.
#use_full_page=(use_full_page) ⇒ Boolean
If true, the transformation for the cairo context obtained
from GtkPrintContext puts the origin at the top left corner
of the page.
This 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? ⇒ Boolean
If true, the transformation for the cairo context obtained
from GtkPrintContext puts the origin at the top left corner
of the page.
This 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).