gi-gtk4-4.0.12: Gtk 4.x bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gtk.Objects.PrintJob

Contents

- Exported types
- Methods
  - getCollate
  - getNUp
  - getNUpLayout
  - getNumCopies
  - getPageRanges
  - getPageSet
  - getPages
  - getPrinter
  - getReverse
  - getRotate
  - getScale
  - getSettings
  - getStatus
  - getSurface
  - getTitle
  - getTrackPrintStatus
  - new
  - send
  - setCollate
  - setNUp
  - setNUpLayout
  - setNumCopies
  - setPageRanges
  - setPageSet
  - setPages
  - setReverse
  - setRotate
  - setScale
  - setSourceFd
  - setSourceFile
  - setTrackPrintStatus
- Properties
  - pageSetup
  - printer
  - settings
  - title
  - trackPrintStatus
- Signals
  - statusChanged

Description

Represents a job that is sent to a printer.

You only need to deal directly with print jobs if you use the non-portable `PrintUnixDialog` API.

Use `printJobGetSurface` to obtain the cairo surface onto which the pages must be drawn. Use `printJobSend` to send the finished job to the printer. If you don’t use cairo `GtkPrintJob` also supports printing of manually generated PostScript, via `printJobSetSourceFile`.

Synopsis

- newtype PrintJob = PrintJob (ManagedPtr PrintJob)
- class (GObject o, IsDescendantOf PrintJob o) => IsPrintJob o
- toPrintJob :: (MonadIO m, IsPrintJob o) => o -> m PrintJob
- printJobGetCollate :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> m Bool
- printJobGetNUp :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> m Word32
- printJobGetNUpLayout :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> m NumberUpLayout
- printJobGetNumCopies :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> m Int32
- printJobGetPageRanges :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> m [PageRange]
- printJobGetPageSet :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> m PageSet
- printJobGetPages :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> m PrintPages
- printJobGetPrinter :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> m Printer
- printJobGetReverse :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> m Bool
- printJobGetRotate :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> m Bool
- printJobGetScale :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> m Double
- printJobGetSettings :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> m PrintSettings
- printJobGetStatus :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> m PrintStatus
- printJobGetSurface :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> m Surface
- printJobGetTitle :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> m Text
- printJobGetTrackPrintStatus :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> m Bool
- printJobNew :: (HasCallStack, MonadIO m, IsPrinter a, IsPrintSettings b, IsPageSetup c) => Text -> a -> b -> c -> m PrintJob
- printJobSend :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> PrintJobCompleteFunc -> m ()
- printJobSetCollate :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> Bool -> m ()
- printJobSetNUp :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> Word32 -> m ()
- printJobSetNUpLayout :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> NumberUpLayout -> m ()
- printJobSetNumCopies :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> Int32 -> m ()
- printJobSetPageRanges :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> [PageRange] -> m ()
- printJobSetPageSet :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> PageSet -> m ()
- printJobSetPages :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> PrintPages -> m ()
- printJobSetReverse :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> Bool -> m ()
- printJobSetRotate :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> Bool -> m ()
- printJobSetScale :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> Double -> m ()
- printJobSetSourceFd :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> Int32 -> m ()
- printJobSetSourceFile :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> [Char] -> m ()
- printJobSetTrackPrintStatus :: (HasCallStack, MonadIO m, IsPrintJob a) => a -> Bool -> m ()
- constructPrintJobPageSetup :: (IsPrintJob o, MonadIO m, IsPageSetup a) => a -> m (GValueConstruct o)
- getPrintJobPageSetup :: (MonadIO m, IsPrintJob o) => o -> m (Maybe PageSetup)
- constructPrintJobPrinter :: (IsPrintJob o, MonadIO m, IsPrinter a) => a -> m (GValueConstruct o)
- getPrintJobPrinter :: (MonadIO m, IsPrintJob o) => o -> m Printer
- constructPrintJobSettings :: (IsPrintJob o, MonadIO m, IsPrintSettings a) => a -> m (GValueConstruct o)
- getPrintJobSettings :: (MonadIO m, IsPrintJob o) => o -> m PrintSettings
- constructPrintJobTitle :: (IsPrintJob o, MonadIO m) => Text -> m (GValueConstruct o)
- getPrintJobTitle :: (MonadIO m, IsPrintJob o) => o -> m Text
- constructPrintJobTrackPrintStatus :: (IsPrintJob o, MonadIO m) => Bool -> m (GValueConstruct o)
- getPrintJobTrackPrintStatus :: (MonadIO m, IsPrintJob o) => o -> m Bool
- setPrintJobTrackPrintStatus :: (MonadIO m, IsPrintJob o) => o -> Bool -> m ()
- type PrintJobStatusChangedCallback = IO ()
- afterPrintJobStatusChanged :: (IsPrintJob a, MonadIO m) => a -> ((?self :: a) => PrintJobStatusChangedCallback) -> m SignalHandlerId
- onPrintJobStatusChanged :: (IsPrintJob a, MonadIO m) => a -> ((?self :: a) => PrintJobStatusChangedCallback) -> m SignalHandlerId

# Exported types

newtype PrintJob Source #

Memory-managed wrapper type.

Constructors

PrintJob (ManagedPtr PrintJob) |

#### Instances

Instances details

Eq PrintJob Source # |
Instance details Defined in GI.Gtk.Objects.PrintJob Methods (==) :: PrintJob -> PrintJob -> Bool Source # (/=) :: PrintJob -> PrintJob -> Bool Source #
GObject PrintJob Source # |
Instance details Defined in GI.Gtk.Objects.PrintJob
ManagedPtrNewtype PrintJob Source # |
Instance details Defined in GI.Gtk.Objects.PrintJob Methods toManagedPtr :: PrintJob -> ManagedPtr PrintJob Source #
TypedObject PrintJob Source # |
Instance details Defined in GI.Gtk.Objects.PrintJob Methods glibType :: IO GType Source #
HasParentTypes PrintJob Source # |
Instance details Defined in GI.Gtk.Objects.PrintJob
IsGValue (Maybe PrintJob) Source # | Convert `PrintJob` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gtk.Objects.PrintJob Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe PrintJob -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe PrintJob) Source #
type ParentTypes PrintJob Source # |
Instance details Defined in GI.Gtk.Objects.PrintJob type ParentTypes PrintJob = '[Object]

class (GObject o, IsDescendantOf PrintJob o) => IsPrintJob o Source #

Type class for types which can be safely cast to `PrintJob`, for instance with `toPrintJob`.

#### Instances

Instances details

(GObject o, IsDescendantOf PrintJob o) => IsPrintJob o Source # |
Instance details Defined in GI.Gtk.Objects.PrintJob

toPrintJob :: (MonadIO m, IsPrintJob o) => o -> m PrintJob Source #

Cast to `PrintJob`, 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

Expand

#### Methods

bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, send, stealData, stealQdata, thawNotify, unref, watchClosure.

#### Getters

getCollate, getData, getNUp, getNUpLayout, getNumCopies, getPageRanges, getPageSet, getPages, getPrinter, getProperty, getQdata, getReverse, getRotate, getScale, getSettings, getStatus, getSurface, getTitle, getTrackPrintStatus.

#### Setters

setCollate, setData, setDataFull, setNUp, setNUpLayout, setNumCopies, setPageRanges, setPageSet, setPages, setProperty, setReverse, setRotate, setScale, setSourceFd, setSourceFile, setTrackPrintStatus.

## getCollate

printJobGetCollate Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> m Bool | Returns: whether the job is printed collated

Gets whether this job is printed collated.

## getNUp

printJobGetNUp Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> m Word32 | Returns: the n-up setting

Gets the n-up setting for this job.

## getNUpLayout

printJobGetNUpLayout Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> m NumberUpLayout | Returns: the n-up layout

Gets the n-up layout setting for this job.

## getNumCopies

printJobGetNumCopies Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> m Int32 | Returns: the number of copies

Gets the number of copies of this job.

## getPageRanges

printJobGetPageRanges Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> m [PageRange] | Returns: a pointer to an array of `GtkPageRange` structs

Gets the page ranges for this job.

## getPageSet

printJobGetPageSet Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> m PageSet | Returns: the `GtkPageSet` setting

Gets the `GtkPageSet` setting for this job.

## getPages

printJobGetPages Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> m PrintPages | Returns: the `GtkPrintPages` setting

Gets the `GtkPrintPages` setting for this job.

## getPrinter

printJobGetPrinter Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> m Printer | Returns: the printer of `job`

Gets the `GtkPrinter` of the print job.

## getReverse

printJobGetReverse Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> m Bool | Returns: whether the job is printed reversed.

Gets whether this job is printed reversed.

## getRotate

printJobGetRotate Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> m Bool | Returns: whether the job is printed rotated

Gets whether the job is printed rotated.

## getScale

printJobGetScale Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> m Double | Returns: the scale

Gets the scale for this job.

## getSettings

printJobGetSettings Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> m PrintSettings | Returns: the settings of `job`

Gets the `GtkPrintSettings` of the print job.

## getStatus

printJobGetStatus Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> m PrintStatus | Returns: the status of `job`

Gets the status of the print job.

## getSurface

printJobGetSurface Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> m Surface | Returns: the cairo surface of `job` (Can throw `GError`)

Gets a cairo surface onto which the pages of the print job should be rendered.

## getTitle

printJobGetTitle Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> m Text | Returns: the title of `job`

Gets the job title.

## getTrackPrintStatus

printJobGetTrackPrintStatus Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> m Bool | Returns: `True` if print job status will be reported after printing

Returns whether jobs will be tracked after printing.

For details, see `printJobSetTrackPrintStatus`.

## new

printJobNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrinter a, IsPrintSettings b, IsPageSetup c) |
=> Text | `title`: the job title
-> a | `printer`: a `GtkPrinter`
-> b | `settings`: a `GtkPrintSettings`
-> c | `pageSetup`: a `GtkPageSetup`
-> m PrintJob | Returns: a new `GtkPrintJob`

Creates a new `GtkPrintJob`.

## send

printJobSend Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> PrintJobCompleteFunc | `callback`: function to call when the job completes or an error occurs
-> m () |

Sends the print job off to the printer.

## setCollate

printJobSetCollate Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> Bool | `collate`: whether the job is printed collated
-> m () |

Sets whether this job is printed collated.

## setNUp

printJobSetNUp Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> Word32 | `nUp`: the n-up value
-> m () |

Sets the n-up setting for this job.

## setNUpLayout

printJobSetNUpLayout Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> NumberUpLayout | `layout`: the n-up layout setting
-> m () |

Sets the n-up layout setting for this job.

## setNumCopies

printJobSetNumCopies Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> Int32 | `numCopies`: the number of copies
-> m () |

Sets the number of copies for this job.

## setPageRanges

printJobSetPageRanges Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> [PageRange] | `ranges`: pointer to an array of `GtkPageRange` structs
-> m () |

Sets the page ranges for this job.

## setPageSet

printJobSetPageSet Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> PageSet | `pageSet`: a `GtkPageSet` setting
-> m () |

Sets the `GtkPageSet` setting for this job.

## setPages

printJobSetPages Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> PrintPages | `pages`: the `GtkPrintPages` setting
-> m () |

Sets the `GtkPrintPages` setting for this job.

## setReverse

printJobSetReverse Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> Bool | `reverse`: whether the job is printed reversed
-> m () |

Sets whether this job is printed reversed.

## setRotate

printJobSetRotate Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> Bool | `rotate`: whether to print rotated
-> m () |

Sets whether this job is printed rotated.

## setScale

printJobSetScale Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> Double | `scale`: the scale
-> m () |

Sets the scale for this job.

1. 0 means unscaled.

## setSourceFd

printJobSetSourceFd Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> Int32 | `fd`: a file descriptor
-> m () | (Can throw `GError`)

Make the `GtkPrintJob` send an existing document to the printing system.

The file can be in any format understood by the platforms printing system (typically PostScript, but on many platforms PDF may work too). See `printerAcceptsPdf` and `printerAcceptsPs`.

This is similar to `printJobSetSourceFile`, but takes expects an open file descriptor for the file, instead of a filename.

## setSourceFile

printJobSetSourceFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> [Char] | `filename`: the file to be printed
-> m () | (Can throw `GError`)

Make the `GtkPrintJob` send an existing document to the printing system.

The file can be in any format understood by the platforms printing system (typically PostScript, but on many platforms PDF may work too). See `printerAcceptsPdf` and `printerAcceptsPs`.

## setTrackPrintStatus

printJobSetTrackPrintStatus Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintJob a) |
=> a | `job`: a `GtkPrintJob`
-> Bool | `trackStatus`: `True` to track status after printing
-> m () |

If track_status is `True`, the print job 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.

# Properties

## pageSetup

Page setup.

constructPrintJobPageSetup :: (IsPrintJob o, MonadIO m, IsPageSetup a) => a -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`page-setup`” property. This is rarely needed directly, but it is used by `new`.

getPrintJobPageSetup :: (MonadIO m, IsPrintJob o) => o -> m (Maybe PageSetup) Source #

Get the value of the “`page-setup`” property. When overloading is enabled, this is equivalent to

    get printJob #pageSetup

## printer

The printer to send the job to.

constructPrintJobPrinter :: (IsPrintJob o, MonadIO m, IsPrinter a) => a -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`printer`” property. This is rarely needed directly, but it is used by `new`.

getPrintJobPrinter :: (MonadIO m, IsPrintJob o) => o -> m Printer Source #

Get the value of the “`printer`” property. When overloading is enabled, this is equivalent to

    get printJob #printer

## settings

Printer settings.

constructPrintJobSettings :: (IsPrintJob o, MonadIO m, IsPrintSettings a) => a -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`settings`” property. This is rarely needed directly, but it is used by `new`.

getPrintJobSettings :: (MonadIO m, IsPrintJob o) => o -> m PrintSettings Source #

Get the value of the “`settings`” property. When overloading is enabled, this is equivalent to

    get printJob #settings

## title

The title of the print job.

constructPrintJobTitle :: (IsPrintJob o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`title`” property. This is rarely needed directly, but it is used by `new`.

getPrintJobTitle :: (MonadIO m, IsPrintJob o) => o -> m Text Source #

Get the value of the “`title`” property. When overloading is enabled, this is equivalent to

    get printJob #title

## trackPrintStatus

`True` if the print job will continue to emit status-changed signals after the print data has been setn to the printer.

constructPrintJobTrackPrintStatus :: (IsPrintJob 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`.

getPrintJobTrackPrintStatus :: (MonadIO m, IsPrintJob o) => o -> m Bool Source #

Get the value of the “`track-print-status`” property. When overloading is enabled, this is equivalent to

    get printJob #trackPrintStatus

setPrintJobTrackPrintStatus :: (MonadIO m, IsPrintJob o) => o -> Bool -> m () Source #

Set the value of the “`track-print-status`” property. When overloading is enabled, this is equivalent to

    set printJob [ #trackPrintStatus := value ]

# Signals

## statusChanged

type PrintJobStatusChangedCallback = IO () Source #

Emitted when the status of a job changes.

The signal handler can use `printJobGetStatus` to obtain the new status.

afterPrintJobStatusChanged :: (IsPrintJob a, MonadIO m) => a -> ((?self :: a) => PrintJobStatusChangedCallback) -> 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 printJob #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.

onPrintJobStatusChanged :: (IsPrintJob a, MonadIO m) => a -> ((?self :: a) => PrintJobStatusChangedCallback) -> 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 printJob #statusChanged callback