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

Contents

- Exported types
- Methods
  - getAcceptLabel
  - getModal
  - getPageSetup
  - getPrintSettings
  - getTitle
  - new
  - print
  - printFile
  - printFileFinish
  - printFinish
  - setAcceptLabel
  - setModal
  - setPageSetup
  - setPrintSettings
  - setTitle
  - setup
  - setupFinish
- Properties
  - acceptLabel
  - modal
  - pageSetup
  - printSettings
  - title

Description

Asynchronous API to present a print dialog to the user.

`GtkPrintDialog` collects the arguments that are needed to present the dialog, such as a title for the dialog and whether it should be modal.

The dialog is shown with the `printDialogSetup` function.

The actual printing can be done with `printDialogPrint` or `printDialogPrintFile`. These APIs follows the GIO async pattern, and the results can be obtained by calling the corresponding finish methods.

Since: 4.14

Synopsis

- newtype PrintDialog = PrintDialog (ManagedPtr PrintDialog)
- class (GObject o, IsDescendantOf PrintDialog o) => IsPrintDialog o
- toPrintDialog :: (MonadIO m, IsPrintDialog o) => o -> m PrintDialog
- printDialogGetAcceptLabel :: (HasCallStack, MonadIO m, IsPrintDialog a) => a -> m Text
- printDialogGetModal :: (HasCallStack, MonadIO m, IsPrintDialog a) => a -> m Bool
- printDialogGetPageSetup :: (HasCallStack, MonadIO m, IsPrintDialog a) => a -> m (Maybe PageSetup)
- printDialogGetPrintSettings :: (HasCallStack, MonadIO m, IsPrintDialog a) => a -> m (Maybe PrintSettings)
- printDialogGetTitle :: (HasCallStack, MonadIO m, IsPrintDialog a) => a -> m Text
- printDialogNew :: (HasCallStack, MonadIO m) => m PrintDialog
- printDialogPrint :: (HasCallStack, MonadIO m, IsPrintDialog a, IsWindow b, IsCancellable c) => a -> Maybe b -> Maybe PrintSetup -> Maybe c -> Maybe AsyncReadyCallback -> m ()
- printDialogPrintFile :: (HasCallStack, MonadIO m, IsPrintDialog a, IsWindow b, IsFile c, IsCancellable d) => a -> Maybe b -> Maybe PrintSetup -> c -> Maybe d -> Maybe AsyncReadyCallback -> m ()
- printDialogPrintFileFinish :: (HasCallStack, MonadIO m, IsPrintDialog a, IsAsyncResult b) => a -> b -> m ()
- printDialogPrintFinish :: (HasCallStack, MonadIO m, IsPrintDialog a, IsAsyncResult b) => a -> b -> m OutputStream
- printDialogSetAcceptLabel :: (HasCallStack, MonadIO m, IsPrintDialog a) => a -> Text -> m ()
- printDialogSetModal :: (HasCallStack, MonadIO m, IsPrintDialog a) => a -> Bool -> m ()
- printDialogSetPageSetup :: (HasCallStack, MonadIO m, IsPrintDialog a, IsPageSetup b) => a -> b -> m ()
- printDialogSetPrintSettings :: (HasCallStack, MonadIO m, IsPrintDialog a, IsPrintSettings b) => a -> b -> m ()
- printDialogSetTitle :: (HasCallStack, MonadIO m, IsPrintDialog a) => a -> Text -> m ()
- printDialogSetup :: (HasCallStack, MonadIO m, IsPrintDialog a, IsWindow b, IsCancellable c) => a -> Maybe b -> Maybe c -> Maybe AsyncReadyCallback -> m ()
- printDialogSetupFinish :: (HasCallStack, MonadIO m, IsPrintDialog a, IsAsyncResult b) => a -> b -> m PrintSetup
- constructPrintDialogAcceptLabel :: (IsPrintDialog o, MonadIO m) => Text -> m (GValueConstruct o)
- getPrintDialogAcceptLabel :: (MonadIO m, IsPrintDialog o) => o -> m Text
- setPrintDialogAcceptLabel :: (MonadIO m, IsPrintDialog o) => o -> Text -> m ()
- constructPrintDialogModal :: (IsPrintDialog o, MonadIO m) => Bool -> m (GValueConstruct o)
- getPrintDialogModal :: (MonadIO m, IsPrintDialog o) => o -> m Bool
- setPrintDialogModal :: (MonadIO m, IsPrintDialog o) => o -> Bool -> m ()
- constructPrintDialogPageSetup :: (IsPrintDialog o, MonadIO m, IsPageSetup a) => a -> m (GValueConstruct o)
- getPrintDialogPageSetup :: (MonadIO m, IsPrintDialog o) => o -> m (Maybe PageSetup)
- setPrintDialogPageSetup :: (MonadIO m, IsPrintDialog o, IsPageSetup a) => o -> a -> m ()
- constructPrintDialogPrintSettings :: (IsPrintDialog o, MonadIO m, IsPrintSettings a) => a -> m (GValueConstruct o)
- getPrintDialogPrintSettings :: (MonadIO m, IsPrintDialog o) => o -> m (Maybe PrintSettings)
- setPrintDialogPrintSettings :: (MonadIO m, IsPrintDialog o, IsPrintSettings a) => o -> a -> m ()
- constructPrintDialogTitle :: (IsPrintDialog o, MonadIO m) => Text -> m (GValueConstruct o)
- getPrintDialogTitle :: (MonadIO m, IsPrintDialog o) => o -> m Text
- setPrintDialogTitle :: (MonadIO m, IsPrintDialog o) => o -> Text -> m ()

# Exported types

newtype PrintDialog Source #

Memory-managed wrapper type.

Constructors

PrintDialog (ManagedPtr PrintDialog) |

#### Instances

Instances details

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

class (GObject o, IsDescendantOf PrintDialog o) => IsPrintDialog o Source #

Type class for types which can be safely cast to `PrintDialog`, for instance with `toPrintDialog`.

#### Instances

Instances details

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

toPrintDialog :: (MonadIO m, IsPrintDialog o) => o -> m PrintDialog Source #

Cast to `PrintDialog`, 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, print, printFile, printFileFinish, printFinish, ref, refSink, runDispose, setup, setupFinish, stealData, stealQdata, thawNotify, unref, watchClosure.

#### Getters

getAcceptLabel, getData, getModal, getPageSetup, getPrintSettings, getProperty, getQdata, getTitle.

#### Setters

setAcceptLabel, setData, setDataFull, setModal, setPageSetup, setPrintSettings, setProperty, setTitle.

## getAcceptLabel

printDialogGetAcceptLabel Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintDialog a) |
=> a | `self`: a `GtkPrintDialog`
-> m Text | Returns: the accept label

Returns the label that will be shown on the accept button of the print dialog.

Since: 4.14

## getModal

printDialogGetModal Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintDialog a) |
=> a | `self`: a `GtkPrintDialog`
-> m Bool | Returns: whether the print dialog is modal

Returns whether the print dialog blocks interaction with the parent window while it is presented.

Since: 4.14

## getPageSetup

printDialogGetPageSetup Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintDialog a) |
=> a | `self`: a `GtkPrintDialog`
-> m (Maybe PageSetup) | Returns: the page setup

Returns the page setup.

Since: 4.14

## getPrintSettings

printDialogGetPrintSettings Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintDialog a) |
=> a | `self`: a `GtkPrintDialog`
-> m (Maybe PrintSettings) | Returns: the settings

Returns the print settings for the print dialog.

Since: 4.14

## getTitle

printDialogGetTitle Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintDialog a) |
=> a | `self`: a `GtkPrintDialog`
-> m Text | Returns: the title

Returns the title that will be shown on the print dialog.

Since: 4.14

## new

printDialogNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m PrintDialog | Returns: the new `GtkPrintDialog`

Creates a new `GtkPrintDialog` object.

Since: 4.14

## print

printDialogPrint Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintDialog a, IsWindow b, IsCancellable c) |
=> a | `self`: a `GtkPrintDialog`
-> Maybe b | `parent`: the parent `GtkWindow`
-> Maybe PrintSetup | `setup`: the `GtkPrintSetup` to use
-> Maybe c | `cancellable`: a `GCancellable` to cancel the operation
-> Maybe AsyncReadyCallback | `callback`: a callback to call when the operation is complete
-> m () |

This function prints content from a stream.

If you pass `NULL` as `setup`, then this method will present a print dialog. Otherwise, it will attempt to print directly, without user interaction.

The `callback` will be called when the printing is done.

Since: 4.14

## printFile

printDialogPrintFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintDialog a, IsWindow b, IsFile c, IsCancellable d) |
=> a | `self`: a `GtkPrintDialog`
-> Maybe b | `parent`: the parent `GtkWindow`
-> Maybe PrintSetup | `setup`: the `GtkPrintSetup` to use
-> c | `file`: the `GFile` to print
-> Maybe d | `cancellable`: a `GCancellable` to cancel the operation
-> Maybe AsyncReadyCallback | `callback`: a callback to call when the operation is complete
-> m () |

This function prints a file.

If you pass `NULL` as `setup`, then this method will present a print dialog. Otherwise, it will attempt to print directly, without user interaction.

Since: 4.14

## printFileFinish

printDialogPrintFileFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintDialog a, IsAsyncResult b) |
=> a | `self`: a `GtkPrintDialog`
-> b | `result`: a `GAsyncResult`
-> m () | (Can throw `GError`)

Finishes the `printDialogPrintFile` call and returns the results.

Note that this function returns a [error`gtk`.DialogError.DISMISSED] error if the user cancels the dialog.

Since: 4.14

## printFinish

printDialogPrintFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintDialog a, IsAsyncResult b) |
=> a | `self`: a `GtkPrintDialog`
-> b | `result`: a `GAsyncResult`
-> m OutputStream | Returns: a `OutputStream` (Can throw `GError`)

Finishes the `printDialogPrint` call and returns the results.

If the call was successful, the content to be printed should be written to the returned output stream. Otherwise, `NULL` is returned.

The overall results of the print operation will be returned in the `outputStreamClose` call, so if you are interested in the results, you need to explicitly close the output stream (it will be closed automatically if you just unref it). Be aware that the close call may not be instant as it operation will for the printer to finish printing.

Note that this function returns a [error`gtk`.DialogError.DISMISSED] error if the user cancels the dialog.

Since: 4.14

## setAcceptLabel

printDialogSetAcceptLabel Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintDialog a) |
=> a | `self`: a `GtkPrintDialog`
-> Text | `acceptLabel`: the new accept label
-> m () |

Sets the label that will be shown on the accept button of the print dialog shown for `printDialogSetup`.

Since: 4.14

## setModal

printDialogSetModal Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintDialog a) |
=> a | `self`: a `GtkPrintDialog`
-> Bool | `modal`: the new value
-> m () |

Sets whether the print dialog blocks interaction with the parent window while it is presented.

Since: 4.14

## setPageSetup

printDialogSetPageSetup Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintDialog a, IsPageSetup b) |
=> a | `self`: a `GtkPrintDialog`
-> b | `pageSetup`: the new page setup
-> m () |

Set the page setup for the print dialog.

Since: 4.14

## setPrintSettings

printDialogSetPrintSettings Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintDialog a, IsPrintSettings b) |
=> a | `self`: a `GtkPrintDialog`
-> b | `printSettings`: the new print settings
-> m () |

Sets the print settings for the print dialog.

Since: 4.14

## setTitle

printDialogSetTitle Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintDialog a) |
=> a | `self`: a `GtkPrintDialog`
-> Text | `title`: the new title
-> m () |

Sets the title that will be shown on the print dialog.

Since: 4.14

## setup

printDialogSetup Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintDialog a, IsWindow b, IsCancellable c) |
=> a | `self`: a `GtkPrintDialog`
-> Maybe b | `parent`: the parent `GtkWindow`
-> Maybe c | `cancellable`: a `GCancellable` to cancel the operation
-> Maybe AsyncReadyCallback | `callback`: a callback to call when the operation is complete
-> m () |

This function presents a print dialog to let the user select a printer, and set up print settings and page setup.

The `callback` will be called when the dialog is dismissed. The obtained `PrintSetup` can then be passed to `printDialogPrint` or `printDialogPrintFile`.

One possible use for this method is to have the user select a printer, then show a page setup UI in the application (e.g. to arrange images on a page), then call `printDialogPrint` on `self` to do the printing without further user interaction.

Since: 4.14

## setupFinish

printDialogSetupFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsPrintDialog a, IsAsyncResult b) |
=> a | `self`: a `GtkPrintDialog`
-> b | `result`: a `GAsyncResult`
-> m PrintSetup | Returns: the resulting `[struct@Gtk.PrintSetup]` (Can throw `GError`)

Finishes the `printDialogSetup` call.

If the call was successful, it returns a `PrintSetup` which contains the print settings and page setup information that will be used to print.

Note that this function returns a [error`gtk`.DialogError.DISMISSED] error if the user cancels the dialog.

Since: 4.14

# Properties

## acceptLabel

A label that may be shown on the accept button of a print dialog that is presented by `printDialogSetup`.

Since: 4.14

constructPrintDialogAcceptLabel :: (IsPrintDialog o, MonadIO m) => Text -> m (GValueConstruct o) Source #

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

getPrintDialogAcceptLabel :: (MonadIO m, IsPrintDialog o) => o -> m Text Source #

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

    get printDialog #acceptLabel

setPrintDialogAcceptLabel :: (MonadIO m, IsPrintDialog o) => o -> Text -> m () Source #

Set the value of the “`accept-label`” property. When overloading is enabled, this is equivalent to

    set printDialog [ #acceptLabel := value ]

## modal

Whether the print dialog is modal.

Since: 4.14

constructPrintDialogModal :: (IsPrintDialog o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getPrintDialogModal :: (MonadIO m, IsPrintDialog o) => o -> m Bool Source #

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

    get printDialog #modal

setPrintDialogModal :: (MonadIO m, IsPrintDialog o) => o -> Bool -> m () Source #

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

    set printDialog [ #modal := value ]

## pageSetup

The page setup to use.

Since: 4.14

constructPrintDialogPageSetup :: (IsPrintDialog 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`.

getPrintDialogPageSetup :: (MonadIO m, IsPrintDialog o) => o -> m (Maybe PageSetup) Source #

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

    get printDialog #pageSetup

setPrintDialogPageSetup :: (MonadIO m, IsPrintDialog o, IsPageSetup a) => o -> a -> m () Source #

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

    set printDialog [ #pageSetup := value ]

## printSettings

The print settings to use.

Since: 4.14

constructPrintDialogPrintSettings :: (IsPrintDialog o, MonadIO m, IsPrintSettings a) => a -> m (GValueConstruct o) Source #

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

getPrintDialogPrintSettings :: (MonadIO m, IsPrintDialog o) => o -> m (Maybe PrintSettings) Source #

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

    get printDialog #printSettings

setPrintDialogPrintSettings :: (MonadIO m, IsPrintDialog o, IsPrintSettings a) => o -> a -> m () Source #

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

    set printDialog [ #printSettings := value ]

## title

A title that may be shown on the print dialog that is presented by `printDialogSetup`.

Since: 4.14

constructPrintDialogTitle :: (IsPrintDialog 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`.

getPrintDialogTitle :: (MonadIO m, IsPrintDialog o) => o -> m Text Source #

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

    get printDialog #title

setPrintDialogTitle :: (MonadIO m, IsPrintDialog o) => o -> Text -> m () Source #

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

    set printDialog [ #title := value ]