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

Contents

- Exported types
- Methods
  - acceptsPdf
  - acceptsPs
  - compare
  - getBackend
  - getCapabilities
  - getDefaultPageSize
  - getDescription
  - getHardMargins
  - getHardMarginsForPaperSize
  - getIconName
  - getJobCount
  - getLocation
  - getName
  - getStateMessage
  - hasDetails
  - isAcceptingJobs
  - isActive
  - isDefault
  - isPaused
  - isVirtual
  - listPapers
  - new
  - requestDetails
- Properties
  - acceptingJobs
  - acceptsPdf
  - acceptsPs
  - iconName
  - isVirtual
  - jobCount
  - location
  - name
  - paused
  - stateMessage
- Signals
  - detailsAcquired

Description

Represents a printer.

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

A `GtkPrinter` allows to get status information about the printer, such as its description, its location, the number of queued jobs, etc. Most importantly, a `GtkPrinter` object can be used to create a `PrintJob` object, which lets you print to the printer.

Synopsis

- newtype Printer = Printer (ManagedPtr Printer)
- class (GObject o, IsDescendantOf Printer o) => IsPrinter o
- toPrinter :: (MonadIO m, IsPrinter o) => o -> m Printer
- printerAcceptsPdf :: (HasCallStack, MonadIO m, IsPrinter a) => a -> m Bool
- printerAcceptsPs :: (HasCallStack, MonadIO m, IsPrinter a) => a -> m Bool
- printerCompare :: (HasCallStack, MonadIO m, IsPrinter a, IsPrinter b) => a -> b -> m Int32
- printerGetBackend :: (HasCallStack, MonadIO m, IsPrinter a) => a -> m PrintBackend
- printerGetCapabilities :: (HasCallStack, MonadIO m, IsPrinter a) => a -> m [PrintCapabilities]
- printerGetDefaultPageSize :: (HasCallStack, MonadIO m, IsPrinter a) => a -> m PageSetup
- printerGetDescription :: (HasCallStack, MonadIO m, IsPrinter a) => a -> m Text
- printerGetHardMargins :: (HasCallStack, MonadIO m, IsPrinter a) => a -> m (Bool, Double, Double, Double, Double)
- printerGetHardMarginsForPaperSize :: (HasCallStack, MonadIO m, IsPrinter a) => a -> PaperSize -> m (Bool, Double, Double, Double, Double)
- printerGetIconName :: (HasCallStack, MonadIO m, IsPrinter a) => a -> m Text
- printerGetJobCount :: (HasCallStack, MonadIO m, IsPrinter a) => a -> m Int32
- printerGetLocation :: (HasCallStack, MonadIO m, IsPrinter a) => a -> m Text
- printerGetName :: (HasCallStack, MonadIO m, IsPrinter a) => a -> m Text
- printerGetStateMessage :: (HasCallStack, MonadIO m, IsPrinter a) => a -> m Text
- printerHasDetails :: (HasCallStack, MonadIO m, IsPrinter a) => a -> m Bool
- printerIsAcceptingJobs :: (HasCallStack, MonadIO m, IsPrinter a) => a -> m Bool
- printerIsActive :: (HasCallStack, MonadIO m, IsPrinter a) => a -> m Bool
- printerIsDefault :: (HasCallStack, MonadIO m, IsPrinter a) => a -> m Bool
- printerIsPaused :: (HasCallStack, MonadIO m, IsPrinter a) => a -> m Bool
- printerIsVirtual :: (HasCallStack, MonadIO m, IsPrinter a) => a -> m Bool
- printerListPapers :: (HasCallStack, MonadIO m, IsPrinter a) => a -> m [PageSetup]
- printerNew :: (HasCallStack, MonadIO m) => Text -> PrintBackend -> Bool -> m Printer
- printerRequestDetails :: (HasCallStack, MonadIO m, IsPrinter a) => a -> m ()
- getPrinterAcceptingJobs :: (MonadIO m, IsPrinter o) => o -> m Bool
- constructPrinterAcceptsPdf :: (IsPrinter o, MonadIO m) => Bool -> m (GValueConstruct o)
- getPrinterAcceptsPdf :: (MonadIO m, IsPrinter o) => o -> m Bool
- constructPrinterAcceptsPs :: (IsPrinter o, MonadIO m) => Bool -> m (GValueConstruct o)
- getPrinterAcceptsPs :: (MonadIO m, IsPrinter o) => o -> m Bool
- getPrinterIconName :: (MonadIO m, IsPrinter o) => o -> m Text
- constructPrinterIsVirtual :: (IsPrinter o, MonadIO m) => Bool -> m (GValueConstruct o)
- getPrinterIsVirtual :: (MonadIO m, IsPrinter o) => o -> m Bool
- getPrinterJobCount :: (MonadIO m, IsPrinter o) => o -> m Int32
- getPrinterLocation :: (MonadIO m, IsPrinter o) => o -> m Text
- constructPrinterName :: (IsPrinter o, MonadIO m) => Text -> m (GValueConstruct o)
- getPrinterName :: (MonadIO m, IsPrinter o) => o -> m Text
- getPrinterPaused :: (MonadIO m, IsPrinter o) => o -> m Bool
- getPrinterStateMessage :: (MonadIO m, IsPrinter o) => o -> m Text
- type PrinterDetailsAcquiredCallback = Bool -> IO ()
- afterPrinterDetailsAcquired :: (IsPrinter a, MonadIO m) => a -> ((?self :: a) => PrinterDetailsAcquiredCallback) -> m SignalHandlerId
- onPrinterDetailsAcquired :: (IsPrinter a, MonadIO m) => a -> ((?self :: a) => PrinterDetailsAcquiredCallback) -> m SignalHandlerId

# Exported types

newtype Printer Source #

Memory-managed wrapper type.

Constructors

Printer (ManagedPtr Printer) |

#### Instances

Instances details

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

class (GObject o, IsDescendantOf Printer o) => IsPrinter o Source #

Type class for types which can be safely cast to `Printer`, for instance with `toPrinter`.

#### Instances

Instances details

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

toPrinter :: (MonadIO m, IsPrinter o) => o -> m Printer Source #

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

acceptsPdf, acceptsPs, bindProperty, bindPropertyFull, compare, forceFloating, freezeNotify, getv, hasDetails, isAcceptingJobs, isActive, isDefault, isFloating, isPaused, isVirtual, listPapers, notify, notifyByPspec, ref, refSink, requestDetails, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.

#### Getters

getBackend, getCapabilities, getData, getDefaultPageSize, getDescription, getHardMargins, getHardMarginsForPaperSize, getIconName, getJobCount, getLocation, getName, getProperty, getQdata, getStateMessage.

#### Setters

setData, setDataFull, setProperty.

## acceptsPdf

printerAcceptsPdf Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrinter a) |
=> a | `printer`: a `GtkPrinter`
-> m Bool | Returns: `True` if `printer` accepts PDF

Returns whether the printer accepts input in PDF format.

## acceptsPs

printerAcceptsPs Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrinter a) |
=> a | `printer`: a `GtkPrinter`
-> m Bool | Returns: `True` if `printer` accepts PostScript

Returns whether the printer accepts input in PostScript format.

## compare

printerCompare Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrinter a, IsPrinter b) |
=> a | `a`: a `GtkPrinter`
-> b | `b`: another `GtkPrinter`
-> m Int32 | Returns: 0 if the printer match, a negative value if `a` < `b`, or a positive value if `a` > `b`

Compares two printers.

## getBackend

printerGetBackend Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrinter a) |
=> a | `printer`: a `GtkPrinter`
-> m PrintBackend | Returns: the backend of `printer`

Returns the backend of the printer.

## getCapabilities

printerGetCapabilities Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrinter a) |
=> a | `printer`: a `GtkPrinter`
-> m [PrintCapabilities] | Returns: the printer’s capabilities

Returns the printer’s capabilities.

This is useful when you’re using `GtkPrintUnixDialog`’s manual-capabilities setting and need to know which settings the printer can handle and which you must handle yourself.

This will return 0 unless the printer’s details are available, see `printerHasDetails` and `printerRequestDetails`.

## getDefaultPageSize

printerGetDefaultPageSize Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrinter a) |
=> a | `printer`: a `GtkPrinter`
-> m PageSetup | Returns: a newly allocated `GtkPageSetup` with default page size of the printer.

Returns default page size of `printer`.

## getDescription

printerGetDescription Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrinter a) |
=> a | `printer`: a `GtkPrinter`
-> m Text | Returns: the description of `printer`

Gets the description of the printer.

## getHardMargins

printerGetHardMargins Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrinter a) |
=> a | `printer`: a `GtkPrinter`
-> m (Bool, Double, Double, Double, Double) | Returns: `True` iff the hard margins were retrieved

Retrieve the hard margins of `printer`.

These are the margins that define the area at the borders of the paper that the printer cannot print to.

Note: This will not succeed unless the printer’s details are available, see `printerHasDetails` and `printerRequestDetails`.

## getHardMarginsForPaperSize

printerGetHardMarginsForPaperSize Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrinter a) |
=> a | `printer`: a `GtkPrinter`
-> PaperSize | `paperSize`: a `GtkPaperSize`
-> m (Bool, Double, Double, Double, Double) | Returns: `True` iff the hard margins were retrieved

Retrieve the hard margins of `printer` for `paperSize`.

These are the margins that define the area at the borders of the paper that the printer cannot print to.

Note: This will not succeed unless the printer’s details are available, see `printerHasDetails` and `printerRequestDetails`.

## getIconName

printerGetIconName Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrinter a) |
=> a | `printer`: a `GtkPrinter`
-> m Text | Returns: the icon name for `printer`

Gets the name of the icon to use for the printer.

## getJobCount

printerGetJobCount Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrinter a) |
=> a | `printer`: a `GtkPrinter`
-> m Int32 | Returns: the number of jobs on `printer`

Gets the number of jobs currently queued on the printer.

## getLocation

printerGetLocation Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrinter a) |
=> a | `printer`: a `GtkPrinter`
-> m Text | Returns: the location of `printer`

Returns a description of the location of the printer.

## getName

printerGetName Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrinter a) |
=> a | `printer`: a `GtkPrinter`
-> m Text | Returns: the name of `printer`

Returns the name of the printer.

## getStateMessage

printerGetStateMessage Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrinter a) |
=> a | `printer`: a `GtkPrinter`
-> m Text | Returns: the state message of `printer`

Returns the state message describing the current state of the printer.

## hasDetails

printerHasDetails Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrinter a) |
=> a | `printer`: a `GtkPrinter`
-> m Bool | Returns: `True` if `printer` details are available

Returns whether the printer details are available.

## isAcceptingJobs

printerIsAcceptingJobs Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrinter a) |
=> a | `printer`: a `GtkPrinter`
-> m Bool | Returns: `True` if `printer` is accepting jobs

Returns whether the printer is accepting jobs

## isActive

printerIsActive Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrinter a) |
=> a | `printer`: a `GtkPrinter`
-> m Bool | Returns: `True` if `printer` is active

Returns whether the printer is currently active (i.e. accepts new jobs).

## isDefault

printerIsDefault Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrinter a) |
=> a | `printer`: a `GtkPrinter`
-> m Bool | Returns: `True` if `printer` is the default

Returns whether the printer is the default printer.

## isPaused

printerIsPaused Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrinter a) |
=> a | `printer`: a `GtkPrinter`
-> m Bool | Returns: `True` if `printer` is paused

Returns whether the printer is currently paused.

A paused printer still accepts jobs, but it is not printing them.

## isVirtual

printerIsVirtual Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrinter a) |
=> a | `printer`: a `GtkPrinter`
-> m Bool | Returns: `True` if `printer` is virtual

Returns whether the printer is virtual (i.e. does not represent actual printer hardware, but something like a CUPS class).

## listPapers

printerListPapers Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrinter a) |
=> a | `printer`: a `GtkPrinter`
-> m [PageSetup] | Returns: a newly allocated list of newly allocated `GtkPageSetup`s.

Lists all the paper sizes `printer` supports.

This will return and empty list unless the printer’s details are available, see `printerHasDetails` and `printerRequestDetails`.

## new

printerNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `name`: the name of the printer
-> PrintBackend | `backend`: a `GtkPrintBackend`
-> Bool | `virtual_`: whether the printer is virtual
-> m Printer | Returns: a new `GtkPrinter`

Creates a new `GtkPrinter`.

## requestDetails

printerRequestDetails Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrinter a) |
=> a | `printer`: a `GtkPrinter`
-> m () |

Requests the printer details.

When the details are available, the Printer::detailsAcquired signal will be emitted on `printer`.

# Properties

## acceptingJobs

`True` if the printer is accepting jobs.

getPrinterAcceptingJobs :: (MonadIO m, IsPrinter o) => o -> m Bool Source #

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

    get printer #acceptingJobs

## acceptsPdf

`True` if this printer can accept PDF.

constructPrinterAcceptsPdf :: (IsPrinter o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getPrinterAcceptsPdf :: (MonadIO m, IsPrinter o) => o -> m Bool Source #

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

    get printer #acceptsPdf

## acceptsPs

`True` if this printer can accept PostScript.

constructPrinterAcceptsPs :: (IsPrinter o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getPrinterAcceptsPs :: (MonadIO m, IsPrinter o) => o -> m Bool Source #

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

    get printer #acceptsPs

## iconName

Icon name to use for the printer.

getPrinterIconName :: (MonadIO m, IsPrinter o) => o -> m Text Source #

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

    get printer #iconName

## isVirtual

`False` if this represents a real hardware device.

constructPrinterIsVirtual :: (IsPrinter o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getPrinterIsVirtual :: (MonadIO m, IsPrinter o) => o -> m Bool Source #

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

    get printer #isVirtual

## jobCount

Number of jobs queued in the printer.

getPrinterJobCount :: (MonadIO m, IsPrinter o) => o -> m Int32 Source #

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

    get printer #jobCount

## location

Information about the location of the printer.

getPrinterLocation :: (MonadIO m, IsPrinter o) => o -> m Text Source #

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

    get printer #location

## name

The name of the printer.

constructPrinterName :: (IsPrinter o, MonadIO m) => Text -> m (GValueConstruct o) Source #

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

getPrinterName :: (MonadIO m, IsPrinter o) => o -> m Text Source #

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

    get printer #name

## paused

`True` if this printer is paused.

A paused printer still accepts jobs, but it does not print them.

getPrinterPaused :: (MonadIO m, IsPrinter o) => o -> m Bool Source #

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

    get printer #paused

## stateMessage

String giving the current status of the printer.

getPrinterStateMessage :: (MonadIO m, IsPrinter o) => o -> m Text Source #

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

    get printer #stateMessage

# Signals

## detailsAcquired

type PrinterDetailsAcquiredCallback Source #

Arguments

= Bool | `success`: `True` if the details were successfully acquired
-> IO () |

Emitted in response to a request for detailed information about a printer from the print backend.

The `success` parameter indicates if the information was actually obtained.

afterPrinterDetailsAcquired :: (IsPrinter a, MonadIO m) => a -> ((?self :: a) => PrinterDetailsAcquiredCallback) -> m SignalHandlerId Source #

Connect a signal handler for the detailsAcquired signal, to be run after the default handler. When overloading is enabled, this is equivalent to

    after printer #detailsAcquired 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.

onPrinterDetailsAcquired :: (IsPrinter a, MonadIO m) => a -> ((?self :: a) => PrinterDetailsAcquiredCallback) -> m SignalHandlerId Source #

Connect a signal handler for the detailsAcquired signal, to be run before the default handler. When overloading is enabled, this is equivalent to

    on printer #detailsAcquired callback