gtk3-0.15.10: Binding to the Gtk+ 3 graphical user interface library

Maintainer | gtk2hs-users@lists.sourceforge.net
Stability | provisional
Portability | portable (depends on GHC)
Safe Haskell | None
Language | Haskell98

Graphics.UI.Gtk.Printing.PrintOperation

Contents

- Detail
- Class Hierarchy
- Types
- Enums
- Constructors
- Methods
- Attributes
- Signals
- Orphan instances

Description

High-level Printing API

- Module available since Gtk+ version 2.10

Synopsis

- data PrintOperation
- class GObjectClass o => PrintOperationClass o
- castToPrintOperation :: GObjectClass obj => obj -> PrintOperation
- toPrintOperation :: PrintOperationClass o => o -> PrintOperation
- data PrintOperationPreview
- class GObjectClass o => PrintOperationPreviewClass o
- castToPrintOperationPreview :: GObjectClass obj => obj -> PrintOperationPreview
- toPrintOperationPreview :: PrintOperationPreviewClass o => o -> PrintOperationPreview
- data PrintStatus
  - = PrintStatusInitial
  - | PrintStatusPreparing
  - | PrintStatusGeneratingData
  - | PrintStatusSendingData
  - | PrintStatusPending
  - | PrintStatusPendingIssue
  - | PrintStatusPrinting
  - | PrintStatusFinished
  - | PrintStatusFinishedAborted
- data PrintOperationAction
  - = PrintOperationActionPrintDialog
  - | PrintOperationActionPrint
  - | PrintOperationActionPreview
  - | PrintOperationActionExport
- data PrintOperationResult
  - = PrintOperationResultError
  - | PrintOperationResultApply
  - | PrintOperationResultCancel
  - | PrintOperationResultInProgress
- data PrintError
  - = PrintErrorGeneral
  - | PrintErrorInternalError
  - | PrintErrorNomem
  - | PrintErrorInvalidFile
- printOperationNew :: IO PrintOperation
- printOperationSetAllowAsync :: PrintOperationClass self => self -> Bool -> IO ()
- printOperationGetError :: PrintOperationClass self => self -> IO ()
- printOperationSetJobName :: (PrintOperationClass self, GlibString string) => self -> string -> IO ()
- printOperationSetNPages :: PrintOperationClass self => self -> Int -> IO ()
- printOperationGetNPagesToPrint :: PrintOperationClass self => self -> IO Int
- printOperationSetCurrentPage :: PrintOperationClass self => self -> Int -> IO ()
- printOperationSetUseFullPage :: PrintOperationClass self => self -> Bool -> IO ()
- printOperationSetUnit :: PrintOperationClass self => self -> Unit -> IO ()
- printOperationSetExportFilename :: (PrintOperationClass self, GlibString string) => self -> string -> IO ()
- printOperationSetShowProgress :: PrintOperationClass self => self -> Bool -> IO ()
- printOperationSetTrackPrintStatus :: PrintOperationClass self => self -> Bool -> IO ()
- printOperationSetCustomTabLabel :: (PrintOperationClass self, GlibString string) => self -> string -> IO ()
- printOperationRun :: (PrintOperationClass self, WindowClass parent) => self -> PrintOperationAction -> parent -> IO PrintOperationResult
- printOperationCancel :: PrintOperationClass self => self -> IO ()
- printOperationDrawPageFinish :: PrintOperationClass self => self -> IO ()
- printOperationSetDeferDrawing :: PrintOperationClass self => self -> IO ()
- printOperationGetStatus :: PrintOperationClass self => self -> IO PrintStatus
- printOperationGetStatusString :: (PrintOperationClass self, GlibString string) => self -> IO string
- printOperationIsFinished :: PrintOperationClass self => self -> IO Bool
- printRunPageSetupDialog :: (WindowClass window, PageSetupClass pageSetup, PrintSettingsClass setting) => window -> pageSetup -> setting -> IO PageSetup
- printRunPageSetupDialogAsync :: (WindowClass window, PageSetupClass pageSetup, PrintSettingsClass setting) => window -> pageSetup -> setting -> (PageSetup -> IO ()) -> IO ()
- printOperationPreviewEndPreview :: PrintOperationPreviewClass self => self -> IO ()
- printOperationPreviewIsSelected :: PrintOperationPreviewClass self => self -> Int -> IO Bool
- printOperationPreviewRenderPage :: PrintOperationPreviewClass self => self -> Int -> IO ()
- printOperationDefaultPageSetup :: (PrintOperationClass self, PageSetupClass pageSetup) => ReadWriteAttr self PageSetup pageSetup
- printOperationPrintSettings :: (PrintOperationClass self, PrintSettingsClass printSettings) => ReadWriteAttr self PrintSettings printSettings
- printOperationJobName :: (PrintOperationClass self, GlibString string) => Attr self string
- printOperationNPages :: PrintOperationClass self => Attr self Int
- printOperationCurrentPage :: PrintOperationClass self => Attr self Int
- printOperationUseFullPage :: PrintOperationClass self => Attr self Bool
- printOperationTrackPrintStatus :: PrintOperationClass self => Attr self Bool
- printOperationUnit :: PrintOperationClass self => Attr self Unit
- printOperationShowProgress :: PrintOperationClass self => Attr self Bool
- printOperationAllowAsync :: PrintOperationClass self => Attr self Bool
- printOperationExportFilename :: (PrintOperationClass self, GlibString string) => Attr self string
- printOperationStatus :: PrintOperationClass self => ReadAttr self PrintStatus
- printOperationStatusString :: (PrintOperationClass self, GlibString string) => ReadAttr self string
- printOperationCustomTabLabel :: (PrintOperationClass self, GlibString string) => Attr self string
- printOperationSupportSelection :: PrintOperationClass self => Attr self Bool
- printOperationHasSelection :: PrintOperationClass self => Attr self Bool
- printOperationEmbedPageSetup :: PrintOperationClass self => Attr self Bool
- printOperationNPagesToPrint :: PrintOperationClass self => ReadAttr self Int
- printOptDone :: PrintOperationClass self => Signal self (PrintOperationResult -> IO ())
- printOptBeginPrint :: PrintOperationClass self => Signal self (PrintContext -> IO ())
- printOptPaginate :: PrintOperationClass self => Signal self (PrintContext -> IO Bool)
- printOptRequestPageSetup :: PrintOperationClass self => Signal self (PrintContext -> Int -> PageSetup -> IO ())
- printOptDrawPage :: PrintOperationClass self => Signal self (PrintContext -> Int -> IO ())
- printOptEndPrint :: PrintOperationClass self => Signal self (PrintContext -> IO ())
- printOptStatusChanged :: PrintOperationClass self => Signal self (IO ())
- printOptCreateCustomWidget :: PrintOperationClass self => Signal self (IO Widget)
- printOptUpdateCustomWidget :: PrintOperationClass self => Signal self (Widget -> PageSetup -> PrintSettings -> IO ())
- printOptCustomWidgetApply :: PrintOperationClass self => Signal self (Widget -> IO ())
- printOptPreview :: PrintOperationClass self => Signal self (PrintOperationPreview -> PrintContext -> Window -> IO Bool)
- printOptReady :: PrintOperationPreviewClass self => Signal self (PrintContext -> IO ())
- printOptGotPageSize :: PrintOperationPreviewClass self => Signal self (PrintContext -> PageSetup -> IO ())

# Detail

`PrintOperation` 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, `PrintOperation` uses the native print dialog. On platforms which do not provide a native print dialog, Gtk+ uses its own, see `PrintUnixDialog`.

The typical way to use the high-level printing API is to create a `PrintOperation` 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 'draw-page' signal, which you are supposed to catch and render the page on the provided `PrintContext` using Cairo.

By default `PrintOperation` uses an external application to do print preview. To implement a custom print preview, an application must connect to the preview signal. The functions `printOperationPrintPreviewRenderPage`, `printOperationPreviewEndPreview` and `printOperationPreviewIsSelected` are useful when implementing a print preview.

Printing support was added in Gtk+ 2.10.

# Class Hierarchy

    | GObject
    | +----PrintOperation

# Types

data PrintOperation Source #

#### Instances

Instances details

Eq PrintOperation Source # |
Instance details Defined in Graphics.UI.Gtk.Types Methods (==) :: PrintOperation -> PrintOperation -> Bool Source # (/=) :: PrintOperation -> PrintOperation -> Bool Source #
Ord PrintOperation Source # |

Instance details

Defined in Graphics.UI.Gtk.Types

Methods

compare :: PrintOperation -> PrintOperation -> Ordering Source #

(<) :: PrintOperation -> PrintOperation -> Bool Source #

(<=) :: PrintOperation -> PrintOperation -> Bool Source #

(>) :: PrintOperation -> PrintOperation -> Bool Source #

(>=) :: PrintOperation -> PrintOperation -> Bool Source #

max :: PrintOperation -> PrintOperation -> PrintOperation Source #

min :: PrintOperation -> PrintOperation -> PrintOperation Source #

GObjectClass PrintOperation Source # |
Instance details Defined in Graphics.UI.Gtk.Types Methods toGObject :: PrintOperation -> GObject Source # unsafeCastGObject :: GObject -> PrintOperation Source #
PrintOperationClass PrintOperation Source # |
Instance details Defined in Graphics.UI.Gtk.Types
PrintOperationPreviewClass PrintOperation Source # |
Instance details Defined in Graphics.UI.Gtk.Printing.PrintOperation

class GObjectClass o => PrintOperationClass o Source #

#### Instances

Instances details

PrintOperationClass PrintOperation Source # |
Instance details Defined in Graphics.UI.Gtk.Types

castToPrintOperation :: GObjectClass obj => obj -> PrintOperation Source #

toPrintOperation :: PrintOperationClass o => o -> PrintOperation Source #

data PrintOperationPreview Source #

#### Instances

Instances details

Eq PrintOperationPreview Source # |
Instance details Defined in Graphics.UI.Gtk.Types Methods (==) :: PrintOperationPreview -> PrintOperationPreview -> Bool Source # (/=) :: PrintOperationPreview -> PrintOperationPreview -> Bool Source #
Ord PrintOperationPreview Source # |

Instance details

Defined in Graphics.UI.Gtk.Types

Methods

compare :: PrintOperationPreview -> PrintOperationPreview -> Ordering Source #

(<) :: PrintOperationPreview -> PrintOperationPreview -> Bool Source #

(<=) :: PrintOperationPreview -> PrintOperationPreview -> Bool Source #

(>) :: PrintOperationPreview -> PrintOperationPreview -> Bool Source #

(>=) :: PrintOperationPreview -> PrintOperationPreview -> Bool Source #

max :: PrintOperationPreview -> PrintOperationPreview -> PrintOperationPreview Source #

min :: PrintOperationPreview -> PrintOperationPreview -> PrintOperationPreview Source #

GObjectClass PrintOperationPreview Source # |
Instance details Defined in Graphics.UI.Gtk.Types Methods toGObject :: PrintOperationPreview -> GObject Source # unsafeCastGObject :: GObject -> PrintOperationPreview Source #
PrintOperationPreviewClass PrintOperationPreview Source # |
Instance details Defined in Graphics.UI.Gtk.Types

class GObjectClass o => PrintOperationPreviewClass o Source #

#### Instances

Instances details

PrintOperationPreviewClass PrintOperation Source # |
Instance details Defined in Graphics.UI.Gtk.Printing.PrintOperation
PrintOperationPreviewClass PrintOperationPreview Source # |
Instance details Defined in Graphics.UI.Gtk.Types

castToPrintOperationPreview :: GObjectClass obj => obj -> PrintOperationPreview Source #

toPrintOperationPreview :: PrintOperationPreviewClass o => o -> PrintOperationPreview Source #

# Enums

data PrintStatus Source #

The status gives a rough indication of the completion of a running print operation.

Constructors

PrintStatusInitial |
PrintStatusPreparing |
PrintStatusGeneratingData |
PrintStatusSendingData |
PrintStatusPending |
PrintStatusPendingIssue |
PrintStatusPrinting |
PrintStatusFinished |
PrintStatusFinishedAborted |

#### Instances

Instances details

Bounded PrintStatus Source # |
Instance details Defined in Graphics.UI.Gtk.Printing.PrintOperation Methods minBound :: PrintStatus Source # maxBound :: PrintStatus Source #
Enum PrintStatus Source # |

Instance details

Defined in Graphics.UI.Gtk.Printing.PrintOperation

Methods

succ :: PrintStatus -> PrintStatus Source #

pred :: PrintStatus -> PrintStatus Source #

toEnum :: Int -> PrintStatus Source #

fromEnum :: PrintStatus -> Int Source #

enumFrom :: PrintStatus -> [PrintStatus] Source #

enumFromThen :: PrintStatus -> PrintStatus -> [PrintStatus] Source #

enumFromTo :: PrintStatus -> PrintStatus -> [PrintStatus] Source #

enumFromThenTo :: PrintStatus -> PrintStatus -> PrintStatus -> [PrintStatus] Source #

Show PrintStatus Source # |
Instance details Defined in Graphics.UI.Gtk.Printing.PrintOperation Methods showsPrec :: Int -> PrintStatus -> ShowS Source # show :: PrintStatus -> String Source # showList :: [PrintStatus] -> ShowS Source #
Eq PrintStatus Source # |
Instance details Defined in Graphics.UI.Gtk.Printing.PrintOperation Methods (==) :: PrintStatus -> PrintStatus -> Bool Source # (/=) :: PrintStatus -> PrintStatus -> Bool Source #

data PrintOperationAction Source #

The action parameter to `printOperationRun` determines what action the print operation should perform.

Constructors

PrintOperationActionPrintDialog |
PrintOperationActionPrint |
PrintOperationActionPreview |
PrintOperationActionExport |

#### Instances

Instances details

Bounded PrintOperationAction Source # |
Instance details Defined in Graphics.UI.Gtk.Printing.PrintOperation Methods minBound :: PrintOperationAction Source # maxBound :: PrintOperationAction Source #
Enum PrintOperationAction Source # |

Instance details

Defined in Graphics.UI.Gtk.Printing.PrintOperation

Methods

succ :: PrintOperationAction -> PrintOperationAction Source #

pred :: PrintOperationAction -> PrintOperationAction Source #

toEnum :: Int -> PrintOperationAction Source #

fromEnum :: PrintOperationAction -> Int Source #

enumFrom :: PrintOperationAction -> [PrintOperationAction] Source #

enumFromThen :: PrintOperationAction -> PrintOperationAction -> [PrintOperationAction] Source #

enumFromTo :: PrintOperationAction -> PrintOperationAction -> [PrintOperationAction] Source #

enumFromThenTo :: PrintOperationAction -> PrintOperationAction -> PrintOperationAction -> [PrintOperationAction] Source #

Show PrintOperationAction Source # |
Instance details Defined in Graphics.UI.Gtk.Printing.PrintOperation Methods showsPrec :: Int -> PrintOperationAction -> ShowS Source # show :: PrintOperationAction -> String Source # showList :: [PrintOperationAction] -> ShowS Source #
Eq PrintOperationAction Source # |
Instance details Defined in Graphics.UI.Gtk.Printing.PrintOperation Methods (==) :: PrintOperationAction -> PrintOperationAction -> Bool Source # (/=) :: PrintOperationAction -> PrintOperationAction -> Bool Source #

data PrintOperationResult Source #

A value of this type is returned by `printOperationRun`.

Constructors

PrintOperationResultError |
PrintOperationResultApply |
PrintOperationResultCancel |
PrintOperationResultInProgress |

#### Instances

Instances details

Bounded PrintOperationResult Source # |
Instance details Defined in Graphics.UI.Gtk.Printing.PrintOperation Methods minBound :: PrintOperationResult Source # maxBound :: PrintOperationResult Source #
Enum PrintOperationResult Source # |

Instance details

Defined in Graphics.UI.Gtk.Printing.PrintOperation

Methods

succ :: PrintOperationResult -> PrintOperationResult Source #

pred :: PrintOperationResult -> PrintOperationResult Source #

toEnum :: Int -> PrintOperationResult Source #

fromEnum :: PrintOperationResult -> Int Source #

enumFrom :: PrintOperationResult -> [PrintOperationResult] Source #

enumFromThen :: PrintOperationResult -> PrintOperationResult -> [PrintOperationResult] Source #

enumFromTo :: PrintOperationResult -> PrintOperationResult -> [PrintOperationResult] Source #

enumFromThenTo :: PrintOperationResult -> PrintOperationResult -> PrintOperationResult -> [PrintOperationResult] Source #

Show PrintOperationResult Source # |
Instance details Defined in Graphics.UI.Gtk.Printing.PrintOperation Methods showsPrec :: Int -> PrintOperationResult -> ShowS Source # show :: PrintOperationResult -> String Source # showList :: [PrintOperationResult] -> ShowS Source #
Eq PrintOperationResult Source # |
Instance details Defined in Graphics.UI.Gtk.Printing.PrintOperation Methods (==) :: PrintOperationResult -> PrintOperationResult -> Bool Source # (/=) :: PrintOperationResult -> PrintOperationResult -> Bool Source #

data PrintError Source #

Error codes that identify various errors that can occur while using the GTK+ printing support.

Constructors

PrintErrorGeneral |
PrintErrorInternalError |
PrintErrorNomem |
PrintErrorInvalidFile |

#### Instances

Instances details

Bounded PrintError Source # |
Instance details Defined in Graphics.UI.Gtk.Printing.PrintOperation Methods minBound :: PrintError Source # maxBound :: PrintError Source #
Enum PrintError Source # |

Instance details

Defined in Graphics.UI.Gtk.Printing.PrintOperation

Methods

succ :: PrintError -> PrintError Source #

pred :: PrintError -> PrintError Source #

toEnum :: Int -> PrintError Source #

fromEnum :: PrintError -> Int Source #

enumFrom :: PrintError -> [PrintError] Source #

enumFromThen :: PrintError -> PrintError -> [PrintError] Source #

enumFromTo :: PrintError -> PrintError -> [PrintError] Source #

enumFromThenTo :: PrintError -> PrintError -> PrintError -> [PrintError] Source #

Show PrintError Source # |
Instance details Defined in Graphics.UI.Gtk.Printing.PrintOperation Methods showsPrec :: Int -> PrintError -> ShowS Source # show :: PrintError -> String Source # showList :: [PrintError] -> ShowS Source #
Eq PrintError Source # |
Instance details Defined in Graphics.UI.Gtk.Printing.PrintOperation Methods (==) :: PrintError -> PrintError -> Bool Source # (/=) :: PrintError -> PrintError -> Bool Source #

# Constructors

printOperationNew :: IO PrintOperation Source #

Creates a new `PrintOperation`.

# Methods

printOperationSetAllowAsync Source #

Arguments

:: PrintOperationClass self |
=> self |
-> Bool | `allowAsync` - `True` to allow asynchronous operation
-> IO () |

Sets whether the `printOperationRun` may return before the print operation is completed. Note that some platforms may not allow asynchronous operation.

printOperationGetError :: PrintOperationClass self => self -> IO () Source #

Call this when the result of a print operation is `PrintOperationResultError`, either as returned by `printOperationRun`, or in the `done` signal handler. The returned `GError` will contain more details on what went wrong.

printOperationSetJobName Source #

Arguments

:: (PrintOperationClass self, GlibString string) |
=> self |
-> string | `jobName` - a string that identifies the print job
-> IO () |

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.

printOperationSetNPages Source #

Arguments

:: PrintOperationClass self |
=> self |
-> Int | `nPages` - the number of pages
-> IO () |

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 `beginPrint` signal handler.

Note that the page numbers passed to the `requestPageSetup` and `drawPage` signals are 0-based, i.e. if the user chooses to print all pages, the last 'draw-page' signal will be for page `nPages` - 1.

printOperationGetNPagesToPrint Source #

Arguments

:: PrintOperationClass self |
=> self |
-> IO Int | 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 `statusChanged` signal and call `printOperationGetNPagesToPrint` when print status is `PrintStatusGeneratingData`. This is typically used to track the progress of print operation.

- Available since Gtk+ version 2.18

printOperationSetCurrentPage Source #

Arguments

:: PrintOperationClass self |
=> self |
-> Int | `currentPage` - the current page, 0-based
-> IO () |

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.

printOperationSetUseFullPage Source #

Arguments

:: PrintOperationClass self |
=> self |
-> Bool | `fullPage` - `True` to set up the `PrintContext` for the full page
-> IO () |

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).

printOperationSetUnit Source #

Arguments

:: PrintOperationClass self |
=> self |
-> Unit | `unit` - the unit to use
-> IO () |

Sets up the transformation for the cairo context obtained from `PrintContext` in such a way that distances are measured in units of `unit`.

printOperationSetExportFilename Source #

Arguments

:: (PrintOperationClass self, GlibString string) |
=> self |
-> string | `filename` - the filename for the exported file
-> IO () |

Sets up the `PrintOperation` to generate a file instead of showing the print dialog. The intended 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.

printOperationSetShowProgress Source #

Arguments

:: PrintOperationClass self |
=> self |
-> Bool | `showProgress` - `True` to show a progress dialog
-> IO () |

If `showProgress` is `True`, the print operation will show a progress dialog during the print operation.

printOperationSetTrackPrintStatus Source #

Arguments

:: PrintOperationClass self |
=> self |
-> Bool | `trackStatus` - `True` to track status after printing
-> IO () |

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.

printOperationSetCustomTabLabel Source #

Arguments

:: (PrintOperationClass self, GlibString string) |
=> self |
-> string | `label` - the label to use, or empty to use the default label
-> IO () |

Sets the label for the tab holding custom widgets.

printOperationRun Source #

Arguments

:: (PrintOperationClass self, WindowClass parent) |
=> self |
-> PrintOperationAction | `action` - the action to start
-> parent | `parent` - Transient parent of the dialog

-> IO PrintOperationResult

returns the result of the print operation. A return value of `PrintOperationResultApply` indicates that the printing was completed successfully. In this case, it is a good idea to obtain the used print settings with `printOperationGetPrintSettings` and store them for reuse with the next print operation. A value of `PrintOperationResultInProgress` means the operation is running asynchronously, and will emit the `done` signal when done.

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 `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 `allowAsync` property the operation will run asynchronously if this is supported on the platform. The `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).

printOperationCancel :: PrintOperationClass self => self -> IO () Source #

Cancels a running print operation. This function may be called from a `beginPrint`, `paginate` or `drawPage` signal handler to stop the currently running print operation.

printOperationDrawPageFinish :: PrintOperationClass self => self -> IO () Source #

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.

- Available since Gtk+ version 2.16

printOperationSetDeferDrawing :: PrintOperationClass self => self -> IO () Source #

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.

- Available since Gtk+ version 2.16

printOperationGetStatus Source #

Arguments

:: PrintOperationClass self |
=> self |
-> IO PrintStatus | returns the status of the print operation

Returns the status of the print operation. Also see `printOperationGetStatusString`.

printOperationGetStatusString Source #

Arguments

:: (PrintOperationClass self, GlibString string) |
=> self |
-> IO string | 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.

printOperationIsFinished Source #

Arguments

:: PrintOperationClass self |
=> self |
-> IO Bool | returns `True`, if the print operation is finished.

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.

printRunPageSetupDialog Source #

Arguments

:: (WindowClass window, PageSetupClass pageSetup, PrintSettingsClass setting) |
=> window | `parent` transient parent.
-> pageSetup | `pageSetup` an existing `PageSetup`.
-> setting | `settings` a `PrintSettings`
-> IO PageSetup | returns a new `PageSetup`

Runs a page setup dialog, letting the user modify the values from `pageSetup`. If the user cancels the dialog, the returned `PageSetup` is identical to the passed in `pageSetup`, otherwise it contains the modifications done in the dialog.

Note that this function may use a recursive mainloop to show the page setup dialog. See `printRunPageSetupDialogAsync` if this is a problem.

printRunPageSetupDialogAsync Source #

Arguments

:: (WindowClass window, PageSetupClass pageSetup, PrintSettingsClass setting) |
=> window | `parent` transient parent.
-> pageSetup | `pageSetup` an existing `PageSetup`.
-> setting | `settings` a `PrintSettings`
-> (PageSetup -> IO ()) | `doneCb` a function to call when the user saves the modified page setup
-> IO () |

Runs a page setup dialog, letting the user modify the values from `pageSetup`.

In contrast to `printRunPageSetupDialog`, this function returns after showing the page setup dialog on platforms that support this, and calls `doneCb` from a signal handler for the `response` signal of the dialog.

printOperationPreviewEndPreview :: PrintOperationPreviewClass self => self -> IO () Source #

Ends a preview.

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

printOperationPreviewIsSelected Source #

Arguments

:: PrintOperationPreviewClass self |
=> self | `preview` a `PrintOperationPreview`
-> Int | `pageNr` a page number
-> IO Bool | returns `True` if the page has been selected for printing

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

printOperationPreviewRenderPage Source #

Arguments

:: PrintOperationPreviewClass self |
=> self | `preview` a `PrintOperationPreview`
-> Int | `pageNr` the page to render
-> IO () |

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.

# Attributes

printOperationDefaultPageSetup :: (PrintOperationClass self, PageSetupClass pageSetup) => ReadWriteAttr self PageSetup pageSetup Source #

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 `requestPageSetup` signal.

Since 2.10

printOperationPrintSettings :: (PrintOperationClass self, PrintSettingsClass printSettings) => ReadWriteAttr self PrintSettings printSettings Source #

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

printOperationJobName :: (PrintOperationClass self, GlibString string) => Attr self string Source #

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.

Default value: ""

Since 2.10

printOperationNPages :: PrintOperationClass self => Attr self Int Source #

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 `beginPrint` signal handler.

Note that the page numbers passed to the `requestPageSetup` and `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.

Allowed values: >= `GMaxulong`

Default value: -1

Since 2.10

printOperationCurrentPage :: PrintOperationClass self => Attr self Int Source #

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.

Allowed values: >= `GMaxulong`

Default value: -1

Since 2.10

printOperationUseFullPage :: PrintOperationClass self => Attr self Bool Source #

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).

Default value: `False`

Since 2.10

printOperationTrackPrintStatus :: PrintOperationClass self => Attr self Bool Source #

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.

Default value: `False`

Since 2.10

printOperationUnit :: PrintOperationClass self => Attr self Unit Source #

The transformation for the cairo context obtained from `PrintContext` is set up in such a way that distances are measured in units of unit.

Default value: '`UnitPixel'`

Since 2.10

printOperationShowProgress :: PrintOperationClass self => Attr self Bool Source #

Determines whether to show a progress dialog during the print operation.

Default value: `False`

Since 2.10

printOperationAllowAsync :: PrintOperationClass self => Attr self Bool Source #

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 "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.

Default value: `False`

Since 2.10

printOperationExportFilename :: (PrintOperationClass self, GlibString string) => Attr self string Source #

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.

Default value: `Nothing`

Since 2.10

printOperationStatus :: PrintOperationClass self => ReadAttr self PrintStatus Source #

The status of the print operation.

Default value: '`PrintStatusInitial'`

Since 2.10

printOperationStatusString :: (PrintOperationClass self, GlibString string) => ReadAttr self string Source #

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 `printOperationStatus` property for a status value that is suitable for programmatic use.

Default value: ""

Since 2.10

printOperationCustomTabLabel :: (PrintOperationClass self, GlibString string) => Attr self string Source #

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.

Default value: `Nothing`

Since 2.10

printOperationSupportSelection :: PrintOperationClass self => Attr self Bool Source #

If `True`, the print operation will support print of selection. This allows the print dialog to show a Selection button.

Default value: `False`

Since 2.18

printOperationHasSelection :: PrintOperationClass self => Attr self Bool Source #

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.

Default value: `False`

Since 2.18

printOperationEmbedPageSetup :: PrintOperationClass self => Attr self Bool Source #

If `True`, page size combo box and orientation combo box are embedded into page setup page.

Default value: `False`

Since 2.18

printOperationNPagesToPrint :: PrintOperationClass self => ReadAttr self Int Source #

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 `statusChanged` signal and call `printOperationGetNPagesToPrint` when print status is '`PrintStatusGeneratingData'`. This is typically used to track the progress of print operation.

Allowed values: >= `GMaxulong`

Default value: -1

Since 2.18

# Signals

printOptDone :: PrintOperationClass self => Signal self (PrintOperationResult -> IO ()) Source #

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 `done` was emitted.

printOptBeginPrint :: PrintOperationClass self => Signal self (PrintContext -> IO ()) Source #

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 the `PrintContext` and paginate the document accordingly, and then set the number of pages with `printOperationSetNPages`.

printOptPaginate :: PrintOperationClass self => Signal self (PrintContext -> IO Bool) Source #

Emitted after the `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 'begin-print handler', and set the number of pages from there.

printOptRequestPageSetup :: PrintOperationClass self => Signal self (PrintContext -> Int -> PageSetup -> IO ()) Source #

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.

printOptDrawPage :: PrintOperationClass self => Signal self (PrintContext -> Int -> IO ()) Source #

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`.

Use `printOperationSetUseFullPage` and `printOperationSetUnit` before starting the print operation to set up the transformation of the cairo context according to your needs.

printOptEndPrint :: PrintOperationClass self => Signal self (PrintContext -> IO ()) Source #

Emitted after all pages have been rendered. A handler for this signal can clean up any resources that have been allocated in the `beginPrint` handler.

printOptStatusChanged :: PrintOperationClass self => Signal self (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.

printOptCreateCustomWidget :: PrintOperationClass self => Signal self (IO Widget) 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 `customWidgetApply` signal is emitted on the operation. Then you can read out any information you need from the widgets.

printOptUpdateCustomWidget :: PrintOperationClass self => Signal self (Widget -> PageSetup -> PrintSettings -> IO ()) Source #

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.

- Available since Gtk+ version 2.18

printOptCustomWidgetApply :: PrintOperationClass self => Signal self (Widget -> IO ()) Source #

Emitted right before `beginPrint` if you added a custom widget in the `createCustomWidtet` 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.

printOptPreview :: PrintOperationClass self => Signal self (PrintOperationPreview -> PrintContext -> Window -> IO Bool) Source #

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).

printOptReady :: PrintOperationPreviewClass self => Signal self (PrintContext -> IO ()) Source #

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.

printOptGotPageSize :: PrintOperationPreviewClass self => Signal self (PrintContext -> PageSetup -> IO ()) Source #

The `gotPageSize` signal is emitted once for each page that gets rendered to the preview.

A handler for this signal should update the context according to `pageSetup` and set up a suitable cairo context, using `printContextSetCairoContext`.

# Orphan instances

PrintOperationPreviewClass PrintOperation Source # |
Instance details