PrintOperationSignalName
public enum PrintOperationSignalName : String, SignalNameProtocol
Undocumented
-
Emitted after the user has finished changing print settings in the dialog, before the actual rendering starts.
A typical use for
begin-print
is to use the parameters from theGtkPrintContext
and paginate the document accordingly, and then set the number of pages withgtk_print_operation_set_n_pages()
.Declaration
Swift
case beginPrint = "begin-print"
-
Emitted when displaying the print dialog. If you return a widget in a handler for this signal it will be added to a custom tab in the print dialog. You typically return a container widget with multiple widgets in it.
The print dialog owns the returned widget, and its lifetime is not controlled by the application. However, the widget is guaranteed to stay around until the
GtkPrintOperation::custom-widget-apply
signal is emitted on the operation. Then you can read out any information you need from the widgets.Declaration
Swift
case createCustomWidget = "create-custom-widget"
-
Emitted right before
GtkPrintOperation::begin-print
if you added a custom widget in theGtkPrintOperation::create-custom-widget
handler. When you get this signal you should read the information from the custom widgets, as the widgets are not guaraneed to be around at a later time.Declaration
Swift
case customWidgetApply = "custom-widget-apply"
-
Emitted when the print operation run has finished doing everything required for printing.
result
gives you information about what happened during the run. Ifresult
isGTK_PRINT_OPERATION_RESULT_ERROR
then you can callgtk_print_operation_get_error()
for more information.If you enabled print status tracking then
gtk_print_operation_is_finished()
may still returnfalse
afterGtkPrintOperation::done
was emitted.Declaration
Swift
case done = "done"
-
Emitted for every page that is printed. The signal handler must render the
page_nr
‘s page onto the cairo context obtained fromcontext
usinggtk_print_context_get_cairo_context()
. (C Language Example):static void draw_page (GtkPrintOperation *operation, GtkPrintContext *context, gint page_nr, gpointer user_data) { cairo_t *cr; PangoLayout *layout; gdouble width, text_height; gint layout_height; PangoFontDescription *desc; cr = gtk_print_context_get_cairo_context (context); width = gtk_print_context_get_width (context); cairo_rectangle (cr, 0, 0, width, HEADER_HEIGHT); cairo_set_source_rgb (cr, 0.8, 0.8, 0.8); cairo_fill (cr); layout = gtk_print_context_create_pango_layout (context); desc = pango_font_description_from_string ("sans 14"); pango_layout_set_font_description (layout, desc); pango_font_description_free (desc); pango_layout_set_text (layout, "some text", -1); pango_layout_set_width (layout, width * PANGO_SCALE); pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER); pango_layout_get_size (layout, NULL, &layout_height); text_height = (gdouble)layout_height / PANGO_SCALE; cairo_move_to (cr, width / 2, (HEADER_HEIGHT - text_height) / 2); pango_cairo_show_layout (cr, layout); g_object_unref (layout); }
Use
gtk_print_operation_set_use_full_page()
andgtk_print_operation_set_unit()
before starting the print operation to set up the transformation of the cairo context according to your needs.Declaration
Swift
case drawPage = "draw-page"
-
Emitted after all pages have been rendered. A handler for this signal can clean up any resources that have been allocated in the
GtkPrintOperation::begin-print
handler.Declaration
Swift
case endPrint = "end-print"
-
The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property()
,g_object_set()
, et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY
, then any call tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_object_notify_by_pspec()
, and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()
call, like this:(C Language Example):
g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)
It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Declaration
Swift
case notify = "notify"
-
Emitted after the
GtkPrintOperation::begin-print
signal, but before the actual rendering starts. It keeps getting emitted until a connected signal handler returnstrue
.The
paginate
signal is intended to be used for paginating a document in small chunks, to avoid blocking the user interface for a long time. The signal handler should update the number of pages usinggtk_print_operation_set_n_pages()
, and returntrue
if the document has been completely paginated.If you don’t need to do pagination in chunks, you can simply do it all in the
begin-print
handler, and set the number of pages from there.Declaration
Swift
case paginate = "paginate"
-
Gets emitted when a preview is requested from the native dialog.
The default handler for this signal uses an external viewer application to preview.
To implement a custom print preview, an application must return
true
from its handler for this signal. In order to use the providedcontext
for the preview implementation, it must be given a suitable cairo context withgtk_print_context_set_cairo_context()
.The custom preview implementation can use
gtk_print_operation_preview_is_selected()
andgtk_print_operation_preview_render_page()
to find pages which are selected for print and render them. The preview must be finished by callinggtk_print_operation_preview_end_preview()
(typically in response to the user clicking a close button).Declaration
Swift
case preview = "preview"
-
Emitted once for every page that is printed, to give the application a chance to modify the page setup. Any changes done to
setup
will be in force only for printing this page.Declaration
Swift
case requestPageSetup = "request-page-setup"
-
Emitted at between the various phases of the print operation. See
GtkPrintStatus
for the phases that are being discriminated. Usegtk_print_operation_get_status()
to find out the current status.Declaration
Swift
case statusChanged = "status-changed"
-
Emitted after change of selected printer. The actual page setup and print settings are passed to the custom widget, which can actualize itself according to this change.
Declaration
Swift
case updateCustomWidget = "update-custom-widget"
-
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 theGtkPrintOperation::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.Declaration
Swift
case notifyAllowAsync = "notify::allow-async"
-
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.
Declaration
Swift
case notifyCurrentPage = "notify::current-page"
-
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.Declaration
Swift
case notifyCustomTabLabel = "notify::custom-tab-label"
-
The
GtkPageSetup
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 theGtkPrintOperation::request-page-setup
signal.Declaration
Swift
case notifyDefaultPageSetup = "notify::default-page-setup"
-
If
true
, page size combo box and orientation combo box are embedded into page setup page.Declaration
Swift
case notifyEmbedPageSetup = "notify::embed-page-setup"
-
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.
Declaration
Swift
case notifyExportFilename = "notify::export-filename"
-
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.
Declaration
Swift
case notifyHasSelection = "notify::has-selection"
-
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.
Declaration
Swift
case notifyJobName = "notify::job-name"
-
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
GtkPrintOperation::begin-print
signal hander.Note that the page numbers passed to the
GtkPrintOperation::request-page-setup
andGtkPrintOperation::draw-page
signals are 0-based, i.e. if the user chooses to print all pages, the lastdraw-page
signal will be for pagen_pages
- 1.Declaration
Swift
case notifyNPages = "notify::n-pages"
-
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 theGtkPrintOperation::status-changed
signal and callgtk_print_operation_get_n_pages_to_print()
when print status isGTK_PRINT_STATUS_GENERATING_DATA
. This is typically used to track the progress of print operation.Declaration
Swift
case notifyNPagesToPrint = "notify::n-pages-to-print"
-
The
GtkPrintSettings
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()
.Declaration
Swift
case notifyPrintSettings = "notify::print-settings"
-
Determines whether to show a progress dialog during the print operation.
Declaration
Swift
case notifyShowProgress = "notify::show-progress"
-
The status of the print operation.
Declaration
Swift
case notifyStatus = "notify::status"
-
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
GtkPrintOperation:status
property for a status value that is suitable for programmatic use.Declaration
Swift
case notifyStatusString = "notify::status-string"
-
If
true
, the print operation will support print of selection. This allows the print dialog to show a “Selection” button.Declaration
Swift
case notifySupportSelection = "notify::support-selection"
-
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.Declaration
Swift
case notifyTrackPrintStatus = "notify::track-print-status"
-
The transformation for the cairo context obtained from
GtkPrintContext
is set up in such a way that distances are measured in units ofunit
.Declaration
Swift
case notifyUnit = "notify::unit"
-
If
true
, the transformation for the cairo context obtained fromGtkPrintContext
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).Declaration
Swift
case notifyUseFullPage = "notify::use-full-page"