{-# LINE 2 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
-- -*-haskell-*-
-- GIMP Toolkit (GTK) Widget PrintOperation
--
-- Author : Andy Stewart
--
-- Created: 28 Mar 2010
--
-- Copyright (C) 2010 Andy Stewart
--
-- This library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- |
-- Maintainer : gtk2hs-users@lists.sourceforge.net
-- Stability : provisional
-- Portability : portable (depends on GHC)
--
-- High-level Printing API
--
-- * Module available since Gtk+ version 2.10
--
module Graphics.UI.Gtk.Printing.PrintOperation (

-- * 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
  PrintOperation,
  PrintOperationClass,
  castToPrintOperation,
  toPrintOperation,

  PrintOperationPreview,
  PrintOperationPreviewClass,
  castToPrintOperationPreview,
  toPrintOperationPreview,

-- * Enums
  PrintStatus(..),
  PrintOperationAction(..),
  PrintOperationResult(..),
  PrintError(..),

-- * Constructors
  printOperationNew,

-- * Methods
  printOperationSetAllowAsync,
  printOperationGetError,
  printOperationSetJobName,
  printOperationSetNPages,

  printOperationGetNPagesToPrint,

  printOperationSetCurrentPage,
  printOperationSetUseFullPage,
  printOperationSetUnit,
  printOperationSetExportFilename,
  printOperationSetShowProgress,
  printOperationSetTrackPrintStatus,
  printOperationSetCustomTabLabel,
  printOperationRun,
  printOperationCancel,

  printOperationDrawPageFinish,
  printOperationSetDeferDrawing,

  printOperationGetStatus,
  printOperationGetStatusString,
  printOperationIsFinished,
  printRunPageSetupDialog,
  printRunPageSetupDialogAsync,

  printOperationPreviewEndPreview,
  printOperationPreviewIsSelected,
  printOperationPreviewRenderPage,

-- * Attributes
  printOperationDefaultPageSetup,
  printOperationPrintSettings,
  printOperationJobName,
  printOperationNPages,
  printOperationCurrentPage,
  printOperationUseFullPage,
  printOperationTrackPrintStatus,
  printOperationUnit,
  printOperationShowProgress,
  printOperationAllowAsync,
  printOperationExportFilename,
  printOperationStatus,
  printOperationStatusString,
  printOperationCustomTabLabel,

  printOperationSupportSelection,
  printOperationHasSelection,
  printOperationEmbedPageSetup,
  printOperationNPagesToPrint,


-- * Signals
  printOptDone,
  printOptBeginPrint,
  printOptPaginate,
  printOptRequestPageSetup,
  printOptDrawPage,
  printOptEndPrint,
  printOptStatusChanged,
  printOptCreateCustomWidget,

  printOptUpdateCustomWidget,

  printOptCustomWidgetApply,
  printOptPreview,
  printOptReady,
  printOptGotPageSize,

  ) where

import Control.Monad (liftM)

import System.Glib.FFI
import System.Glib.Attributes
import System.Glib.Properties
import System.Glib.UTFString
import System.Glib.GError
import Graphics.UI.Gtk.Types
{-# LINE 171 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
import Graphics.UI.Gtk.Signals
{-# LINE 172 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
import Graphics.UI.Gtk.Printing.PaperSize (Unit(..))


{-# LINE 175 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}


--------------------
-- Interfaces

instance PrintOperationPreviewClass PrintOperation

--------------------
-- Enums
-- | The status gives a rough indication of the completion of a running print operation.
data PrintStatus = PrintStatusInitial
                 | PrintStatusPreparing
                 | PrintStatusGeneratingData
                 | PrintStatusSendingData
                 | PrintStatusPending
                 | PrintStatusPendingIssue
                 | PrintStatusPrinting
                 | PrintStatusFinished
                 | PrintStatusFinishedAborted
                 deriving (Int -> PrintStatus
PrintStatus -> Int
PrintStatus -> [PrintStatus]
PrintStatus -> PrintStatus
PrintStatus -> PrintStatus -> [PrintStatus]
PrintStatus -> PrintStatus -> PrintStatus -> [PrintStatus]
(PrintStatus -> PrintStatus)
-> (PrintStatus -> PrintStatus)
-> (Int -> PrintStatus)
-> (PrintStatus -> Int)
-> (PrintStatus -> [PrintStatus])
-> (PrintStatus -> PrintStatus -> [PrintStatus])
-> (PrintStatus -> PrintStatus -> [PrintStatus])
-> (PrintStatus -> PrintStatus -> PrintStatus -> [PrintStatus])
-> Enum PrintStatus
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: PrintStatus -> PrintStatus
succ :: PrintStatus -> PrintStatus
$cpred :: PrintStatus -> PrintStatus
pred :: PrintStatus -> PrintStatus
$ctoEnum :: Int -> PrintStatus
toEnum :: Int -> PrintStatus
$cfromEnum :: PrintStatus -> Int
fromEnum :: PrintStatus -> Int
$cenumFrom :: PrintStatus -> [PrintStatus]
enumFrom :: PrintStatus -> [PrintStatus]
$cenumFromThen :: PrintStatus -> PrintStatus -> [PrintStatus]
enumFromThen :: PrintStatus -> PrintStatus -> [PrintStatus]
$cenumFromTo :: PrintStatus -> PrintStatus -> [PrintStatus]
enumFromTo :: PrintStatus -> PrintStatus -> [PrintStatus]
$cenumFromThenTo :: PrintStatus -> PrintStatus -> PrintStatus -> [PrintStatus]
enumFromThenTo :: PrintStatus -> PrintStatus -> PrintStatus -> [PrintStatus]
Enum,PrintStatus
PrintStatus -> PrintStatus -> Bounded PrintStatus
forall a. a -> a -> Bounded a
$cminBound :: PrintStatus
minBound :: PrintStatus
$cmaxBound :: PrintStatus
maxBound :: PrintStatus
Bounded,PrintStatus -> PrintStatus -> Bool
(PrintStatus -> PrintStatus -> Bool)
-> (PrintStatus -> PrintStatus -> Bool) -> Eq PrintStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PrintStatus -> PrintStatus -> Bool
== :: PrintStatus -> PrintStatus -> Bool
$c/= :: PrintStatus -> PrintStatus -> Bool
/= :: PrintStatus -> PrintStatus -> Bool
Eq,Int -> PrintStatus -> ShowS
[PrintStatus] -> ShowS
PrintStatus -> String
(Int -> PrintStatus -> ShowS)
-> (PrintStatus -> String)
-> ([PrintStatus] -> ShowS)
-> Show PrintStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PrintStatus -> ShowS
showsPrec :: Int -> PrintStatus -> ShowS
$cshow :: PrintStatus -> String
show :: PrintStatus -> String
$cshowList :: [PrintStatus] -> ShowS
showList :: [PrintStatus] -> ShowS
Show)

{-# LINE 186 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}

-- | The action parameter to 'printOperationRun' determines what action the print operation should
-- perform.
data PrintOperationAction = PrintOperationActionPrintDialog
                          | PrintOperationActionPrint
                          | PrintOperationActionPreview
                          | PrintOperationActionExport
                          deriving (Enum,Bounded,Eq,Show)

{-# LINE 190 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}

-- | A value of this type is returned by 'printOperationRun'.
data PrintOperationResult = PrintOperationResultError
                          | PrintOperationResultApply
                          | PrintOperationResultCancel
                          | PrintOperationResultInProgress
                          deriving (Enum,Bounded,Eq,Show)

{-# LINE 193 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}

-- | Error codes that identify various errors that can occur while using the GTK+ printing support.
data PrintError = PrintErrorGeneral
                | PrintErrorInternalError
                | PrintErrorNomem
                | PrintErrorInvalidFile
                deriving (Enum,Bounded,Eq,Show)

{-# LINE 196 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}

--------------------
-- Constructors

-- | Creates a new 'PrintOperation'.
--
printOperationNew :: IO PrintOperation
printOperationNew :: IO PrintOperation
printOperationNew =
  (ForeignPtr PrintOperation -> PrintOperation,
 FinalizerPtr PrintOperation)
-> IO (Ptr PrintOperation) -> IO PrintOperation
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
wrapNewGObject (ForeignPtr PrintOperation -> PrintOperation,
 FinalizerPtr PrintOperation)
forall {a}.
(ForeignPtr PrintOperation -> PrintOperation, FinalizerPtr a)
mkPrintOperation (IO (Ptr PrintOperation) -> IO PrintOperation)
-> IO (Ptr PrintOperation) -> IO PrintOperation
forall a b. (a -> b) -> a -> b
$
  IO (Ptr PrintOperation)
gtk_print_operation_new
{-# LINE 206 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}

--------------------
-- Methods

-- | Sets whether the 'printOperationRun' may return before the print
-- operation is completed. Note that some platforms may not allow asynchronous
-- operation.
--
printOperationSetAllowAsync :: PrintOperationClass self => self
 -> Bool -- ^ @allowAsync@ - @True@ to allow asynchronous operation
 -> IO ()
printOperationSetAllowAsync :: forall self. PrintOperationClass self => self -> Bool -> IO ()
printOperationSetAllowAsync self
self Bool
allowAsync =
  (\(PrintOperation ForeignPtr PrintOperation
arg1) CInt
arg2 -> ForeignPtr PrintOperation -> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintOperation
arg1 ((Ptr PrintOperation -> IO ()) -> IO ())
-> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr PrintOperation
argPtr1 ->Ptr PrintOperation -> CInt -> IO ()
gtk_print_operation_set_allow_async Ptr PrintOperation
argPtr1 CInt
arg2)
{-# LINE 219 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
    (toPrintOperation self)
    (Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
allowAsync)

-- | 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.
--
printOperationGetError :: PrintOperationClass self => self -> IO ()
printOperationGetError :: forall self. PrintOperationClass self => self -> IO ()
printOperationGetError self
self =
  (Ptr (Ptr ()) -> IO ()) -> IO ()
forall a. (Ptr (Ptr ()) -> IO a) -> IO a
propagateGError ((Ptr (Ptr ()) -> IO ()) -> IO ())
-> (Ptr (Ptr ()) -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
errorPtr ->
  (\(PrintOperation ForeignPtr PrintOperation
arg1) Ptr (Ptr ())
arg2 -> ForeignPtr PrintOperation -> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintOperation
arg1 ((Ptr PrintOperation -> IO ()) -> IO ())
-> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr PrintOperation
argPtr1 ->Ptr PrintOperation -> Ptr (Ptr ()) -> IO ()
gtk_print_operation_get_error Ptr PrintOperation
argPtr1 Ptr (Ptr ())
arg2)
{-# LINE 231 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
    (toPrintOperation self)
    Ptr (Ptr ())
errorPtr

-- | 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.
--
printOperationSetJobName :: (PrintOperationClass self, GlibString string) => self
 -> string -- ^ @jobName@ - a string that identifies the print job
 -> IO ()
printOperationSetJobName :: forall self string.
(PrintOperationClass self, GlibString string) =>
self -> string -> IO ()
printOperationSetJobName self
self string
jobName =
  string -> (CString -> IO ()) -> IO ()
forall a. string -> (CString -> IO a) -> IO a
forall s a. GlibString s => s -> (CString -> IO a) -> IO a
withUTFString string
jobName ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \CString
jobNamePtr ->
  (\(PrintOperation ForeignPtr PrintOperation
arg1) CString
arg2 -> ForeignPtr PrintOperation -> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintOperation
arg1 ((Ptr PrintOperation -> IO ()) -> IO ())
-> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr PrintOperation
argPtr1 ->Ptr PrintOperation -> CString -> IO ()
gtk_print_operation_set_job_name Ptr PrintOperation
argPtr1 CString
arg2)
{-# LINE 246 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
    (toPrintOperation self)
    CString
jobNamePtr

-- | 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 hander.
--
-- 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.
--
printOperationSetNPages :: PrintOperationClass self => self
 -> Int -- ^ @nPages@ - the number of pages
 -> IO ()
printOperationSetNPages :: forall self. PrintOperationClass self => self -> Int -> IO ()
printOperationSetNPages self
self Int
nPages =
  (\(PrintOperation ForeignPtr PrintOperation
arg1) CInt
arg2 -> ForeignPtr PrintOperation -> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintOperation
arg1 ((Ptr PrintOperation -> IO ()) -> IO ())
-> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr PrintOperation
argPtr1 ->Ptr PrintOperation -> CInt -> IO ()
gtk_print_operation_set_n_pages Ptr PrintOperation
argPtr1 CInt
arg2)
{-# LINE 264 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
    (toPrintOperation self)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
nPages)


-- | 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
--
printOperationGetNPagesToPrint :: PrintOperationClass self => self
 -> IO Int -- ^ returns the number of pages that will be printed
printOperationGetNPagesToPrint :: forall self. PrintOperationClass self => self -> IO Int
printOperationGetNPagesToPrint self
self =
  (CInt -> Int) -> IO CInt -> IO Int
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (IO CInt -> IO Int) -> IO CInt -> IO Int
forall a b. (a -> b) -> a -> b
$
  (\(PrintOperation ForeignPtr PrintOperation
arg1) -> ForeignPtr PrintOperation
-> (Ptr PrintOperation -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintOperation
arg1 ((Ptr PrintOperation -> IO CInt) -> IO CInt)
-> (Ptr PrintOperation -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr PrintOperation
argPtr1 ->Ptr PrintOperation -> IO CInt
gtk_print_operation_get_n_pages_to_print Ptr PrintOperation
argPtr1)
{-# LINE 285 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
    (toPrintOperation self)


-- | 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.
--
printOperationSetCurrentPage :: PrintOperationClass self => self
 -> Int -- ^ @currentPage@ - the current page, 0-based
 -> IO ()
printOperationSetCurrentPage :: forall self. PrintOperationClass self => self -> Int -> IO ()
printOperationSetCurrentPage self
self Int
currentPage =
  (\(PrintOperation ForeignPtr PrintOperation
arg1) CInt
arg2 -> ForeignPtr PrintOperation -> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintOperation
arg1 ((Ptr PrintOperation -> IO ()) -> IO ())
-> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr PrintOperation
argPtr1 ->Ptr PrintOperation -> CInt -> IO ()
gtk_print_operation_set_current_page Ptr PrintOperation
argPtr1 CInt
arg2)
{-# LINE 300 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
    (toPrintOperation self)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
currentPage)

-- | 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).
--
printOperationSetUseFullPage :: PrintOperationClass self => self
 -> Bool -- ^ @fullPage@ - @True@ to set up the 'PrintContext' for the full
         -- page
 -> IO ()
printOperationSetUseFullPage :: forall self. PrintOperationClass self => self -> Bool -> IO ()
printOperationSetUseFullPage self
self Bool
fullPage =
  (\(PrintOperation ForeignPtr PrintOperation
arg1) CInt
arg2 -> ForeignPtr PrintOperation -> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintOperation
arg1 ((Ptr PrintOperation -> IO ()) -> IO ())
-> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr PrintOperation
argPtr1 ->Ptr PrintOperation -> CInt -> IO ()
gtk_print_operation_set_use_full_page Ptr PrintOperation
argPtr1 CInt
arg2)
{-# LINE 315 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
    (toPrintOperation self)
    (Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
fullPage)

-- | Sets up the transformation for the cairo context obtained from
-- 'PrintContext' in such a way that distances are measured in units of @unit@.
--
printOperationSetUnit :: PrintOperationClass self => self
 -> Unit -- ^ @unit@ - the unit to use
 -> IO ()
printOperationSetUnit :: forall self. PrintOperationClass self => self -> Unit -> IO ()
printOperationSetUnit self
self Unit
unit =
  (\(PrintOperation ForeignPtr PrintOperation
arg1) CInt
arg2 -> ForeignPtr PrintOperation -> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintOperation
arg1 ((Ptr PrintOperation -> IO ()) -> IO ())
-> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr PrintOperation
argPtr1 ->Ptr PrintOperation -> CInt -> IO ()
gtk_print_operation_set_unit Ptr PrintOperation
argPtr1 CInt
arg2)
{-# LINE 326 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
    (toPrintOperation self)
    ((Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Unit -> Int) -> Unit -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Unit -> Int
forall a. Enum a => a -> Int
fromEnum) Unit
unit)

-- | Sets up the 'PrintOperation' to generate a file instead of showing the
-- print dialog. The indended 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.
--
printOperationSetExportFilename :: (PrintOperationClass self, GlibString string) => self
 -> string -- ^ @filename@ - the filename for the exported file
 -> IO ()
printOperationSetExportFilename :: forall self string.
(PrintOperationClass self, GlibString string) =>
self -> string -> IO ()
printOperationSetExportFilename self
self string
filename =
  string -> (CString -> IO ()) -> IO ()
forall a. string -> (CString -> IO a) -> IO a
forall s a. GlibString s => s -> (CString -> IO a) -> IO a
withUTFString string
filename ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \CString
filenamePtr ->
  (\(PrintOperation ForeignPtr PrintOperation
arg1) CString
arg2 -> ForeignPtr PrintOperation -> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintOperation
arg1 ((Ptr PrintOperation -> IO ()) -> IO ())
-> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr PrintOperation
argPtr1 ->Ptr PrintOperation -> CString -> IO ()
gtk_print_operation_set_export_filename Ptr PrintOperation
argPtr1 CString
arg2)
{-# LINE 343 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
    (toPrintOperation self)
    CString
filenamePtr

-- | If @showProgress@ is @True@, the print operation will show a progress
-- dialog during the print operation.
--
printOperationSetShowProgress :: PrintOperationClass self => self
 -> Bool -- ^ @showProgress@ - @True@ to show a progress dialog
 -> IO ()
printOperationSetShowProgress :: forall self. PrintOperationClass self => self -> Bool -> IO ()
printOperationSetShowProgress self
self Bool
showProgress =
  (\(PrintOperation ForeignPtr PrintOperation
arg1) CInt
arg2 -> ForeignPtr PrintOperation -> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintOperation
arg1 ((Ptr PrintOperation -> IO ()) -> IO ())
-> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr PrintOperation
argPtr1 ->Ptr PrintOperation -> CInt -> IO ()
gtk_print_operation_set_show_progress Ptr PrintOperation
argPtr1 CInt
arg2)
{-# LINE 354 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
    (toPrintOperation self)
    (Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
showProgress)

-- | 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.
--
printOperationSetTrackPrintStatus :: PrintOperationClass self => self
 -> Bool -- ^ @trackStatus@ - @True@ to track status after printing
 -> IO ()
printOperationSetTrackPrintStatus :: forall self. PrintOperationClass self => self -> Bool -> IO ()
printOperationSetTrackPrintStatus self
self Bool
trackStatus =
  (\(PrintOperation ForeignPtr PrintOperation
arg1) CInt
arg2 -> ForeignPtr PrintOperation -> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintOperation
arg1 ((Ptr PrintOperation -> IO ()) -> IO ())
-> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr PrintOperation
argPtr1 ->Ptr PrintOperation -> CInt -> IO ()
gtk_print_operation_set_track_print_status Ptr PrintOperation
argPtr1 CInt
arg2)
{-# LINE 370 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
    (toPrintOperation self)
    (Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
trackStatus)

-- | Sets the label for the tab holding custom widgets.
--
printOperationSetCustomTabLabel :: (PrintOperationClass self, GlibString string) => self
 -> string -- ^ @label@ - the label to use, or empty to use the default
           -- label
 -> IO ()
printOperationSetCustomTabLabel :: forall self string.
(PrintOperationClass self, GlibString string) =>
self -> string -> IO ()
printOperationSetCustomTabLabel self
self string
label =
  string -> (CString -> IO ()) -> IO ()
forall a. string -> (CString -> IO a) -> IO a
forall s a. GlibString s => s -> (CString -> IO a) -> IO a
withUTFString string
label ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \CString
labelPtr ->
  (\(PrintOperation ForeignPtr PrintOperation
arg1) CString
arg2 -> ForeignPtr PrintOperation -> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintOperation
arg1 ((Ptr PrintOperation -> IO ()) -> IO ())
-> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr PrintOperation
argPtr1 ->Ptr PrintOperation -> CString -> IO ()
gtk_print_operation_set_custom_tab_label Ptr PrintOperation
argPtr1 CString
arg2)
{-# LINE 382 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
    (toPrintOperation self)
    CString
labelPtr

-- | 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).
--
printOperationRun :: (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.
printOperationRun :: forall self parent.
(PrintOperationClass self, WindowClass parent) =>
self -> PrintOperationAction -> parent -> IO PrintOperationResult
printOperationRun self
self PrintOperationAction
action parent
parent =
  (CInt -> PrintOperationResult)
-> IO CInt -> IO PrintOperationResult
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Int -> PrintOperationResult
forall a. Enum a => Int -> a
toEnum (Int -> PrintOperationResult)
-> (CInt -> Int) -> CInt -> PrintOperationResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) (IO CInt -> IO PrintOperationResult)
-> IO CInt -> IO PrintOperationResult
forall a b. (a -> b) -> a -> b
$
  (Ptr (Ptr ()) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr ()) -> IO a) -> IO a
propagateGError ((Ptr (Ptr ()) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr ()) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr ())
errorPtr ->
  (\(PrintOperation ForeignPtr PrintOperation
arg1) CInt
arg2 (Window ForeignPtr Window
arg3) Ptr (Ptr ())
arg4 -> ForeignPtr PrintOperation
-> (Ptr PrintOperation -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintOperation
arg1 ((Ptr PrintOperation -> IO CInt) -> IO CInt)
-> (Ptr PrintOperation -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr PrintOperation
argPtr1 ->ForeignPtr Window -> (Ptr Window -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Window
arg3 ((Ptr Window -> IO CInt) -> IO CInt)
-> (Ptr Window -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Window
argPtr3 ->Ptr PrintOperation -> CInt -> Ptr Window -> Ptr (Ptr ()) -> IO CInt
gtk_print_operation_run Ptr PrintOperation
argPtr1 CInt
arg2 Ptr Window
argPtr3 Ptr (Ptr ())
arg4)
{-# LINE 416 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
    (toPrintOperation self)
    ((Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt)
-> (PrintOperationAction -> Int) -> PrintOperationAction -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PrintOperationAction -> Int
forall a. Enum a => a -> Int
fromEnum) PrintOperationAction
action)
    (parent -> Window
forall o. WindowClass o => o -> Window
toWindow parent
parent)
    Ptr (Ptr ())
errorPtr

-- | 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.
--
printOperationCancel :: PrintOperationClass self => self -> IO ()
printOperationCancel :: forall self. PrintOperationClass self => self -> IO ()
printOperationCancel self
self =
  (\(PrintOperation ForeignPtr PrintOperation
arg1) -> ForeignPtr PrintOperation -> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintOperation
arg1 ((Ptr PrintOperation -> IO ()) -> IO ())
-> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr PrintOperation
argPtr1 ->Ptr PrintOperation -> IO ()
gtk_print_operation_cancel Ptr PrintOperation
argPtr1)
{-# LINE 428 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
    (toPrintOperation self)


-- | 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
--
printOperationDrawPageFinish :: PrintOperationClass self => self -> IO ()
printOperationDrawPageFinish :: forall self. PrintOperationClass self => self -> IO ()
printOperationDrawPageFinish self
self =
  (\(PrintOperation ForeignPtr PrintOperation
arg1) -> ForeignPtr PrintOperation -> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintOperation
arg1 ((Ptr PrintOperation -> IO ()) -> IO ())
-> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr PrintOperation
argPtr1 ->Ptr PrintOperation -> IO ()
gtk_print_operation_draw_page_finish Ptr PrintOperation
argPtr1)
{-# LINE 443 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
    (toPrintOperation self)

-- | 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
--
printOperationSetDeferDrawing :: PrintOperationClass self => self -> IO ()
printOperationSetDeferDrawing :: forall self. PrintOperationClass self => self -> IO ()
printOperationSetDeferDrawing self
self =
  (\(PrintOperation ForeignPtr PrintOperation
arg1) -> ForeignPtr PrintOperation -> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintOperation
arg1 ((Ptr PrintOperation -> IO ()) -> IO ())
-> (Ptr PrintOperation -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr PrintOperation
argPtr1 ->Ptr PrintOperation -> IO ()
gtk_print_operation_set_defer_drawing Ptr PrintOperation
argPtr1)
{-# LINE 456 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
    (toPrintOperation self)


-- | Returns the status of the print operation. Also see
-- 'printOperationGetStatusString'.
--
printOperationGetStatus :: PrintOperationClass self => self
 -> IO PrintStatus -- ^ returns the status of the print operation
printOperationGetStatus :: forall self. PrintOperationClass self => self -> IO PrintStatus
printOperationGetStatus self
self =
  (CInt -> PrintStatus) -> IO CInt -> IO PrintStatus
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Int -> PrintStatus
forall a. Enum a => Int -> a
toEnum (Int -> PrintStatus) -> (CInt -> Int) -> CInt -> PrintStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) (IO CInt -> IO PrintStatus) -> IO CInt -> IO PrintStatus
forall a b. (a -> b) -> a -> b
$
  (\(PrintOperation ForeignPtr PrintOperation
arg1) -> ForeignPtr PrintOperation
-> (Ptr PrintOperation -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintOperation
arg1 ((Ptr PrintOperation -> IO CInt) -> IO CInt)
-> (Ptr PrintOperation -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr PrintOperation
argPtr1 ->Ptr PrintOperation -> IO CInt
gtk_print_operation_get_status Ptr PrintOperation
argPtr1)
{-# LINE 467 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
    (toPrintOperation self)

-- | 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.
--
printOperationGetStatusString :: (PrintOperationClass self, GlibString string) => self
 -> IO string -- ^ returns a string representation of the status of the print
              -- operation
printOperationGetStatusString :: forall self string.
(PrintOperationClass self, GlibString string) =>
self -> IO string
printOperationGetStatusString self
self =
  (\(PrintOperation ForeignPtr PrintOperation
arg1) -> ForeignPtr PrintOperation
-> (Ptr PrintOperation -> IO CString) -> IO CString
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintOperation
arg1 ((Ptr PrintOperation -> IO CString) -> IO CString)
-> (Ptr PrintOperation -> IO CString) -> IO CString
forall a b. (a -> b) -> a -> b
$ \Ptr PrintOperation
argPtr1 ->Ptr PrintOperation -> IO CString
gtk_print_operation_get_status_string Ptr PrintOperation
argPtr1)
{-# LINE 481 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
    (toPrintOperation self)
  IO CString -> (CString -> IO string) -> IO string
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= CString -> IO string
forall s. GlibString s => CString -> IO s
peekUTFString

-- | 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.
--
printOperationIsFinished :: PrintOperationClass self => self
 -> IO Bool -- ^ returns @True@, if the print operation is finished.
printOperationIsFinished :: forall self. PrintOperationClass self => self -> IO Bool
printOperationIsFinished self
self =
  (CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
  (\(PrintOperation ForeignPtr PrintOperation
arg1) -> ForeignPtr PrintOperation
-> (Ptr PrintOperation -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintOperation
arg1 ((Ptr PrintOperation -> IO CInt) -> IO CInt)
-> (Ptr PrintOperation -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr PrintOperation
argPtr1 ->Ptr PrintOperation -> IO CInt
gtk_print_operation_is_finished Ptr PrintOperation
argPtr1)
{-# LINE 497 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
    (toPrintOperation self)

-- | 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.
printRunPageSetupDialog :: (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'
printRunPageSetupDialog :: forall window pageSetup setting.
(WindowClass window, PageSetupClass pageSetup,
 PrintSettingsClass setting) =>
window -> pageSetup -> setting -> IO PageSetup
printRunPageSetupDialog window
window pageSetup
pageSetup setting
setting =
  (ForeignPtr PageSetup -> PageSetup, FinalizerPtr PageSetup)
-> IO (Ptr PageSetup) -> IO PageSetup
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
wrapNewGObject (ForeignPtr PageSetup -> PageSetup, FinalizerPtr PageSetup)
forall {a}. (ForeignPtr PageSetup -> PageSetup, FinalizerPtr a)
mkPageSetup (IO (Ptr PageSetup) -> IO PageSetup)
-> IO (Ptr PageSetup) -> IO PageSetup
forall a b. (a -> b) -> a -> b
$
  (\(Window ForeignPtr Window
arg1) (PageSetup ForeignPtr PageSetup
arg2) (PrintSettings ForeignPtr PrintSettings
arg3) -> ForeignPtr Window
-> (Ptr Window -> IO (Ptr PageSetup)) -> IO (Ptr PageSetup)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Window
arg1 ((Ptr Window -> IO (Ptr PageSetup)) -> IO (Ptr PageSetup))
-> (Ptr Window -> IO (Ptr PageSetup)) -> IO (Ptr PageSetup)
forall a b. (a -> b) -> a -> b
$ \Ptr Window
argPtr1 ->ForeignPtr PageSetup
-> (Ptr PageSetup -> IO (Ptr PageSetup)) -> IO (Ptr PageSetup)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PageSetup
arg2 ((Ptr PageSetup -> IO (Ptr PageSetup)) -> IO (Ptr PageSetup))
-> (Ptr PageSetup -> IO (Ptr PageSetup)) -> IO (Ptr PageSetup)
forall a b. (a -> b) -> a -> b
$ \Ptr PageSetup
argPtr2 ->ForeignPtr PrintSettings
-> (Ptr PrintSettings -> IO (Ptr PageSetup)) -> IO (Ptr PageSetup)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintSettings
arg3 ((Ptr PrintSettings -> IO (Ptr PageSetup)) -> IO (Ptr PageSetup))
-> (Ptr PrintSettings -> IO (Ptr PageSetup)) -> IO (Ptr PageSetup)
forall a b. (a -> b) -> a -> b
$ \Ptr PrintSettings
argPtr3 ->Ptr Window
-> Ptr PageSetup -> Ptr PrintSettings -> IO (Ptr PageSetup)
gtk_print_run_page_setup_dialog Ptr Window
argPtr1 Ptr PageSetup
argPtr2 Ptr PrintSettings
argPtr3)
{-# LINE 513 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
     (toWindow window)
     (pageSetup -> PageSetup
forall o. PageSetupClass o => o -> PageSetup
toPageSetup pageSetup
pageSetup)
     (setting -> PrintSettings
forall o. PrintSettingsClass o => o -> PrintSettings
toPrintSettings setting
setting)

type PageSetupDoneFunc = FunPtr (((Ptr PageSetup) -> ((Ptr ()) -> (IO ()))))
{-# LINE 518 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}

foreign import ccall "wrapper" mkGtkPageSetupDoneFunc ::
  (Ptr PageSetup -> Ptr () -> IO ())
  -> IO PageSetupDoneFunc

-- | 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.
printRunPageSetupDialogAsync :: (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 ()
printRunPageSetupDialogAsync :: forall window pageSetup setting.
(WindowClass window, PageSetupClass pageSetup,
 PrintSettingsClass setting) =>
window -> pageSetup -> setting -> (PageSetup -> IO ()) -> IO ()
printRunPageSetupDialogAsync window
window pageSetup
pageSetup setting
setting PageSetup -> IO ()
doneCb = do
  PageSetupDoneFunc
funcPtr <- (Ptr PageSetup -> Ptr () -> IO ()) -> IO PageSetupDoneFunc
mkGtkPageSetupDoneFunc ((Ptr PageSetup -> Ptr () -> IO ()) -> IO PageSetupDoneFunc)
-> (Ptr PageSetup -> Ptr () -> IO ()) -> IO PageSetupDoneFunc
forall a b. (a -> b) -> a -> b
$ \Ptr PageSetup
setupPtr Ptr ()
_ -> do
              PageSetup
setup <- (ForeignPtr PageSetup -> PageSetup, FinalizerPtr PageSetup)
-> IO (Ptr PageSetup) -> IO PageSetup
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewGObject (ForeignPtr PageSetup -> PageSetup, FinalizerPtr PageSetup)
forall {a}. (ForeignPtr PageSetup -> PageSetup, FinalizerPtr a)
mkPageSetup (Ptr PageSetup -> IO (Ptr PageSetup)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr PageSetup
setupPtr)
              PageSetup -> IO ()
doneCb PageSetup
setup
  (\(Window ForeignPtr Window
arg1) (PageSetup ForeignPtr PageSetup
arg2) (PrintSettings ForeignPtr PrintSettings
arg3) PageSetupDoneFunc
arg4 Ptr ()
arg5 -> ForeignPtr Window -> (Ptr Window -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Window
arg1 ((Ptr Window -> IO ()) -> IO ()) -> (Ptr Window -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Window
argPtr1 ->ForeignPtr PageSetup -> (Ptr PageSetup -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PageSetup
arg2 ((Ptr PageSetup -> IO ()) -> IO ())
-> (Ptr PageSetup -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr PageSetup
argPtr2 ->ForeignPtr PrintSettings -> (Ptr PrintSettings -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintSettings
arg3 ((Ptr PrintSettings -> IO ()) -> IO ())
-> (Ptr PrintSettings -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr PrintSettings
argPtr3 ->Ptr Window
-> Ptr PageSetup
-> Ptr PrintSettings
-> PageSetupDoneFunc
-> Ptr ()
-> IO ()
gtk_print_run_page_setup_dialog_async Ptr Window
argPtr1 Ptr PageSetup
argPtr2 Ptr PrintSettings
argPtr3 PageSetupDoneFunc
arg4 Ptr ()
arg5)
{-# LINE 539 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
     (toWindow window)
     (pageSetup -> PageSetup
forall o. PageSetupClass o => o -> PageSetup
toPageSetup pageSetup
pageSetup)
     (setting -> PrintSettings
forall o. PrintSettingsClass o => o -> PrintSettings
toPrintSettings setting
setting)
     PageSetupDoneFunc
funcPtr
     Ptr ()
forall a. Ptr a
nullPtr

-- | Ends a preview.
--
-- This function must be called to finish a custom print preview.
printOperationPreviewEndPreview :: PrintOperationPreviewClass self
                                  => self
                                  -> IO ()
printOperationPreviewEndPreview :: forall self. PrintOperationPreviewClass self => self -> IO ()
printOperationPreviewEndPreview self
self =
  (\(PrintOperationPreview ForeignPtr PrintOperationPreview
arg1) -> ForeignPtr PrintOperationPreview
-> (Ptr PrintOperationPreview -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintOperationPreview
arg1 ((Ptr PrintOperationPreview -> IO ()) -> IO ())
-> (Ptr PrintOperationPreview -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr PrintOperationPreview
argPtr1 ->Ptr PrintOperationPreview -> IO ()
gtk_print_operation_preview_end_preview Ptr PrintOperationPreview
argPtr1)
{-# LINE 553 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
    (toPrintOperationPreview self)

-- | Returns whether the given page is included in the set of pages that have been selected for printing.
printOperationPreviewIsSelected :: PrintOperationPreviewClass self
                                  => self -- ^ @preview@ a 'PrintOperationPreview'
                                  -> Int -- ^ @pageNr@ a page number
                                  -> IO Bool -- ^ returns 'True' if the page has been selected for printing
printOperationPreviewIsSelected :: forall self.
PrintOperationPreviewClass self =>
self -> Int -> IO Bool
printOperationPreviewIsSelected self
self Int
pageNr =
  (CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
  (\(PrintOperationPreview ForeignPtr PrintOperationPreview
arg1) CInt
arg2 -> ForeignPtr PrintOperationPreview
-> (Ptr PrintOperationPreview -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintOperationPreview
arg1 ((Ptr PrintOperationPreview -> IO CInt) -> IO CInt)
-> (Ptr PrintOperationPreview -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr PrintOperationPreview
argPtr1 ->Ptr PrintOperationPreview -> CInt -> IO CInt
gtk_print_operation_preview_is_selected Ptr PrintOperationPreview
argPtr1 CInt
arg2)
{-# LINE 563 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
    (toPrintOperationPreview self)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pageNr)

-- | 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.
printOperationPreviewRenderPage :: PrintOperationPreviewClass self
                                  => self -- ^ @preview@ a 'PrintOperationPreview'
                                  -> Int -- ^ @pageNr@ the page to render
                                  -> IO ()
printOperationPreviewRenderPage :: forall self.
PrintOperationPreviewClass self =>
self -> Int -> IO ()
printOperationPreviewRenderPage self
self Int
pageNr =
  (\(PrintOperationPreview ForeignPtr PrintOperationPreview
arg1) CInt
arg2 -> ForeignPtr PrintOperationPreview
-> (Ptr PrintOperationPreview -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr PrintOperationPreview
arg1 ((Ptr PrintOperationPreview -> IO ()) -> IO ())
-> (Ptr PrintOperationPreview -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr PrintOperationPreview
argPtr1 ->Ptr PrintOperationPreview -> CInt -> IO ()
gtk_print_operation_preview_render_page Ptr PrintOperationPreview
argPtr1 CInt
arg2)
{-# LINE 579 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}
    (toPrintOperationPreview self)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pageNr)

--------------------
-- Attributes

-- | 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
printOperationDefaultPageSetup :: (PrintOperationClass self, PageSetupClass pageSetup) => ReadWriteAttr self PageSetup pageSetup
printOperationDefaultPageSetup :: forall self pageSetup.
(PrintOperationClass self, PageSetupClass pageSetup) =>
ReadWriteAttr self PageSetup pageSetup
printOperationDefaultPageSetup = String -> GType -> ReadWriteAttr self PageSetup pageSetup
forall gobj gobj' gobj''.
(GObjectClass gobj, GObjectClass gobj', GObjectClass gobj'') =>
String -> GType -> ReadWriteAttr gobj gobj' gobj''
newAttrFromObjectProperty String
"default-page-setup"
                                   GType
gtk_page_setup_get_type
{-# LINE 594 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}

-- | 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
printOperationPrintSettings :: (PrintOperationClass self, PrintSettingsClass printSettings) => ReadWriteAttr self PrintSettings printSettings
printOperationPrintSettings :: forall self printSettings.
(PrintOperationClass self, PrintSettingsClass printSettings) =>
ReadWriteAttr self PrintSettings printSettings
printOperationPrintSettings = String -> GType -> ReadWriteAttr self PrintSettings printSettings
forall gobj gobj' gobj''.
(GObjectClass gobj, GObjectClass gobj', GObjectClass gobj'') =>
String -> GType -> ReadWriteAttr gobj gobj' gobj''
newAttrFromObjectProperty String
"print-settings"
                                GType
gtk_print_settings_get_type
{-# LINE 604 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}

-- | 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
printOperationJobName :: (PrintOperationClass self, GlibString string) => Attr self string
printOperationJobName :: forall self string.
(PrintOperationClass self, GlibString string) =>
Attr self string
printOperationJobName = String -> Attr self string
forall gobj string.
(GObjectClass gobj, GlibString string) =>
String -> Attr gobj string
newAttrFromStringProperty String
"job-name"

-- | 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 hander.
--
-- 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
printOperationNPages :: PrintOperationClass self => Attr self Int
printOperationNPages :: forall self. PrintOperationClass self => Attr self Int
printOperationNPages = String -> Attr self Int
forall gobj. GObjectClass gobj => String -> Attr gobj Int
newAttrFromIntProperty String
"n-pages"

-- | 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
printOperationCurrentPage :: PrintOperationClass self => Attr self Int
printOperationCurrentPage :: forall self. PrintOperationClass self => Attr self Int
printOperationCurrentPage = String -> Attr self Int
forall gobj. GObjectClass gobj => String -> Attr gobj Int
newAttrFromIntProperty String
"current-page"

-- | 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
printOperationUseFullPage :: PrintOperationClass self => Attr self Bool
printOperationUseFullPage :: forall self. PrintOperationClass self => Attr self Bool
printOperationUseFullPage = String -> Attr self Bool
forall gobj. GObjectClass gobj => String -> Attr gobj Bool
newAttrFromBoolProperty String
"use-full-page"

-- | 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
printOperationTrackPrintStatus :: PrintOperationClass self => Attr self Bool
printOperationTrackPrintStatus :: forall self. PrintOperationClass self => Attr self Bool
printOperationTrackPrintStatus = String -> Attr self Bool
forall gobj. GObjectClass gobj => String -> Attr gobj Bool
newAttrFromBoolProperty String
"track-print-status"

-- | 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
--
printOperationUnit :: PrintOperationClass self => Attr self Unit
printOperationUnit :: forall self. PrintOperationClass self => Attr self Unit
printOperationUnit = String -> GType -> Attr self Unit
forall gobj enum.
(GObjectClass gobj, Enum enum) =>
String -> GType -> Attr gobj enum
newAttrFromEnumProperty String
"unit"
                       GType
gtk_unit_get_type
{-# LINE 679 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}

-- | Determines whether to show a progress dialog during the print operation.
--
-- Default value: 'False'
--
-- Since 2.10
printOperationShowProgress :: PrintOperationClass self => Attr self Bool
printOperationShowProgress :: forall self. PrintOperationClass self => Attr self Bool
printOperationShowProgress = String -> Attr self Bool
forall gobj. GObjectClass gobj => String -> Attr gobj Bool
newAttrFromBoolProperty String
"show-progress"

-- | 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
printOperationAllowAsync :: PrintOperationClass self => Attr self Bool
printOperationAllowAsync :: forall self. PrintOperationClass self => Attr self Bool
printOperationAllowAsync = String -> Attr self Bool
forall gobj. GObjectClass gobj => String -> Attr gobj Bool
newAttrFromBoolProperty String
"allow-async"

-- | 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
printOperationExportFilename :: (PrintOperationClass self, GlibString string) => Attr self string
printOperationExportFilename :: forall self string.
(PrintOperationClass self, GlibString string) =>
Attr self string
printOperationExportFilename = String -> Attr self string
forall gobj string.
(GObjectClass gobj, GlibString string) =>
String -> Attr gobj string
newAttrFromStringProperty String
"export-filename"

-- | The status of the print operation.
--
-- Default value: ''PrintStatusInitial''
--
-- Since 2.10
printOperationStatus :: PrintOperationClass self => ReadAttr self PrintStatus
printOperationStatus :: forall self. PrintOperationClass self => ReadAttr self PrintStatus
printOperationStatus = String -> GType -> ReadAttr self PrintStatus
forall gobj enum.
(GObjectClass gobj, Enum enum) =>
String -> GType -> ReadAttr gobj enum
readAttrFromEnumProperty String
"status"
                         GType
gtk_print_status_get_type
{-# LINE 726 "./Graphics/UI/Gtk/Printing/PrintOperation.chs" #-}

-- | 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
printOperationStatusString :: (PrintOperationClass self, GlibString string) => ReadAttr self string
printOperationStatusString :: forall self string.
(PrintOperationClass self, GlibString string) =>
ReadAttr self string
printOperationStatusString = String -> ReadAttr self string
forall gobj string.
(GObjectClass gobj, GlibString string) =>
String -> ReadAttr gobj string
readAttrFromStringProperty String
"status-string"

-- | 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
printOperationCustomTabLabel :: (PrintOperationClass self, GlibString string) => Attr self string
printOperationCustomTabLabel :: forall self string.
(PrintOperationClass self, GlibString string) =>
Attr self string
printOperationCustomTabLabel = String -> Attr self string
forall gobj string.
(GObjectClass gobj, GlibString string) =>
String -> Attr gobj string
newAttrFromStringProperty String
"custom-tab-label"


-- | 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
printOperationSupportSelection :: PrintOperationClass self => Attr self Bool
printOperationSupportSelection :: forall self. PrintOperationClass self => Attr self Bool
printOperationSupportSelection = String -> Attr self Bool
forall gobj. GObjectClass gobj => String -> Attr gobj Bool
newAttrFromBoolProperty String
"support-selection"

-- | 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
printOperationHasSelection :: PrintOperationClass self => Attr self Bool
printOperationHasSelection :: forall self. PrintOperationClass self => Attr self Bool
printOperationHasSelection = String -> Attr self Bool
forall gobj. GObjectClass gobj => String -> Attr gobj Bool
newAttrFromBoolProperty String
"has-selection"

-- | If 'True', page size combo box and orientation combo box are embedded into page setup page.
--
-- Default value: 'False'
--
-- Since 2.18
printOperationEmbedPageSetup :: PrintOperationClass self => Attr self Bool
printOperationEmbedPageSetup :: forall self. PrintOperationClass self => Attr self Bool
printOperationEmbedPageSetup = String -> Attr self Bool
forall gobj. GObjectClass gobj => String -> Attr gobj Bool
newAttrFromBoolProperty String
"embed-page-setup"

-- | 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
printOperationNPagesToPrint :: PrintOperationClass self => ReadAttr self Int
printOperationNPagesToPrint :: forall self. PrintOperationClass self => ReadAttr self Int
printOperationNPagesToPrint = String -> ReadAttr self Int
forall gobj. GObjectClass gobj => String -> ReadAttr gobj Int
readAttrFromIntProperty String
"n-pages-to-print"


--------------------
-- Signals

-- | 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.
--
printOptDone :: PrintOperationClass self => Signal self (PrintOperationResult -> IO ())
printOptDone :: forall self.
PrintOperationClass self =>
Signal self (PrintOperationResult -> IO ())
printOptDone = (Bool
 -> self -> (PrintOperationResult -> IO ()) -> IO (ConnectId self))
-> Signal self (PrintOperationResult -> IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (String
-> Bool
-> self
-> (PrintOperationResult -> IO ())
-> IO (ConnectId self)
forall a obj.
(Enum a, GObjectClass obj) =>
String -> Bool -> obj -> (a -> IO ()) -> IO (ConnectId obj)
connect_ENUM__NONE String
"done")

-- | 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'.
--
printOptBeginPrint :: PrintOperationClass self => Signal self (PrintContext -> IO ())
printOptBeginPrint :: forall self.
PrintOperationClass self =>
Signal self (PrintContext -> IO ())
printOptBeginPrint = (Bool -> self -> (PrintContext -> IO ()) -> IO (ConnectId self))
-> Signal self (PrintContext -> IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (String
-> Bool -> self -> (PrintContext -> IO ()) -> IO (ConnectId self)
forall a' obj.
(GObjectClass a', GObjectClass obj) =>
String -> Bool -> obj -> (a' -> IO ()) -> IO (ConnectId obj)
connect_OBJECT__NONE String
"begin_print")

-- | 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.
--
printOptPaginate :: PrintOperationClass self => Signal self (PrintContext -> IO Bool)
printOptPaginate :: forall self.
PrintOperationClass self =>
Signal self (PrintContext -> IO Bool)
printOptPaginate = (Bool -> self -> (PrintContext -> IO Bool) -> IO (ConnectId self))
-> Signal self (PrintContext -> IO Bool)
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (String
-> Bool -> self -> (PrintContext -> IO Bool) -> IO (ConnectId self)
forall a' obj.
(GObjectClass a', GObjectClass obj) =>
String -> Bool -> obj -> (a' -> IO Bool) -> IO (ConnectId obj)
connect_OBJECT__BOOL String
"paginate")

-- | 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.
--
printOptRequestPageSetup :: PrintOperationClass self => Signal self (PrintContext -> Int -> PageSetup -> IO ())
printOptRequestPageSetup :: forall self.
PrintOperationClass self =>
Signal self (PrintContext -> Int -> PageSetup -> IO ())
printOptRequestPageSetup = (Bool
 -> self
 -> (PrintContext -> Int -> PageSetup -> IO ())
 -> IO (ConnectId self))
-> Signal self (PrintContext -> Int -> PageSetup -> IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (String
-> Bool
-> self
-> (PrintContext -> Int -> PageSetup -> IO ())
-> IO (ConnectId self)
forall a' c' obj.
(GObjectClass a', GObjectClass c', GObjectClass obj) =>
String
-> Bool -> obj -> (a' -> Int -> c' -> IO ()) -> IO (ConnectId obj)
connect_OBJECT_INT_OBJECT__NONE String
"request_page_setup")

-- | 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.
--
printOptDrawPage :: PrintOperationClass self => Signal self (PrintContext -> Int -> IO ())
printOptDrawPage :: forall self.
PrintOperationClass self =>
Signal self (PrintContext -> Int -> IO ())
printOptDrawPage = (Bool
 -> self -> (PrintContext -> Int -> IO ()) -> IO (ConnectId self))
-> Signal self (PrintContext -> Int -> IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (String
-> Bool
-> self
-> (PrintContext -> Int -> IO ())
-> IO (ConnectId self)
forall a' obj.
(GObjectClass a', GObjectClass obj) =>
String -> Bool -> obj -> (a' -> Int -> IO ()) -> IO (ConnectId obj)
connect_OBJECT_INT__NONE String
"draw_page")

-- | 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.
--
printOptEndPrint :: PrintOperationClass self => Signal self (PrintContext -> IO ())
printOptEndPrint :: forall self.
PrintOperationClass self =>
Signal self (PrintContext -> IO ())
printOptEndPrint = (Bool -> self -> (PrintContext -> IO ()) -> IO (ConnectId self))
-> Signal self (PrintContext -> IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (String
-> Bool -> self -> (PrintContext -> IO ()) -> IO (ConnectId self)
forall a' obj.
(GObjectClass a', GObjectClass obj) =>
String -> Bool -> obj -> (a' -> IO ()) -> IO (ConnectId obj)
connect_OBJECT__NONE String
"end_print")

-- | 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.
--
printOptStatusChanged :: PrintOperationClass self => Signal self (IO ())
printOptStatusChanged :: forall self. PrintOperationClass self => Signal self (IO ())
printOptStatusChanged = (Bool -> self -> IO () -> IO (ConnectId self))
-> Signal self (IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (String -> Bool -> self -> IO () -> IO (ConnectId self)
forall obj.
GObjectClass obj =>
String -> Bool -> obj -> IO () -> IO (ConnectId obj)
connect_NONE__NONE String
"status_changed")

-- | 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.
--
printOptCreateCustomWidget :: PrintOperationClass self => Signal self (IO Widget)
printOptCreateCustomWidget :: forall self. PrintOperationClass self => Signal self (IO Widget)
printOptCreateCustomWidget = (Bool -> self -> IO Widget -> IO (ConnectId self))
-> Signal self (IO Widget)
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (String -> Bool -> self -> IO Widget -> IO (ConnectId self)
forall obj.
GObjectClass obj =>
String -> Bool -> obj -> IO Widget -> IO (ConnectId obj)
connect_NONE__OBJECTPTR String
"create_custom_widget")

-- | Signal helper functions.
connect_NONE__OBJECTPTR ::
    GObjectClass obj => SignalName ->
    ConnectAfter -> obj ->
    (IO Widget) ->
    IO (ConnectId obj)
connect_NONE__OBJECTPTR :: forall obj.
GObjectClass obj =>
String -> Bool -> obj -> IO Widget -> IO (ConnectId obj)
connect_NONE__OBJECTPTR String
signal Bool
after obj
obj IO Widget
user =
    String
-> Bool
-> obj
-> (Ptr GObject -> IO (Ptr Widget))
-> IO (ConnectId obj)
forall obj handler.
GObjectClass obj =>
String -> Bool -> obj -> handler -> IO (ConnectId obj)
connectGeneric String
signal Bool
after obj
obj Ptr GObject -> IO (Ptr Widget)
action
        where action :: Ptr GObject -> IO (Ptr Widget)
              action :: Ptr GObject -> IO (Ptr Widget)
action Ptr GObject
_ =
                  IO (Ptr Widget) -> IO (Ptr Widget)
forall a. IO a -> IO a
failOnGError (IO (Ptr Widget) -> IO (Ptr Widget))
-> IO (Ptr Widget) -> IO (Ptr Widget)
forall a b. (a -> b) -> a -> b
$ do
                    Widget
x <- IO Widget
user
                    Ptr Widget -> IO (Ptr Widget)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Widget -> IO (Ptr Widget)) -> Ptr Widget -> IO (Ptr Widget)
forall a b. (a -> b) -> a -> b
$ ForeignPtr Widget -> Ptr Widget
forall a. ForeignPtr a -> Ptr a
unsafeForeignPtrToPtr (Widget -> ForeignPtr Widget
unWidget (Widget -> Widget
forall o. WidgetClass o => o -> Widget
toWidget Widget
x))


-- | 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
--
printOptUpdateCustomWidget :: PrintOperationClass self => Signal self (Widget -> PageSetup -> PrintSettings -> IO ())
printOptUpdateCustomWidget :: forall self.
PrintOperationClass self =>
Signal self (Widget -> PageSetup -> PrintSettings -> IO ())
printOptUpdateCustomWidget = (Bool
 -> self
 -> (Widget -> PageSetup -> PrintSettings -> IO ())
 -> IO (ConnectId self))
-> Signal self (Widget -> PageSetup -> PrintSettings -> IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (String
-> Bool
-> self
-> (Widget -> PageSetup -> PrintSettings -> IO ())
-> IO (ConnectId self)
forall a' b' c' obj.
(GObjectClass a', GObjectClass b', GObjectClass c',
 GObjectClass obj) =>
String
-> Bool -> obj -> (a' -> b' -> c' -> IO ()) -> IO (ConnectId obj)
connect_OBJECT_OBJECT_OBJECT__NONE String
"update_custom_widget")


-- | 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.
--
printOptCustomWidgetApply :: PrintOperationClass self => Signal self (Widget -> IO ())
printOptCustomWidgetApply :: forall self.
PrintOperationClass self =>
Signal self (Widget -> IO ())
printOptCustomWidgetApply = (Bool -> self -> (Widget -> IO ()) -> IO (ConnectId self))
-> Signal self (Widget -> IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (String -> Bool -> self -> (Widget -> IO ()) -> IO (ConnectId self)
forall a' obj.
(GObjectClass a', GObjectClass obj) =>
String -> Bool -> obj -> (a' -> IO ()) -> IO (ConnectId obj)
connect_OBJECT__NONE String
"custom_widget_apply")

-- | 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).
--
printOptPreview :: PrintOperationClass self => Signal self (PrintOperationPreview -> PrintContext -> Window -> IO Bool)
printOptPreview :: forall self.
PrintOperationClass self =>
Signal
  self (PrintOperationPreview -> PrintContext -> Window -> IO Bool)
printOptPreview = (Bool
 -> self
 -> (PrintOperationPreview -> PrintContext -> Window -> IO Bool)
 -> IO (ConnectId self))
-> Signal
     self (PrintOperationPreview -> PrintContext -> Window -> IO Bool)
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (String
-> Bool
-> self
-> (PrintOperationPreview -> PrintContext -> Window -> IO Bool)
-> IO (ConnectId self)
forall a' b' c' obj.
(GObjectClass a', GObjectClass b', GObjectClass c',
 GObjectClass obj) =>
String
-> Bool -> obj -> (a' -> b' -> c' -> IO Bool) -> IO (ConnectId obj)
connect_OBJECT_OBJECT_OBJECT__BOOL String
"preview")

-- | 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.
printOptReady :: PrintOperationPreviewClass self => Signal self (PrintContext -> IO ())
printOptReady :: forall self.
PrintOperationPreviewClass self =>
Signal self (PrintContext -> IO ())
printOptReady = (Bool -> self -> (PrintContext -> IO ()) -> IO (ConnectId self))
-> Signal self (PrintContext -> IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (String
-> Bool -> self -> (PrintContext -> IO ()) -> IO (ConnectId self)
forall a' obj.
(GObjectClass a', GObjectClass obj) =>
String -> Bool -> obj -> (a' -> IO ()) -> IO (ConnectId obj)
connect_OBJECT__NONE String
"ready")

-- | 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'.
printOptGotPageSize :: PrintOperationPreviewClass self => Signal self (PrintContext -> PageSetup -> IO ())
printOptGotPageSize :: forall self.
PrintOperationPreviewClass self =>
Signal self (PrintContext -> PageSetup -> IO ())
printOptGotPageSize = (Bool
 -> self
 -> (PrintContext -> PageSetup -> IO ())
 -> IO (ConnectId self))
-> Signal self (PrintContext -> PageSetup -> IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (String
-> Bool
-> self
-> (PrintContext -> PageSetup -> IO ())
-> IO (ConnectId self)
forall a' b' obj.
(GObjectClass a', GObjectClass b', GObjectClass obj) =>
String -> Bool -> obj -> (a' -> b' -> IO ()) -> IO (ConnectId obj)
connect_OBJECT_OBJECT__NONE String
"got_page_size")

foreign import ccall safe "gtk_print_operation_new"
  gtk_print_operation_new :: (IO (Ptr PrintOperation))

foreign import ccall safe "gtk_print_operation_set_allow_async"
  gtk_print_operation_set_allow_async :: ((Ptr PrintOperation) -> (CInt -> (IO ())))

foreign import ccall safe "gtk_print_operation_get_error"
  gtk_print_operation_get_error :: ((Ptr PrintOperation) -> ((Ptr (Ptr ())) -> (IO ())))

foreign import ccall safe "gtk_print_operation_set_job_name"
  gtk_print_operation_set_job_name :: ((Ptr PrintOperation) -> ((Ptr CChar) -> (IO ())))

foreign import ccall safe "gtk_print_operation_set_n_pages"
  gtk_print_operation_set_n_pages :: ((Ptr PrintOperation) -> (CInt -> (IO ())))

foreign import ccall safe "gtk_print_operation_get_n_pages_to_print"
  gtk_print_operation_get_n_pages_to_print :: ((Ptr PrintOperation) -> (IO CInt))

foreign import ccall safe "gtk_print_operation_set_current_page"
  gtk_print_operation_set_current_page :: ((Ptr PrintOperation) -> (CInt -> (IO ())))

foreign import ccall safe "gtk_print_operation_set_use_full_page"
  gtk_print_operation_set_use_full_page :: ((Ptr PrintOperation) -> (CInt -> (IO ())))

foreign import ccall safe "gtk_print_operation_set_unit"
  gtk_print_operation_set_unit :: ((Ptr PrintOperation) -> (CInt -> (IO ())))

foreign import ccall safe "gtk_print_operation_set_export_filename"
  gtk_print_operation_set_export_filename :: ((Ptr PrintOperation) -> ((Ptr CChar) -> (IO ())))

foreign import ccall safe "gtk_print_operation_set_show_progress"
  gtk_print_operation_set_show_progress :: ((Ptr PrintOperation) -> (CInt -> (IO ())))

foreign import ccall safe "gtk_print_operation_set_track_print_status"
  gtk_print_operation_set_track_print_status :: ((Ptr PrintOperation) -> (CInt -> (IO ())))

foreign import ccall safe "gtk_print_operation_set_custom_tab_label"
  gtk_print_operation_set_custom_tab_label :: ((Ptr PrintOperation) -> ((Ptr CChar) -> (IO ())))

foreign import ccall safe "gtk_print_operation_run"
  gtk_print_operation_run :: ((Ptr PrintOperation) -> (CInt -> ((Ptr Window) -> ((Ptr (Ptr ())) -> (IO CInt)))))

foreign import ccall safe "gtk_print_operation_cancel"
  gtk_print_operation_cancel :: ((Ptr PrintOperation) -> (IO ()))

foreign import ccall safe "gtk_print_operation_draw_page_finish"
  gtk_print_operation_draw_page_finish :: ((Ptr PrintOperation) -> (IO ()))

foreign import ccall safe "gtk_print_operation_set_defer_drawing"
  gtk_print_operation_set_defer_drawing :: ((Ptr PrintOperation) -> (IO ()))

foreign import ccall safe "gtk_print_operation_get_status"
  gtk_print_operation_get_status :: ((Ptr PrintOperation) -> (IO CInt))

foreign import ccall safe "gtk_print_operation_get_status_string"
  gtk_print_operation_get_status_string :: ((Ptr PrintOperation) -> (IO (Ptr CChar)))

foreign import ccall safe "gtk_print_operation_is_finished"
  gtk_print_operation_is_finished :: ((Ptr PrintOperation) -> (IO CInt))

foreign import ccall safe "gtk_print_run_page_setup_dialog"
  gtk_print_run_page_setup_dialog :: ((Ptr Window) -> ((Ptr PageSetup) -> ((Ptr PrintSettings) -> (IO (Ptr PageSetup)))))

foreign import ccall safe "gtk_print_run_page_setup_dialog_async"
  gtk_print_run_page_setup_dialog_async :: ((Ptr Window) -> ((Ptr PageSetup) -> ((Ptr PrintSettings) -> ((FunPtr ((Ptr PageSetup) -> ((Ptr ()) -> (IO ())))) -> ((Ptr ()) -> (IO ()))))))

foreign import ccall safe "gtk_print_operation_preview_end_preview"
  gtk_print_operation_preview_end_preview :: ((Ptr PrintOperationPreview) -> (IO ()))

foreign import ccall safe "gtk_print_operation_preview_is_selected"
  gtk_print_operation_preview_is_selected :: ((Ptr PrintOperationPreview) -> (CInt -> (IO CInt)))

foreign import ccall safe "gtk_print_operation_preview_render_page"
  gtk_print_operation_preview_render_page :: ((Ptr PrintOperationPreview) -> (CInt -> (IO ())))

foreign import ccall unsafe "gtk_page_setup_get_type"
  gtk_page_setup_get_type :: CUInt

foreign import ccall unsafe "gtk_print_settings_get_type"
  gtk_print_settings_get_type :: CUInt

foreign import ccall unsafe "gtk_unit_get_type"
  gtk_unit_get_type :: CUInt

foreign import ccall unsafe "gtk_print_status_get_type"
  gtk_print_status_get_type :: CUInt