PrintOperationPreviewT

Description GtkPrintOperation is the high-level, portable printing API. It looks a bit different than other GTK+ dialogs such as the GtkFileChooser, since some platforms don't expose enough infrastructure to implement a good print dialog. On such platforms, GtkPrintOperation uses the native print dialog. On platforms which do not provide a native print dialog, GTK+ uses its own, see GtkPrintUnixDialog. The typical way to use the high-level printing API is to create a GtkPrintOperation object with gtk_print_operation_new() when the user selects to print. Then you set some properties on it, e.g. the page size, any GtkPrintSettings from previous print operations, the number of pages, the current page, etc. Then you start the print operation by calling gtk_print_operation_run(). It will then show a dialog, let the user select a printer and options. When the user finished the dialog various signals will be emitted on the GtkPrintOperation, the main one being ::draw-page, which you are supposed to catch and render the page on the provided GtkPrintContext using Cairo. By default GtkPrintOperation uses an external application to do print preview. To implement a custom print preview, an application must connect to the preview signal. The functions gtk_print_operation_print_preview_render_page(), gtk_print_operation_preview_end_preview() and gtk_print_operation_preview_is_selected() are useful when implementing a print preview. Printing support was added in GTK+ 2.10.

template PrintOperationPreviewT (
TStruct
) {}

Members

Functions

addOnGotPageSize
void addOnGotPageSize(void delegate(GtkPrintContext*, PageSetup, PrintOperationPreviewIF) dlg, ConnectFlags connectFlags)

The ::got-page-size signal is emitted once for each page that gets rendered to the preview. A handler for this signal should update the context according to page_setup and set up a suitable cairo context, using gtk_print_context_set_cairo_context().

addOnReady
void addOnReady(void delegate(GtkPrintContext*, PrintOperationPreviewIF) dlg, ConnectFlags connectFlags)

The ::ready signal gets emitted once per preview operation, before the first page is rendered. A handler for this signal can be used for setup tasks. See Also GtkPrintContext, GtkPrintUnixDialog

addOnUpdateCustomWidget
void addOnUpdateCustomWidget(void delegate(Widget, PageSetup, PrintSettings, PrintOperationPreviewIF) dlg, ConnectFlags connectFlags)

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. Since 2.18

endPreview
void endPreview()

Ends a preview. This function must be called to finish a custom print preview. Since 2.10

getPrintOperationPreviewTStruct
GtkPrintOperationPreview* getPrintOperationPreviewTStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
isSelected
int isSelected(int pageNr)

Returns whether the given page is included in the set of pages that have been selected for printing. Since 2.10

onGotPageSizeListeners
void delegate(GtkPrintContext*, PageSetup, PrintOperationPreviewIF)[] onGotPageSizeListeners()
Undocumented in source. Be warned that the author may not have intended to support it.
onReadyListeners
void delegate(GtkPrintContext*, PrintOperationPreviewIF)[] onReadyListeners()
Undocumented in source. Be warned that the author may not have intended to support it.
onUpdateCustomWidgetListeners
void delegate(Widget, PageSetup, PrintSettings, PrintOperationPreviewIF)[] onUpdateCustomWidgetListeners()
Undocumented in source. Be warned that the author may not have intended to support it.
renderPage
void renderPage(int pageNr)

Renders a page to the preview, using the print context that was passed to the "preview" handler together with preview. A custom iprint preview should use this function in its ::expose handler to render the currently selected page. Note that this function requires a suitable cairo context to be associated with the print context. Since 2.10

Static functions

callBackGotPageSize
void callBackGotPageSize(GtkPrintOperationPreview* previewStruct, GtkPrintContext* context, GtkPageSetup* pageSetup, PrintOperationPreviewIF _printOperationPreviewIF)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackReady
void callBackReady(GtkPrintOperationPreview* previewStruct, GtkPrintContext* context, PrintOperationPreviewIF _printOperationPreviewIF)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackUpdateCustomWidget
void callBackUpdateCustomWidget(GtkPrintOperation* operationStruct, GtkWidget* widget, GtkPageSetup* setup, GtkPrintSettings* settings, PrintOperationPreviewIF _printOperationPreviewIF)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

_onGotPageSizeListeners
void delegate(GtkPrintContext*, PageSetup, PrintOperationPreviewIF)[] _onGotPageSizeListeners;
Undocumented in source.
_onReadyListeners
void delegate(GtkPrintContext*, PrintOperationPreviewIF)[] _onReadyListeners;
Undocumented in source.
_onUpdateCustomWidgetListeners
void delegate(Widget, PageSetup, PrintSettings, PrintOperationPreviewIF)[] _onUpdateCustomWidgetListeners;
Undocumented in source.
connectedSignals
int[string] connectedSignals;
gtkPrintOperationPreview
GtkPrintOperationPreview* gtkPrintOperationPreview;

the main Gtk struct

Meta