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 |
A GtkPrinter
object 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
Memory-managed wrapper type.
Instances
Eq Printer Source # | |
GObject Printer Source # | |
Defined in GI.Gtk.Objects.Printer | |
ManagedPtrNewtype Printer Source # | |
Defined in GI.Gtk.Objects.Printer toManagedPtr :: Printer -> ManagedPtr Printer | |
TypedObject Printer Source # | |
Defined in GI.Gtk.Objects.Printer | |
HasParentTypes Printer Source # | |
Defined in GI.Gtk.Objects.Printer | |
IsGValue (Maybe Printer) Source # | Convert |
Defined in GI.Gtk.Objects.Printer gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Printer -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Printer) | |
type ParentTypes Printer Source # | |
Defined in GI.Gtk.Objects.Printer type ParentTypes Printer = '[Object] |
class (GObject o, IsDescendantOf Printer o) => IsPrinter o Source #
Instances
(GObject o, IsDescendantOf Printer o) => IsPrinter o Source # | |
Defined in GI.Gtk.Objects.Printer |
Methods
Click to display all available methods, including inherited ones
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
acceptsPdf
:: (HasCallStack, MonadIO m, IsPrinter a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether the printer accepts input in PDF format.
acceptsPs
:: (HasCallStack, MonadIO m, IsPrinter a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether the printer accepts input in PostScript format.
compare
:: (HasCallStack, MonadIO m, IsPrinter a, IsPrinter b) | |
=> a |
|
-> b |
|
-> m Int32 | Returns: 0 if the printer match, a negative value if |
Compares two printers.
getBackend
:: (HasCallStack, MonadIO m, IsPrinter a) | |
=> a |
|
-> m PrintBackend | Returns: the backend of |
Returns the backend of the printer.
getCapabilities
printerGetCapabilities Source #
:: (HasCallStack, MonadIO m, IsPrinter a) | |
=> a |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsPrinter a) | |
=> a |
|
-> m PageSetup | Returns: a newly allocated |
Returns default page size of printer
.
getDescription
printerGetDescription Source #
:: (HasCallStack, MonadIO m, IsPrinter a) | |
=> a |
|
-> m Text | Returns: the description of |
Gets the description of the printer.
getHardMargins
printerGetHardMargins Source #
:: (HasCallStack, MonadIO m, IsPrinter a) | |
=> a |
|
-> m (Bool, Double, Double, Double, Double) | Returns: |
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 #
:: (HasCallStack, MonadIO m, IsPrinter a) | |
=> a |
|
-> PaperSize |
|
-> m (Bool, Double, Double, Double, Double) | Returns: |
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
:: (HasCallStack, MonadIO m, IsPrinter a) | |
=> a |
|
-> m Text | Returns: the icon name for |
Gets the name of the icon to use for the printer.
getJobCount
:: (HasCallStack, MonadIO m, IsPrinter a) | |
=> a |
|
-> m Int32 | Returns: the number of jobs on |
Gets the number of jobs currently queued on the printer.
getLocation
:: (HasCallStack, MonadIO m, IsPrinter a) | |
=> a |
|
-> m Text | Returns: the location of |
Returns a description of the location of the printer.
getName
:: (HasCallStack, MonadIO m, IsPrinter a) | |
=> a |
|
-> m Text | Returns: the name of |
Returns the name of the printer.
getStateMessage
printerGetStateMessage Source #
:: (HasCallStack, MonadIO m, IsPrinter a) | |
=> a |
|
-> m Text | Returns: the state message of |
Returns the state message describing the current state of the printer.
hasDetails
:: (HasCallStack, MonadIO m, IsPrinter a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether the printer details are available.
isAcceptingJobs
printerIsAcceptingJobs Source #
:: (HasCallStack, MonadIO m, IsPrinter a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether the printer is accepting jobs
isActive
:: (HasCallStack, MonadIO m, IsPrinter a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether the printer is currently active (i.e. accepts new jobs).
isDefault
:: (HasCallStack, MonadIO m, IsPrinter a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether the printer is the default printer.
isPaused
:: (HasCallStack, MonadIO m, IsPrinter a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether the printer is currently paused.
A paused printer still accepts jobs, but it is not printing them.
isVirtual
:: (HasCallStack, MonadIO m, IsPrinter a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether the printer is virtual (i.e. does not represent actual printer hardware, but something like a CUPS class).
listPapers
:: (HasCallStack, MonadIO m, IsPrinter a) | |
=> a |
|
-> m [PageSetup] | Returns: a newly
allocated list of newly allocated |
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
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> PrintBackend |
|
-> Bool |
|
-> m Printer | Returns: a new |
Creates a new GtkPrinter
.
requestDetails
printerRequestDetails Source #
:: (HasCallStack, MonadIO m, IsPrinter a) | |
=> a |
|
-> 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 #
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