Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
- Exported types
- Methods
- cancel
- drawPageFinish
- getDefaultPageSetup
- getEmbedPageSetup
- getError
- getHasSelection
- getNPagesToPrint
- getPrintSettings
- getStatus
- getStatusString
- getSupportSelection
- isFinished
- new
- run
- setAllowAsync
- setCurrentPage
- setCustomTabLabel
- setDefaultPageSetup
- setDeferDrawing
- setEmbedPageSetup
- setExportFilename
- setHasSelection
- setJobName
- setNPages
- setPrintSettings
- setShowProgress
- setSupportSelection
- setTrackPrintStatus
- setUnit
- setUseFullPage
- Properties
- Signals
GtkPrintOperation 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, 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 printOperationNew
when
the user selects to print. Then you set some properties on it,
e.g. 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 printOperationRun
.
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 PrintOperation
, the main one being
PrintOperation::drawPage, which you are supposed to catch
and render the page on the provided PrintContext
using Cairo.
The high-level printing API
C code
static GtkPrintSettings *settings = NULL; static void do_print (void) { GtkPrintOperation *print; GtkPrintOperationResult res; print = gtk_print_operation_new (); if (settings != NULL) gtk_print_operation_set_print_settings (print, settings); g_signal_connect (print, "begin_print", G_CALLBACK (begin_print), NULL); g_signal_connect (print, "draw_page", G_CALLBACK (draw_page), NULL); res = gtk_print_operation_run (print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, GTK_WINDOW (main_window), NULL); 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)); } g_object_unref (print); }
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
printOperationPreviewRenderPage
,
printOperationPreviewEndPreview
and
printOperationPreviewIsSelected
are useful when implementing a print preview.
Synopsis
- newtype PrintOperation = PrintOperation (ManagedPtr PrintOperation)
- class (GObject o, IsDescendantOf PrintOperation o) => IsPrintOperation o
- toPrintOperation :: (MonadIO m, IsPrintOperation o) => o -> m PrintOperation
- printOperationCancel :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> m ()
- printOperationDrawPageFinish :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> m ()
- printOperationGetDefaultPageSetup :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> m PageSetup
- printOperationGetEmbedPageSetup :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> m Bool
- printOperationGetError :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> m ()
- printOperationGetHasSelection :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> m Bool
- printOperationGetNPagesToPrint :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> m Int32
- printOperationGetPrintSettings :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> m PrintSettings
- printOperationGetStatus :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> m PrintStatus
- printOperationGetStatusString :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> m Text
- printOperationGetSupportSelection :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> m Bool
- printOperationIsFinished :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> m Bool
- printOperationNew :: (HasCallStack, MonadIO m) => m PrintOperation
- printOperationRun :: (HasCallStack, MonadIO m, IsPrintOperation a, IsWindow b) => a -> PrintOperationAction -> Maybe b -> m PrintOperationResult
- printOperationSetAllowAsync :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> Bool -> m ()
- printOperationSetCurrentPage :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> Int32 -> m ()
- printOperationSetCustomTabLabel :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> Maybe Text -> m ()
- printOperationSetDefaultPageSetup :: (HasCallStack, MonadIO m, IsPrintOperation a, IsPageSetup b) => a -> Maybe b -> m ()
- printOperationSetDeferDrawing :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> m ()
- printOperationSetEmbedPageSetup :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> Bool -> m ()
- printOperationSetExportFilename :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> [Char] -> m ()
- printOperationSetHasSelection :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> Bool -> m ()
- printOperationSetJobName :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> Text -> m ()
- printOperationSetNPages :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> Int32 -> m ()
- printOperationSetPrintSettings :: (HasCallStack, MonadIO m, IsPrintOperation a, IsPrintSettings b) => a -> Maybe b -> m ()
- printOperationSetShowProgress :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> Bool -> m ()
- printOperationSetSupportSelection :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> Bool -> m ()
- printOperationSetTrackPrintStatus :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> Bool -> m ()
- printOperationSetUnit :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> Unit -> m ()
- printOperationSetUseFullPage :: (HasCallStack, MonadIO m, IsPrintOperation a) => a -> Bool -> m ()
- constructPrintOperationAllowAsync :: (IsPrintOperation o, MonadIO m) => Bool -> m (GValueConstruct o)
- getPrintOperationAllowAsync :: (MonadIO m, IsPrintOperation o) => o -> m Bool
- setPrintOperationAllowAsync :: (MonadIO m, IsPrintOperation o) => o -> Bool -> m ()
- constructPrintOperationCurrentPage :: (IsPrintOperation o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getPrintOperationCurrentPage :: (MonadIO m, IsPrintOperation o) => o -> m Int32
- setPrintOperationCurrentPage :: (MonadIO m, IsPrintOperation o) => o -> Int32 -> m ()
- clearPrintOperationCustomTabLabel :: (MonadIO m, IsPrintOperation o) => o -> m ()
- constructPrintOperationCustomTabLabel :: (IsPrintOperation o, MonadIO m) => Text -> m (GValueConstruct o)
- getPrintOperationCustomTabLabel :: (MonadIO m, IsPrintOperation o) => o -> m (Maybe Text)
- setPrintOperationCustomTabLabel :: (MonadIO m, IsPrintOperation o) => o -> Text -> m ()
- clearPrintOperationDefaultPageSetup :: (MonadIO m, IsPrintOperation o) => o -> m ()
- constructPrintOperationDefaultPageSetup :: (IsPrintOperation o, MonadIO m, IsPageSetup a) => a -> m (GValueConstruct o)
- getPrintOperationDefaultPageSetup :: (MonadIO m, IsPrintOperation o) => o -> m PageSetup
- setPrintOperationDefaultPageSetup :: (MonadIO m, IsPrintOperation o, IsPageSetup a) => o -> a -> m ()
- constructPrintOperationEmbedPageSetup :: (IsPrintOperation o, MonadIO m) => Bool -> m (GValueConstruct o)
- getPrintOperationEmbedPageSetup :: (MonadIO m, IsPrintOperation o) => o -> m Bool
- setPrintOperationEmbedPageSetup :: (MonadIO m, IsPrintOperation o) => o -> Bool -> m ()
- clearPrintOperationExportFilename :: (MonadIO m, IsPrintOperation o) => o -> m ()
- constructPrintOperationExportFilename :: (IsPrintOperation o, MonadIO m) => Text -> m (GValueConstruct o)
- getPrintOperationExportFilename :: (MonadIO m, IsPrintOperation o) => o -> m (Maybe Text)
- setPrintOperationExportFilename :: (MonadIO m, IsPrintOperation o) => o -> Text -> m ()
- constructPrintOperationHasSelection :: (IsPrintOperation o, MonadIO m) => Bool -> m (GValueConstruct o)
- getPrintOperationHasSelection :: (MonadIO m, IsPrintOperation o) => o -> m Bool
- setPrintOperationHasSelection :: (MonadIO m, IsPrintOperation o) => o -> Bool -> m ()
- constructPrintOperationJobName :: (IsPrintOperation o, MonadIO m) => Text -> m (GValueConstruct o)
- getPrintOperationJobName :: (MonadIO m, IsPrintOperation o) => o -> m (Maybe Text)
- setPrintOperationJobName :: (MonadIO m, IsPrintOperation o) => o -> Text -> m ()
- constructPrintOperationNPages :: (IsPrintOperation o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getPrintOperationNPages :: (MonadIO m, IsPrintOperation o) => o -> m Int32
- setPrintOperationNPages :: (MonadIO m, IsPrintOperation o) => o -> Int32 -> m ()
- getPrintOperationNPagesToPrint :: (MonadIO m, IsPrintOperation o) => o -> m Int32
- clearPrintOperationPrintSettings :: (MonadIO m, IsPrintOperation o) => o -> m ()
- constructPrintOperationPrintSettings :: (IsPrintOperation o, MonadIO m, IsPrintSettings a) => a -> m (GValueConstruct o)
- getPrintOperationPrintSettings :: (MonadIO m, IsPrintOperation o) => o -> m PrintSettings
- setPrintOperationPrintSettings :: (MonadIO m, IsPrintOperation o, IsPrintSettings a) => o -> a -> m ()
- constructPrintOperationShowProgress :: (IsPrintOperation o, MonadIO m) => Bool -> m (GValueConstruct o)
- getPrintOperationShowProgress :: (MonadIO m, IsPrintOperation o) => o -> m Bool
- setPrintOperationShowProgress :: (MonadIO m, IsPrintOperation o) => o -> Bool -> m ()
- getPrintOperationStatus :: (MonadIO m, IsPrintOperation o) => o -> m PrintStatus
- getPrintOperationStatusString :: (MonadIO m, IsPrintOperation o) => o -> m Text
- constructPrintOperationSupportSelection :: (IsPrintOperation o, MonadIO m) => Bool -> m (GValueConstruct o)
- getPrintOperationSupportSelection :: (MonadIO m, IsPrintOperation o) => o -> m Bool
- setPrintOperationSupportSelection :: (MonadIO m, IsPrintOperation o) => o -> Bool -> m ()
- constructPrintOperationTrackPrintStatus :: (IsPrintOperation o, MonadIO m) => Bool -> m (GValueConstruct o)
- getPrintOperationTrackPrintStatus :: (MonadIO m, IsPrintOperation o) => o -> m Bool
- setPrintOperationTrackPrintStatus :: (MonadIO m, IsPrintOperation o) => o -> Bool -> m ()
- constructPrintOperationUnit :: (IsPrintOperation o, MonadIO m) => Unit -> m (GValueConstruct o)
- getPrintOperationUnit :: (MonadIO m, IsPrintOperation o) => o -> m Unit
- setPrintOperationUnit :: (MonadIO m, IsPrintOperation o) => o -> Unit -> m ()
- constructPrintOperationUseFullPage :: (IsPrintOperation o, MonadIO m) => Bool -> m (GValueConstruct o)
- getPrintOperationUseFullPage :: (MonadIO m, IsPrintOperation o) => o -> m Bool
- setPrintOperationUseFullPage :: (MonadIO m, IsPrintOperation o) => o -> Bool -> m ()
- type PrintOperationBeginPrintCallback = PrintContext -> IO ()
- afterPrintOperationBeginPrint :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationBeginPrintCallback) -> m SignalHandlerId
- onPrintOperationBeginPrint :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationBeginPrintCallback) -> m SignalHandlerId
- type PrintOperationCreateCustomWidgetCallback = IO Object
- afterPrintOperationCreateCustomWidget :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationCreateCustomWidgetCallback) -> m SignalHandlerId
- onPrintOperationCreateCustomWidget :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationCreateCustomWidgetCallback) -> m SignalHandlerId
- type PrintOperationCustomWidgetApplyCallback = Widget -> IO ()
- afterPrintOperationCustomWidgetApply :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationCustomWidgetApplyCallback) -> m SignalHandlerId
- onPrintOperationCustomWidgetApply :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationCustomWidgetApplyCallback) -> m SignalHandlerId
- type PrintOperationDoneCallback = PrintOperationResult -> IO ()
- afterPrintOperationDone :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationDoneCallback) -> m SignalHandlerId
- onPrintOperationDone :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationDoneCallback) -> m SignalHandlerId
- type PrintOperationDrawPageCallback = PrintContext -> Int32 -> IO ()
- afterPrintOperationDrawPage :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationDrawPageCallback) -> m SignalHandlerId
- onPrintOperationDrawPage :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationDrawPageCallback) -> m SignalHandlerId
- type PrintOperationEndPrintCallback = PrintContext -> IO ()
- afterPrintOperationEndPrint :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationEndPrintCallback) -> m SignalHandlerId
- onPrintOperationEndPrint :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationEndPrintCallback) -> m SignalHandlerId
- type PrintOperationPaginateCallback = PrintContext -> IO Bool
- afterPrintOperationPaginate :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationPaginateCallback) -> m SignalHandlerId
- onPrintOperationPaginate :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationPaginateCallback) -> m SignalHandlerId
- type PrintOperationPreviewCallback = PrintOperationPreview -> PrintContext -> Maybe Window -> IO Bool
- afterPrintOperationPreview :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationPreviewCallback) -> m SignalHandlerId
- onPrintOperationPreview :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationPreviewCallback) -> m SignalHandlerId
- type PrintOperationRequestPageSetupCallback = PrintContext -> Int32 -> PageSetup -> IO ()
- afterPrintOperationRequestPageSetup :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationRequestPageSetupCallback) -> m SignalHandlerId
- onPrintOperationRequestPageSetup :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationRequestPageSetupCallback) -> m SignalHandlerId
- type PrintOperationStatusChangedCallback = IO ()
- afterPrintOperationStatusChanged :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationStatusChangedCallback) -> m SignalHandlerId
- onPrintOperationStatusChanged :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationStatusChangedCallback) -> m SignalHandlerId
- type PrintOperationUpdateCustomWidgetCallback = Widget -> PageSetup -> PrintSettings -> IO ()
- afterPrintOperationUpdateCustomWidget :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationUpdateCustomWidgetCallback) -> m SignalHandlerId
- onPrintOperationUpdateCustomWidget :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationUpdateCustomWidgetCallback) -> m SignalHandlerId
Exported types
newtype PrintOperation Source #
Memory-managed wrapper type.
PrintOperation (ManagedPtr PrintOperation) |
Instances
Eq PrintOperation Source # | |
Defined in GI.Gtk.Objects.PrintOperation (==) :: PrintOperation -> PrintOperation -> Bool # (/=) :: PrintOperation -> PrintOperation -> Bool # | |
GObject PrintOperation Source # | |
Defined in GI.Gtk.Objects.PrintOperation | |
ManagedPtrNewtype PrintOperation Source # | |
Defined in GI.Gtk.Objects.PrintOperation toManagedPtr :: PrintOperation -> ManagedPtr PrintOperation | |
TypedObject PrintOperation Source # | |
Defined in GI.Gtk.Objects.PrintOperation | |
HasParentTypes PrintOperation Source # | |
Defined in GI.Gtk.Objects.PrintOperation | |
IsGValue (Maybe PrintOperation) Source # | Convert |
Defined in GI.Gtk.Objects.PrintOperation gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe PrintOperation -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe PrintOperation) | |
type ParentTypes PrintOperation Source # | |
Defined in GI.Gtk.Objects.PrintOperation |
class (GObject o, IsDescendantOf PrintOperation o) => IsPrintOperation o Source #
Type class for types which can be safely cast to PrintOperation
, for instance with toPrintOperation
.
Instances
(GObject o, IsDescendantOf PrintOperation o) => IsPrintOperation o Source # | |
Defined in GI.Gtk.Objects.PrintOperation |
toPrintOperation :: (MonadIO m, IsPrintOperation o) => o -> m PrintOperation Source #
Cast to PrintOperation
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, cancel, drawPageFinish, endPreview, forceFloating, freezeNotify, getv, isFinished, isFloating, isSelected, notify, notifyByPspec, ref, refSink, renderPage, run, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getData, getDefaultPageSetup, getEmbedPageSetup, getError, getHasSelection, getNPagesToPrint, getPrintSettings, getProperty, getQdata, getStatus, getStatusString, getSupportSelection.
Setters
setAllowAsync, setCurrentPage, setCustomTabLabel, setData, setDataFull, setDefaultPageSetup, setDeferDrawing, setEmbedPageSetup, setExportFilename, setHasSelection, setJobName, setNPages, setPrintSettings, setProperty, setShowProgress, setSupportSelection, setTrackPrintStatus, setUnit, setUseFullPage.
cancel
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> m () |
Cancels a running print operation. This function may be called from a PrintOperation::beginPrint, PrintOperation::paginate or PrintOperation::drawPage signal handler to stop the currently running print operation.
Since: 2.10
drawPageFinish
printOperationDrawPageFinish Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> m () |
Signalize that drawing of particular page is complete.
It is called after completion of page drawing (e.g. drawing in another
thread).
If printOperationSetDeferDrawing
was called before, then this function
has to be called by application. In another case it is called by the library
itself.
Since: 2.16
getDefaultPageSetup
printOperationGetDefaultPageSetup Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> m PageSetup | Returns: the default page setup |
Returns the default page setup, see
printOperationSetDefaultPageSetup
.
Since: 2.10
getEmbedPageSetup
printOperationGetEmbedPageSetup Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> m Bool | Returns: whether page setup selection combos are embedded |
Gets the value of PrintOperation:embedPageSetup property.
Since: 2.18
getError
printOperationGetError Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> m () | (Can throw |
Call this when the result of a print operation is
PrintOperationResultError
, either as returned by
printOperationRun
, or in the PrintOperation::done signal
handler. The returned GError
will contain more details on what went wrong.
Since: 2.10
getHasSelection
printOperationGetHasSelection Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> m Bool | Returns: whether there is a selection |
Gets the value of PrintOperation:hasSelection property.
Since: 2.18
getNPagesToPrint
printOperationGetNPagesToPrint Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> m Int32 | Returns: the number of pages that will be printed |
Returns the number of pages that will be printed.
Note that this value is set during print preparation phase
(PrintStatusPreparing
), so this function should never be
called before the data generation phase (PrintStatusGeneratingData
).
You can connect to the PrintOperation::statusChanged signal
and call printOperationGetNPagesToPrint
when
print status is PrintStatusGeneratingData
.
This is typically used to track the progress of print operation.
Since: 2.18
getPrintSettings
printOperationGetPrintSettings Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> m PrintSettings | Returns: the current print settings of |
Returns the current print settings.
Note that the return value is Nothing
until either
printOperationSetPrintSettings
or
printOperationRun
have been called.
Since: 2.10
getStatus
printOperationGetStatus Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> m PrintStatus | Returns: the status of the print operation |
Returns the status of the print operation.
Also see printOperationGetStatusString
.
Since: 2.10
getStatusString
printOperationGetStatusString Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> m Text | Returns: a string representation of the status of the print operation |
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 Statusbar
.
Use printOperationGetStatus
to obtain a status
value that is suitable for programmatic use.
Since: 2.10
getSupportSelection
printOperationGetSupportSelection Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> m Bool | Returns: whether the application supports print of selection |
Gets the value of PrintOperation:supportSelection property.
Since: 2.18
isFinished
printOperationIsFinished Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> m Bool | Returns: |
A convenience function to find out if the print operation
is finished, either successfully (PrintStatusFinished
)
or unsuccessfully (PrintStatusFinishedAborted
).
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: 2.10
new
:: (HasCallStack, MonadIO m) | |
=> m PrintOperation | Returns: a new |
Creates a new PrintOperation
.
Since: 2.10
run
:: (HasCallStack, MonadIO m, IsPrintOperation a, IsWindow b) | |
=> a |
|
-> PrintOperationAction |
|
-> Maybe b |
|
-> m PrintOperationResult | Returns: the result of the print operation. A return value of
|
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
PrintOperation::statusChanged 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 printOperationSetAllowAsync
or set the
PrintOperation:allowAsync property the operation will run
asynchronously if this is supported on the platform. The
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).
C code
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 printOperationRun
can only be called once on a
given PrintOperation
.
Since: 2.10
setAllowAsync
printOperationSetAllowAsync Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether the printOperationRun
may return
before the print operation is completed. Note that
some platforms may not allow asynchronous operation.
Since: 2.10
setCurrentPage
printOperationSetCurrentPage Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> Int32 |
|
-> m () |
Sets the current page.
If this is called before printOperationRun
,
the user will be able to select to print only the current page.
Note that this only makes sense for pre-paginated documents.
Since: 2.10
setCustomTabLabel
printOperationSetCustomTabLabel Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> Maybe Text |
|
-> m () |
Sets the label for the tab holding custom widgets.
Since: 2.10
setDefaultPageSetup
printOperationSetDefaultPageSetup Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a, IsPageSetup b) | |
=> a |
|
-> Maybe b | |
-> m () |
Makes defaultPageSetup
the default page setup for op
.
This page setup will be used by printOperationRun
,
but it can be overridden on a per-page basis by connecting
to the PrintOperation::requestPageSetup signal.
Since: 2.10
setDeferDrawing
printOperationSetDeferDrawing Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> m () |
Sets up the PrintOperation
to wait for calling of
printOperationDrawPageFinish
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: 2.16
setEmbedPageSetup
printOperationSetEmbedPageSetup Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> Bool |
|
-> m () |
Embed page size combo box and orientation combo box into page setup page.
Selected page setup is stored as default page setup in PrintOperation
.
Since: 2.18
setExportFilename
printOperationSetExportFilename Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> [Char] |
|
-> m () |
Sets up the 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: 2.10
setHasSelection
printOperationSetHasSelection Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether there is a selection to print.
Application has to set number of pages to which the selection
will draw by printOperationSetNPages
in a callback of
PrintOperation::beginPrint.
Since: 2.18
setJobName
printOperationSetJobName Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> Text |
|
-> m () |
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: 2.10
setNPages
printOperationSetNPages Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> Int32 |
|
-> m () |
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 PrintOperation::beginPrint signal hander.
Note that the page numbers passed to the
PrintOperation::requestPageSetup
and PrintOperation::drawPage signals are 0-based, i.e. if
the user chooses to print all pages, the last drawPage signal
will be for page nPages
- 1.
Since: 2.10
setPrintSettings
printOperationSetPrintSettings Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a, IsPrintSettings b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the print settings for op
. This is typically used to
re-establish print settings from a previous print operation,
see printOperationRun
.
Since: 2.10
setShowProgress
printOperationSetShowProgress Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> Bool |
|
-> m () |
If showProgress
is True
, the print operation will show a
progress dialog during the print operation.
Since: 2.10
setSupportSelection
printOperationSetSupportSelection Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether selection is supported by PrintOperation
.
Since: 2.18
setTrackPrintStatus
printOperationSetTrackPrintStatus Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> Bool |
|
-> m () |
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: 2.10
setUnit
printOperationSetUnit Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> Unit |
|
-> m () |
Sets up the transformation for the cairo context obtained from
PrintContext
in such a way that distances are measured in
units of unit
.
Since: 2.10
setUseFullPage
printOperationSetUseFullPage Source #
:: (HasCallStack, MonadIO m, IsPrintOperation a) | |
=> a |
|
-> Bool |
|
-> m () |
If fullPage
is True
, the transformation for the cairo context
obtained from 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: 2.10
Properties
allowAsync
Determines whether the print operation may run asynchronously or not.
Some systems don't support asynchronous printing, but those that do
will return PrintOperationResultInProgress
as the status, and
emit the 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
PrintOperationActionExport
support asynchronous operation.
Since: 2.10
constructPrintOperationAllowAsync :: (IsPrintOperation o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “allow-async
” property. This is rarely needed directly, but it is used by new
.
getPrintOperationAllowAsync :: (MonadIO m, IsPrintOperation o) => o -> m Bool Source #
Get the value of the “allow-async
” property.
When overloading is enabled, this is equivalent to
get
printOperation #allowAsync
setPrintOperationAllowAsync :: (MonadIO m, IsPrintOperation o) => o -> Bool -> m () Source #
Set the value of the “allow-async
” property.
When overloading is enabled, this is equivalent to
set
printOperation [ #allowAsync:=
value ]
currentPage
The current page in the document.
If this is set before printOperationRun
,
the user will be able to select to print only the current page.
Note that this only makes sense for pre-paginated documents.
Since: 2.10
constructPrintOperationCurrentPage :: (IsPrintOperation o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “current-page
” property. This is rarely needed directly, but it is used by new
.
getPrintOperationCurrentPage :: (MonadIO m, IsPrintOperation o) => o -> m Int32 Source #
Get the value of the “current-page
” property.
When overloading is enabled, this is equivalent to
get
printOperation #currentPage
setPrintOperationCurrentPage :: (MonadIO m, IsPrintOperation o) => o -> Int32 -> m () Source #
Set the value of the “current-page
” property.
When overloading is enabled, this is equivalent to
set
printOperation [ #currentPage:=
value ]
customTabLabel
Used as the label of the tab containing custom widgets. Note that this property may be ignored on some platforms.
If this is Nothing
, GTK+ uses a default label.
Since: 2.10
clearPrintOperationCustomTabLabel :: (MonadIO m, IsPrintOperation o) => o -> m () Source #
Set the value of the “custom-tab-label
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#customTabLabel
constructPrintOperationCustomTabLabel :: (IsPrintOperation o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “custom-tab-label
” property. This is rarely needed directly, but it is used by new
.
getPrintOperationCustomTabLabel :: (MonadIO m, IsPrintOperation o) => o -> m (Maybe Text) Source #
Get the value of the “custom-tab-label
” property.
When overloading is enabled, this is equivalent to
get
printOperation #customTabLabel
setPrintOperationCustomTabLabel :: (MonadIO m, IsPrintOperation o) => o -> Text -> m () Source #
Set the value of the “custom-tab-label
” property.
When overloading is enabled, this is equivalent to
set
printOperation [ #customTabLabel:=
value ]
defaultPageSetup
The PageSetup
used by default.
This page setup will be used by printOperationRun
,
but it can be overridden on a per-page basis by connecting
to the PrintOperation::requestPageSetup signal.
Since: 2.10
clearPrintOperationDefaultPageSetup :: (MonadIO m, IsPrintOperation o) => o -> m () Source #
Set the value of the “default-page-setup
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#defaultPageSetup
constructPrintOperationDefaultPageSetup :: (IsPrintOperation o, MonadIO m, IsPageSetup a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “default-page-setup
” property. This is rarely needed directly, but it is used by new
.
getPrintOperationDefaultPageSetup :: (MonadIO m, IsPrintOperation o) => o -> m PageSetup Source #
Get the value of the “default-page-setup
” property.
When overloading is enabled, this is equivalent to
get
printOperation #defaultPageSetup
setPrintOperationDefaultPageSetup :: (MonadIO m, IsPrintOperation o, IsPageSetup a) => o -> a -> m () Source #
Set the value of the “default-page-setup
” property.
When overloading is enabled, this is equivalent to
set
printOperation [ #defaultPageSetup:=
value ]
embedPageSetup
If True
, page size combo box and orientation combo box are embedded into page setup page.
Since: 2.18
constructPrintOperationEmbedPageSetup :: (IsPrintOperation o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “embed-page-setup
” property. This is rarely needed directly, but it is used by new
.
getPrintOperationEmbedPageSetup :: (MonadIO m, IsPrintOperation o) => o -> m Bool Source #
Get the value of the “embed-page-setup
” property.
When overloading is enabled, this is equivalent to
get
printOperation #embedPageSetup
setPrintOperationEmbedPageSetup :: (MonadIO m, IsPrintOperation o) => o -> Bool -> m () Source #
Set the value of the “embed-page-setup
” property.
When overloading is enabled, this is equivalent to
set
printOperation [ #embedPageSetup:=
value ]
exportFilename
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.
Since: 2.10
clearPrintOperationExportFilename :: (MonadIO m, IsPrintOperation o) => o -> m () Source #
Set the value of the “export-filename
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#exportFilename
constructPrintOperationExportFilename :: (IsPrintOperation o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “export-filename
” property. This is rarely needed directly, but it is used by new
.
getPrintOperationExportFilename :: (MonadIO m, IsPrintOperation o) => o -> m (Maybe Text) Source #
Get the value of the “export-filename
” property.
When overloading is enabled, this is equivalent to
get
printOperation #exportFilename
setPrintOperationExportFilename :: (MonadIO m, IsPrintOperation o) => o -> Text -> m () Source #
Set the value of the “export-filename
” property.
When overloading is enabled, this is equivalent to
set
printOperation [ #exportFilename:=
value ]
hasSelection
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.
Since: 2.18
constructPrintOperationHasSelection :: (IsPrintOperation o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “has-selection
” property. This is rarely needed directly, but it is used by new
.
getPrintOperationHasSelection :: (MonadIO m, IsPrintOperation o) => o -> m Bool Source #
Get the value of the “has-selection
” property.
When overloading is enabled, this is equivalent to
get
printOperation #hasSelection
setPrintOperationHasSelection :: (MonadIO m, IsPrintOperation o) => o -> Bool -> m () Source #
Set the value of the “has-selection
” property.
When overloading is enabled, this is equivalent to
set
printOperation [ #hasSelection:=
value ]
jobName
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.
Since: 2.10
constructPrintOperationJobName :: (IsPrintOperation o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “job-name
” property. This is rarely needed directly, but it is used by new
.
getPrintOperationJobName :: (MonadIO m, IsPrintOperation o) => o -> m (Maybe Text) Source #
Get the value of the “job-name
” property.
When overloading is enabled, this is equivalent to
get
printOperation #jobName
setPrintOperationJobName :: (MonadIO m, IsPrintOperation o) => o -> Text -> m () Source #
Set the value of the “job-name
” property.
When overloading is enabled, this is equivalent to
set
printOperation [ #jobName:=
value ]
nPages
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 PrintOperation::beginPrint signal hander.
Note that the page numbers passed to the
PrintOperation::requestPageSetup and
PrintOperation::drawPage signals are 0-based, i.e. if
the user chooses to print all pages, the last drawPage signal
will be for page nPages
- 1.
Since: 2.10
constructPrintOperationNPages :: (IsPrintOperation o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “n-pages
” property. This is rarely needed directly, but it is used by new
.
getPrintOperationNPages :: (MonadIO m, IsPrintOperation o) => o -> m Int32 Source #
Get the value of the “n-pages
” property.
When overloading is enabled, this is equivalent to
get
printOperation #nPages
setPrintOperationNPages :: (MonadIO m, IsPrintOperation o) => o -> Int32 -> m () Source #
Set the value of the “n-pages
” property.
When overloading is enabled, this is equivalent to
set
printOperation [ #nPages:=
value ]
nPagesToPrint
The number of pages that will be printed.
Note that this value is set during print preparation phase
(PrintStatusPreparing
), so this value should never be
get before the data generation phase (PrintStatusGeneratingData
).
You can connect to the PrintOperation::statusChanged signal
and call printOperationGetNPagesToPrint
when
print status is PrintStatusGeneratingData
.
This is typically used to track the progress of print operation.
Since: 2.18
getPrintOperationNPagesToPrint :: (MonadIO m, IsPrintOperation o) => o -> m Int32 Source #
Get the value of the “n-pages-to-print
” property.
When overloading is enabled, this is equivalent to
get
printOperation #nPagesToPrint
printSettings
The PrintSettings
used for initializing the dialog.
Setting this property is typically used to re-establish
print settings from a previous print operation, see
printOperationRun
.
Since: 2.10
clearPrintOperationPrintSettings :: (MonadIO m, IsPrintOperation o) => o -> m () Source #
Set the value of the “print-settings
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#printSettings
constructPrintOperationPrintSettings :: (IsPrintOperation o, MonadIO m, IsPrintSettings a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “print-settings
” property. This is rarely needed directly, but it is used by new
.
getPrintOperationPrintSettings :: (MonadIO m, IsPrintOperation o) => o -> m PrintSettings Source #
Get the value of the “print-settings
” property.
When overloading is enabled, this is equivalent to
get
printOperation #printSettings
setPrintOperationPrintSettings :: (MonadIO m, IsPrintOperation o, IsPrintSettings a) => o -> a -> m () Source #
Set the value of the “print-settings
” property.
When overloading is enabled, this is equivalent to
set
printOperation [ #printSettings:=
value ]
showProgress
Determines whether to show a progress dialog during the print operation.
Since: 2.10
constructPrintOperationShowProgress :: (IsPrintOperation o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “show-progress
” property. This is rarely needed directly, but it is used by new
.
getPrintOperationShowProgress :: (MonadIO m, IsPrintOperation o) => o -> m Bool Source #
Get the value of the “show-progress
” property.
When overloading is enabled, this is equivalent to
get
printOperation #showProgress
setPrintOperationShowProgress :: (MonadIO m, IsPrintOperation o) => o -> Bool -> m () Source #
Set the value of the “show-progress
” property.
When overloading is enabled, this is equivalent to
set
printOperation [ #showProgress:=
value ]
status
The status of the print operation.
Since: 2.10
getPrintOperationStatus :: (MonadIO m, IsPrintOperation o) => o -> m PrintStatus Source #
Get the value of the “status
” property.
When overloading is enabled, this is equivalent to
get
printOperation #status
statusString
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 Statusbar
.
See the PrintOperation:status property for a status value that is suitable for programmatic use.
Since: 2.10
getPrintOperationStatusString :: (MonadIO m, IsPrintOperation o) => o -> m Text Source #
Get the value of the “status-string
” property.
When overloading is enabled, this is equivalent to
get
printOperation #statusString
supportSelection
If True
, the print operation will support print of selection.
This allows the print dialog to show a "Selection" button.
Since: 2.18
constructPrintOperationSupportSelection :: (IsPrintOperation o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “support-selection
” property. This is rarely needed directly, but it is used by new
.
getPrintOperationSupportSelection :: (MonadIO m, IsPrintOperation o) => o -> m Bool Source #
Get the value of the “support-selection
” property.
When overloading is enabled, this is equivalent to
get
printOperation #supportSelection
setPrintOperationSupportSelection :: (MonadIO m, IsPrintOperation o) => o -> Bool -> m () Source #
Set the value of the “support-selection
” property.
When overloading is enabled, this is equivalent to
set
printOperation [ #supportSelection:=
value ]
trackPrintStatus
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.
Since: 2.10
constructPrintOperationTrackPrintStatus :: (IsPrintOperation o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “track-print-status
” property. This is rarely needed directly, but it is used by new
.
getPrintOperationTrackPrintStatus :: (MonadIO m, IsPrintOperation o) => o -> m Bool Source #
Get the value of the “track-print-status
” property.
When overloading is enabled, this is equivalent to
get
printOperation #trackPrintStatus
setPrintOperationTrackPrintStatus :: (MonadIO m, IsPrintOperation o) => o -> Bool -> m () Source #
Set the value of the “track-print-status
” property.
When overloading is enabled, this is equivalent to
set
printOperation [ #trackPrintStatus:=
value ]
unit
The transformation for the cairo context obtained from
PrintContext
is set up in such a way that distances
are measured in units of unit
.
Since: 2.10
constructPrintOperationUnit :: (IsPrintOperation o, MonadIO m) => Unit -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “unit
” property. This is rarely needed directly, but it is used by new
.
getPrintOperationUnit :: (MonadIO m, IsPrintOperation o) => o -> m Unit Source #
Get the value of the “unit
” property.
When overloading is enabled, this is equivalent to
get
printOperation #unit
setPrintOperationUnit :: (MonadIO m, IsPrintOperation o) => o -> Unit -> m () Source #
Set the value of the “unit
” property.
When overloading is enabled, this is equivalent to
set
printOperation [ #unit:=
value ]
useFullPage
If True
, the transformation for the cairo context obtained
from 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: 2.10
constructPrintOperationUseFullPage :: (IsPrintOperation o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “use-full-page
” property. This is rarely needed directly, but it is used by new
.
getPrintOperationUseFullPage :: (MonadIO m, IsPrintOperation o) => o -> m Bool Source #
Get the value of the “use-full-page
” property.
When overloading is enabled, this is equivalent to
get
printOperation #useFullPage
setPrintOperationUseFullPage :: (MonadIO m, IsPrintOperation o) => o -> Bool -> m () Source #
Set the value of the “use-full-page
” property.
When overloading is enabled, this is equivalent to
set
printOperation [ #useFullPage:=
value ]
Signals
beginPrint
type PrintOperationBeginPrintCallback Source #
= PrintContext |
|
-> IO () |
Emitted after the user has finished changing print settings in the dialog, before the actual rendering starts.
A typical use for beginPrint is to use the parameters from the
PrintContext
and paginate the document accordingly, and then
set the number of pages with printOperationSetNPages
.
Since: 2.10
afterPrintOperationBeginPrint :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationBeginPrintCallback) -> m SignalHandlerId Source #
Connect a signal handler for the beginPrint signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
printOperation #beginPrint callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onPrintOperationBeginPrint :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationBeginPrintCallback) -> m SignalHandlerId Source #
Connect a signal handler for the beginPrint signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
printOperation #beginPrint callback
createCustomWidget
type PrintOperationCreateCustomWidgetCallback Source #
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 PrintOperation::customWidgetApply signal is emitted on the operation. Then you can read out any information you need from the widgets.
Since: 2.10
afterPrintOperationCreateCustomWidget :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationCreateCustomWidgetCallback) -> m SignalHandlerId Source #
Connect a signal handler for the createCustomWidget signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
printOperation #createCustomWidget callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onPrintOperationCreateCustomWidget :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationCreateCustomWidgetCallback) -> m SignalHandlerId Source #
Connect a signal handler for the createCustomWidget signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
printOperation #createCustomWidget callback
customWidgetApply
type PrintOperationCustomWidgetApplyCallback Source #
Emitted right before PrintOperation::beginPrint if you added a custom widget in the PrintOperation::createCustomWidget 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.
Since: 2.10
afterPrintOperationCustomWidgetApply :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationCustomWidgetApplyCallback) -> m SignalHandlerId Source #
Connect a signal handler for the customWidgetApply signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
printOperation #customWidgetApply callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onPrintOperationCustomWidgetApply :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationCustomWidgetApplyCallback) -> m SignalHandlerId Source #
Connect a signal handler for the customWidgetApply signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
printOperation #customWidgetApply callback
done
type PrintOperationDoneCallback Source #
= PrintOperationResult |
|
-> IO () |
Emitted when the print operation run has finished doing everything required for printing.
result
gives you information about what happened during the run.
If result
is PrintOperationResultError
then you can call
printOperationGetError
for more information.
If you enabled print status tracking then
printOperationIsFinished
may still return False
after PrintOperation::done was emitted.
Since: 2.10
afterPrintOperationDone :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationDoneCallback) -> m SignalHandlerId Source #
Connect a signal handler for the done signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
printOperation #done callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onPrintOperationDone :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationDoneCallback) -> m SignalHandlerId Source #
Connect a signal handler for the done signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
printOperation #done callback
drawPage
type PrintOperationDrawPageCallback Source #
= PrintContext |
|
-> Int32 |
|
-> IO () |
Emitted for every page that is printed. The signal handler
must render the pageNr
's page onto the cairo context obtained
from context
using printContextGetCairoContext
.
C code
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 printOperationSetUseFullPage
and
printOperationSetUnit
before starting the print operation
to set up the transformation of the cairo context according to your
needs.
Since: 2.10
afterPrintOperationDrawPage :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationDrawPageCallback) -> m SignalHandlerId Source #
Connect a signal handler for the drawPage signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
printOperation #drawPage callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onPrintOperationDrawPage :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationDrawPageCallback) -> m SignalHandlerId Source #
Connect a signal handler for the drawPage signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
printOperation #drawPage callback
endPrint
type PrintOperationEndPrintCallback Source #
= PrintContext |
|
-> IO () |
Emitted after all pages have been rendered. A handler for this signal can clean up any resources that have been allocated in the PrintOperation::beginPrint handler.
Since: 2.10
afterPrintOperationEndPrint :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationEndPrintCallback) -> m SignalHandlerId Source #
Connect a signal handler for the endPrint signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
printOperation #endPrint callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onPrintOperationEndPrint :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationEndPrintCallback) -> m SignalHandlerId Source #
Connect a signal handler for the endPrint signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
printOperation #endPrint callback
paginate
type PrintOperationPaginateCallback Source #
= PrintContext |
|
-> IO Bool | Returns: |
Emitted after the PrintOperation::beginPrint signal, but before
the actual rendering starts. It keeps getting emitted until a connected
signal handler returns True
.
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 using
printOperationSetNPages
, and return True
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 beginPrint handler, and set the number of pages from there.
Since: 2.10
afterPrintOperationPaginate :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationPaginateCallback) -> m SignalHandlerId Source #
Connect a signal handler for the paginate signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
printOperation #paginate callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onPrintOperationPaginate :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationPaginateCallback) -> m SignalHandlerId Source #
Connect a signal handler for the paginate signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
printOperation #paginate callback
preview
type PrintOperationPreviewCallback Source #
= PrintOperationPreview |
|
-> PrintContext |
|
-> Maybe Window | |
-> IO Bool | Returns: |
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
provided context
for the preview implementation, it must be
given a suitable cairo context with printContextSetCairoContext
.
The custom preview implementation can use
printOperationPreviewIsSelected
and
printOperationPreviewRenderPage
to find pages which
are selected for print and render them. The preview must be
finished by calling printOperationPreviewEndPreview
(typically in response to the user clicking a close button).
Since: 2.10
afterPrintOperationPreview :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationPreviewCallback) -> m SignalHandlerId Source #
Connect a signal handler for the preview signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
printOperation #preview callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onPrintOperationPreview :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationPreviewCallback) -> m SignalHandlerId Source #
Connect a signal handler for the preview signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
printOperation #preview callback
requestPageSetup
type PrintOperationRequestPageSetupCallback Source #
= PrintContext |
|
-> Int32 |
|
-> PageSetup |
|
-> IO () |
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.
Since: 2.10
afterPrintOperationRequestPageSetup :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationRequestPageSetupCallback) -> m SignalHandlerId Source #
Connect a signal handler for the requestPageSetup signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
printOperation #requestPageSetup callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onPrintOperationRequestPageSetup :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationRequestPageSetupCallback) -> m SignalHandlerId Source #
Connect a signal handler for the requestPageSetup signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
printOperation #requestPageSetup callback
statusChanged
type PrintOperationStatusChangedCallback = IO () Source #
Emitted at between the various phases of the print operation.
See PrintStatus
for the phases that are being discriminated.
Use printOperationGetStatus
to find out the current
status.
Since: 2.10
afterPrintOperationStatusChanged :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationStatusChangedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the statusChanged signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
printOperation #statusChanged callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onPrintOperationStatusChanged :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationStatusChangedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the statusChanged signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
printOperation #statusChanged callback
updateCustomWidget
type PrintOperationUpdateCustomWidgetCallback Source #
= Widget |
|
-> PageSetup |
|
-> PrintSettings |
|
-> IO () |
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
afterPrintOperationUpdateCustomWidget :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationUpdateCustomWidgetCallback) -> m SignalHandlerId Source #
Connect a signal handler for the updateCustomWidget signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
printOperation #updateCustomWidget callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onPrintOperationUpdateCustomWidget :: (IsPrintOperation a, MonadIO m) => a -> ((?self :: a) => PrintOperationUpdateCustomWidgetCallback) -> m SignalHandlerId Source #
Connect a signal handler for the updateCustomWidget signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
printOperation #updateCustomWidget callback