{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}

module GI.WebKit2.Objects.PrintOperation
    ( 

-- * Exported types
    PrintOperation(..)                      ,
    IsPrintOperation                        ,
    toPrintOperation                        ,
    noPrintOperation                        ,


 -- * Methods
-- ** getPageSetup #method:getPageSetup#
    PrintOperationGetPageSetupMethodInfo    ,
    printOperationGetPageSetup              ,


-- ** getPrintSettings #method:getPrintSettings#
    PrintOperationGetPrintSettingsMethodInfo,
    printOperationGetPrintSettings          ,


-- ** new #method:new#
    printOperationNew                       ,


-- ** print #method:print#
    PrintOperationPrintMethodInfo           ,
    printOperationPrint                     ,


-- ** runDialog #method:runDialog#
    PrintOperationRunDialogMethodInfo       ,
    printOperationRunDialog                 ,


-- ** setPageSetup #method:setPageSetup#
    PrintOperationSetPageSetupMethodInfo    ,
    printOperationSetPageSetup              ,


-- ** setPrintSettings #method:setPrintSettings#
    PrintOperationSetPrintSettingsMethodInfo,
    printOperationSetPrintSettings          ,




 -- * Properties
-- ** pageSetup #attr:pageSetup#
    PrintOperationPageSetupPropertyInfo     ,
    constructPrintOperationPageSetup        ,
    getPrintOperationPageSetup              ,
    printOperationPageSetup                 ,
    setPrintOperationPageSetup              ,


-- ** printSettings #attr:printSettings#
    PrintOperationPrintSettingsPropertyInfo ,
    constructPrintOperationPrintSettings    ,
    getPrintOperationPrintSettings          ,
    printOperationPrintSettings             ,
    setPrintOperationPrintSettings          ,


-- ** webView #attr:webView#
    PrintOperationWebViewPropertyInfo       ,
    constructPrintOperationWebView          ,
    getPrintOperationWebView                ,
    printOperationWebView                   ,




 -- * Signals
-- ** failed #signal:failed#
    C_PrintOperationFailedCallback          ,
    PrintOperationFailedCallback            ,
    PrintOperationFailedSignalInfo          ,
    afterPrintOperationFailed               ,
    genClosure_PrintOperationFailed         ,
    mk_PrintOperationFailedCallback         ,
    noPrintOperationFailedCallback          ,
    onPrintOperationFailed                  ,
    wrap_PrintOperationFailedCallback       ,


-- ** finished #signal:finished#
    C_PrintOperationFinishedCallback        ,
    PrintOperationFinishedCallback          ,
    PrintOperationFinishedSignalInfo        ,
    afterPrintOperationFinished             ,
    genClosure_PrintOperationFinished       ,
    mk_PrintOperationFinishedCallback       ,
    noPrintOperationFinishedCallback        ,
    onPrintOperationFinished                ,
    wrap_PrintOperationFinishedCallback     ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gtk.Objects.PageSetup as Gtk.PageSetup
import qualified GI.Gtk.Objects.PrintSettings as Gtk.PrintSettings
import qualified GI.Gtk.Objects.Window as Gtk.Window
import {-# SOURCE #-} qualified GI.WebKit2.Enums as WebKit2.Enums
import {-# SOURCE #-} qualified GI.WebKit2.Objects.WebView as WebKit2.WebView

newtype PrintOperation = PrintOperation (ManagedPtr PrintOperation)
foreign import ccall "webkit_print_operation_get_type"
    c_webkit_print_operation_get_type :: IO GType

instance GObject PrintOperation where
    gobjectType _ = c_webkit_print_operation_get_type
    

class GObject o => IsPrintOperation o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError PrintOperation a) =>
    IsPrintOperation a
#endif
instance IsPrintOperation PrintOperation
instance GObject.Object.IsObject PrintOperation

toPrintOperation :: IsPrintOperation o => o -> IO PrintOperation
toPrintOperation = unsafeCastTo PrintOperation

noPrintOperation :: Maybe PrintOperation
noPrintOperation = Nothing

type family ResolvePrintOperationMethod (t :: Symbol) (o :: *) :: * where
    ResolvePrintOperationMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolvePrintOperationMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolvePrintOperationMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolvePrintOperationMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolvePrintOperationMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolvePrintOperationMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolvePrintOperationMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolvePrintOperationMethod "print" o = PrintOperationPrintMethodInfo
    ResolvePrintOperationMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolvePrintOperationMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolvePrintOperationMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolvePrintOperationMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolvePrintOperationMethod "runDialog" o = PrintOperationRunDialogMethodInfo
    ResolvePrintOperationMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolvePrintOperationMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolvePrintOperationMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolvePrintOperationMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolvePrintOperationMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolvePrintOperationMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolvePrintOperationMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolvePrintOperationMethod "getPageSetup" o = PrintOperationGetPageSetupMethodInfo
    ResolvePrintOperationMethod "getPrintSettings" o = PrintOperationGetPrintSettingsMethodInfo
    ResolvePrintOperationMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolvePrintOperationMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolvePrintOperationMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolvePrintOperationMethod "setPageSetup" o = PrintOperationSetPageSetupMethodInfo
    ResolvePrintOperationMethod "setPrintSettings" o = PrintOperationSetPrintSettingsMethodInfo
    ResolvePrintOperationMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolvePrintOperationMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolvePrintOperationMethod t PrintOperation, O.MethodInfo info PrintOperation p) => O.IsLabelProxy t (PrintOperation -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolvePrintOperationMethod t PrintOperation, O.MethodInfo info PrintOperation p) => O.IsLabel t (PrintOperation -> p) where
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

-- signal PrintOperation::failed
type PrintOperationFailedCallback =
    GError ->
    IO ()

noPrintOperationFailedCallback :: Maybe PrintOperationFailedCallback
noPrintOperationFailedCallback = Nothing

type C_PrintOperationFailedCallback =
    Ptr () ->                               -- object
    Ptr GError ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_PrintOperationFailedCallback :: C_PrintOperationFailedCallback -> IO (FunPtr C_PrintOperationFailedCallback)

genClosure_PrintOperationFailed :: PrintOperationFailedCallback -> IO Closure
genClosure_PrintOperationFailed cb = do
    let cb' = wrap_PrintOperationFailedCallback cb
    mk_PrintOperationFailedCallback cb' >>= newCClosure


wrap_PrintOperationFailedCallback ::
    PrintOperationFailedCallback ->
    Ptr () ->
    Ptr GError ->
    Ptr () ->
    IO ()
wrap_PrintOperationFailedCallback _cb _ error_ _ = do
    error_' <- (newBoxed GError) error_
    _cb  error_'


onPrintOperationFailed :: (GObject a, MonadIO m) => a -> PrintOperationFailedCallback -> m SignalHandlerId
onPrintOperationFailed obj cb = liftIO $ connectPrintOperationFailed obj cb SignalConnectBefore
afterPrintOperationFailed :: (GObject a, MonadIO m) => a -> PrintOperationFailedCallback -> m SignalHandlerId
afterPrintOperationFailed obj cb = connectPrintOperationFailed obj cb SignalConnectAfter

connectPrintOperationFailed :: (GObject a, MonadIO m) =>
                               a -> PrintOperationFailedCallback -> SignalConnectMode -> m SignalHandlerId
connectPrintOperationFailed obj cb after = liftIO $ do
    let cb' = wrap_PrintOperationFailedCallback cb
    cb'' <- mk_PrintOperationFailedCallback cb'
    connectSignalFunPtr obj "failed" cb'' after

-- signal PrintOperation::finished
type PrintOperationFinishedCallback =
    IO ()

noPrintOperationFinishedCallback :: Maybe PrintOperationFinishedCallback
noPrintOperationFinishedCallback = Nothing

type C_PrintOperationFinishedCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_PrintOperationFinishedCallback :: C_PrintOperationFinishedCallback -> IO (FunPtr C_PrintOperationFinishedCallback)

genClosure_PrintOperationFinished :: PrintOperationFinishedCallback -> IO Closure
genClosure_PrintOperationFinished cb = do
    let cb' = wrap_PrintOperationFinishedCallback cb
    mk_PrintOperationFinishedCallback cb' >>= newCClosure


wrap_PrintOperationFinishedCallback ::
    PrintOperationFinishedCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_PrintOperationFinishedCallback _cb _ _ = do
    _cb 


onPrintOperationFinished :: (GObject a, MonadIO m) => a -> PrintOperationFinishedCallback -> m SignalHandlerId
onPrintOperationFinished obj cb = liftIO $ connectPrintOperationFinished obj cb SignalConnectBefore
afterPrintOperationFinished :: (GObject a, MonadIO m) => a -> PrintOperationFinishedCallback -> m SignalHandlerId
afterPrintOperationFinished obj cb = connectPrintOperationFinished obj cb SignalConnectAfter

connectPrintOperationFinished :: (GObject a, MonadIO m) =>
                                 a -> PrintOperationFinishedCallback -> SignalConnectMode -> m SignalHandlerId
connectPrintOperationFinished obj cb after = liftIO $ do
    let cb' = wrap_PrintOperationFinishedCallback cb
    cb'' <- mk_PrintOperationFinishedCallback cb'
    connectSignalFunPtr obj "finished" cb'' after

-- VVV Prop "page-setup"
   -- Type: TInterface (Name {namespace = "Gtk", name = "PageSetup"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

getPrintOperationPageSetup :: (MonadIO m, IsPrintOperation o) => o -> m Gtk.PageSetup.PageSetup
getPrintOperationPageSetup obj = liftIO $ checkUnexpectedNothing "getPrintOperationPageSetup" $ getObjectPropertyObject obj "page-setup" Gtk.PageSetup.PageSetup

setPrintOperationPageSetup :: (MonadIO m, IsPrintOperation o, Gtk.PageSetup.IsPageSetup a) => o -> a -> m ()
setPrintOperationPageSetup obj val = liftIO $ setObjectPropertyObject obj "page-setup" (Just val)

constructPrintOperationPageSetup :: (IsPrintOperation o, Gtk.PageSetup.IsPageSetup a) => a -> IO (GValueConstruct o)
constructPrintOperationPageSetup val = constructObjectPropertyObject "page-setup" (Just val)

data PrintOperationPageSetupPropertyInfo
instance AttrInfo PrintOperationPageSetupPropertyInfo where
    type AttrAllowedOps PrintOperationPageSetupPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint PrintOperationPageSetupPropertyInfo = Gtk.PageSetup.IsPageSetup
    type AttrBaseTypeConstraint PrintOperationPageSetupPropertyInfo = IsPrintOperation
    type AttrGetType PrintOperationPageSetupPropertyInfo = Gtk.PageSetup.PageSetup
    type AttrLabel PrintOperationPageSetupPropertyInfo = "page-setup"
    type AttrOrigin PrintOperationPageSetupPropertyInfo = PrintOperation
    attrGet _ = getPrintOperationPageSetup
    attrSet _ = setPrintOperationPageSetup
    attrConstruct _ = constructPrintOperationPageSetup
    attrClear _ = undefined

-- VVV Prop "print-settings"
   -- Type: TInterface (Name {namespace = "Gtk", name = "PrintSettings"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

getPrintOperationPrintSettings :: (MonadIO m, IsPrintOperation o) => o -> m Gtk.PrintSettings.PrintSettings
getPrintOperationPrintSettings obj = liftIO $ checkUnexpectedNothing "getPrintOperationPrintSettings" $ getObjectPropertyObject obj "print-settings" Gtk.PrintSettings.PrintSettings

setPrintOperationPrintSettings :: (MonadIO m, IsPrintOperation o, Gtk.PrintSettings.IsPrintSettings a) => o -> a -> m ()
setPrintOperationPrintSettings obj val = liftIO $ setObjectPropertyObject obj "print-settings" (Just val)

constructPrintOperationPrintSettings :: (IsPrintOperation o, Gtk.PrintSettings.IsPrintSettings a) => a -> IO (GValueConstruct o)
constructPrintOperationPrintSettings val = constructObjectPropertyObject "print-settings" (Just val)

data PrintOperationPrintSettingsPropertyInfo
instance AttrInfo PrintOperationPrintSettingsPropertyInfo where
    type AttrAllowedOps PrintOperationPrintSettingsPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint PrintOperationPrintSettingsPropertyInfo = Gtk.PrintSettings.IsPrintSettings
    type AttrBaseTypeConstraint PrintOperationPrintSettingsPropertyInfo = IsPrintOperation
    type AttrGetType PrintOperationPrintSettingsPropertyInfo = Gtk.PrintSettings.PrintSettings
    type AttrLabel PrintOperationPrintSettingsPropertyInfo = "print-settings"
    type AttrOrigin PrintOperationPrintSettingsPropertyInfo = PrintOperation
    attrGet _ = getPrintOperationPrintSettings
    attrSet _ = setPrintOperationPrintSettings
    attrConstruct _ = constructPrintOperationPrintSettings
    attrClear _ = undefined

-- VVV Prop "web-view"
   -- Type: TInterface (Name {namespace = "WebKit2", name = "WebView"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

getPrintOperationWebView :: (MonadIO m, IsPrintOperation o) => o -> m (Maybe WebKit2.WebView.WebView)
getPrintOperationWebView obj = liftIO $ getObjectPropertyObject obj "web-view" WebKit2.WebView.WebView

constructPrintOperationWebView :: (IsPrintOperation o, WebKit2.WebView.IsWebView a) => a -> IO (GValueConstruct o)
constructPrintOperationWebView val = constructObjectPropertyObject "web-view" (Just val)

data PrintOperationWebViewPropertyInfo
instance AttrInfo PrintOperationWebViewPropertyInfo where
    type AttrAllowedOps PrintOperationWebViewPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint PrintOperationWebViewPropertyInfo = WebKit2.WebView.IsWebView
    type AttrBaseTypeConstraint PrintOperationWebViewPropertyInfo = IsPrintOperation
    type AttrGetType PrintOperationWebViewPropertyInfo = (Maybe WebKit2.WebView.WebView)
    type AttrLabel PrintOperationWebViewPropertyInfo = "web-view"
    type AttrOrigin PrintOperationWebViewPropertyInfo = PrintOperation
    attrGet _ = getPrintOperationWebView
    attrSet _ = undefined
    attrConstruct _ = constructPrintOperationWebView
    attrClear _ = undefined

instance O.HasAttributeList PrintOperation
type instance O.AttributeList PrintOperation = PrintOperationAttributeList
type PrintOperationAttributeList = ('[ '("pageSetup", PrintOperationPageSetupPropertyInfo), '("printSettings", PrintOperationPrintSettingsPropertyInfo), '("webView", PrintOperationWebViewPropertyInfo)] :: [(Symbol, *)])

printOperationPageSetup :: AttrLabelProxy "pageSetup"
printOperationPageSetup = AttrLabelProxy

printOperationPrintSettings :: AttrLabelProxy "printSettings"
printOperationPrintSettings = AttrLabelProxy

printOperationWebView :: AttrLabelProxy "webView"
printOperationWebView = AttrLabelProxy

data PrintOperationFailedSignalInfo
instance SignalInfo PrintOperationFailedSignalInfo where
    type HaskellCallbackType PrintOperationFailedSignalInfo = PrintOperationFailedCallback
    connectSignal _ = connectPrintOperationFailed

data PrintOperationFinishedSignalInfo
instance SignalInfo PrintOperationFinishedSignalInfo where
    type HaskellCallbackType PrintOperationFinishedSignalInfo = PrintOperationFinishedCallback
    connectSignal _ = connectPrintOperationFinished

type instance O.SignalList PrintOperation = PrintOperationSignalList
type PrintOperationSignalList = ('[ '("failed", PrintOperationFailedSignalInfo), '("finished", PrintOperationFinishedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method PrintOperation::new
-- method type : Constructor
-- Args : [Arg {argCName = "web_view", argType = TInterface (Name {namespace = "WebKit2", name = "WebView"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitWebView", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "WebKit2", name = "PrintOperation"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_print_operation_new" webkit_print_operation_new :: 
    Ptr WebKit2.WebView.WebView ->          -- web_view : TInterface (Name {namespace = "WebKit2", name = "WebView"})
    IO (Ptr PrintOperation)

{- |
Create a new 'GI.WebKit2.Objects.PrintOperation.PrintOperation' to print /@webView@/ contents.
-}
printOperationNew ::
    (B.CallStack.HasCallStack, MonadIO m, WebKit2.WebView.IsWebView a) =>
    a
    {- ^ /@webView@/: a 'GI.WebKit2.Objects.WebView.WebView' -}
    -> m PrintOperation
    {- ^ __Returns:__ a new 'GI.WebKit2.Objects.PrintOperation.PrintOperation'. -}
printOperationNew webView = liftIO $ do
    webView' <- unsafeManagedPtrCastPtr webView
    result <- webkit_print_operation_new webView'
    checkUnexpectedReturnNULL "printOperationNew" result
    result' <- (wrapObject PrintOperation) result
    touchManagedPtr webView
    return result'

-- method PrintOperation::get_page_setup
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "print_operation", argType = TInterface (Name {namespace = "WebKit2", name = "PrintOperation"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitPrintOperation", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gtk", name = "PageSetup"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_print_operation_get_page_setup" webkit_print_operation_get_page_setup :: 
    Ptr PrintOperation ->                   -- print_operation : TInterface (Name {namespace = "WebKit2", name = "PrintOperation"})
    IO (Ptr Gtk.PageSetup.PageSetup)

{- |
Return the current page setup of /@printOperation@/. It returns 'Nothing' until
either 'GI.WebKit2.Objects.PrintOperation.printOperationSetPageSetup' or 'GI.WebKit2.Objects.PrintOperation.printOperationRunDialog'
have been called.
-}
printOperationGetPageSetup ::
    (B.CallStack.HasCallStack, MonadIO m, IsPrintOperation a) =>
    a
    {- ^ /@printOperation@/: a 'GI.WebKit2.Objects.PrintOperation.PrintOperation' -}
    -> m Gtk.PageSetup.PageSetup
    {- ^ __Returns:__ the current 'GI.Gtk.Objects.PageSetup.PageSetup' of /@printOperation@/. -}
printOperationGetPageSetup printOperation = liftIO $ do
    printOperation' <- unsafeManagedPtrCastPtr printOperation
    result <- webkit_print_operation_get_page_setup printOperation'
    checkUnexpectedReturnNULL "printOperationGetPageSetup" result
    result' <- (newObject Gtk.PageSetup.PageSetup) result
    touchManagedPtr printOperation
    return result'

data PrintOperationGetPageSetupMethodInfo
instance (signature ~ (m Gtk.PageSetup.PageSetup), MonadIO m, IsPrintOperation a) => O.MethodInfo PrintOperationGetPageSetupMethodInfo a signature where
    overloadedMethod _ = printOperationGetPageSetup

-- method PrintOperation::get_print_settings
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "print_operation", argType = TInterface (Name {namespace = "WebKit2", name = "PrintOperation"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitPrintOperation", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gtk", name = "PrintSettings"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_print_operation_get_print_settings" webkit_print_operation_get_print_settings :: 
    Ptr PrintOperation ->                   -- print_operation : TInterface (Name {namespace = "WebKit2", name = "PrintOperation"})
    IO (Ptr Gtk.PrintSettings.PrintSettings)

{- |
Return the current print settings of /@printOperation@/. It returns 'Nothing' until
either 'GI.WebKit2.Objects.PrintOperation.printOperationSetPrintSettings' or 'GI.WebKit2.Objects.PrintOperation.printOperationRunDialog'
have been called.
-}
printOperationGetPrintSettings ::
    (B.CallStack.HasCallStack, MonadIO m, IsPrintOperation a) =>
    a
    {- ^ /@printOperation@/: a 'GI.WebKit2.Objects.PrintOperation.PrintOperation' -}
    -> m Gtk.PrintSettings.PrintSettings
    {- ^ __Returns:__ the current 'GI.Gtk.Objects.PrintSettings.PrintSettings' of /@printOperation@/. -}
printOperationGetPrintSettings printOperation = liftIO $ do
    printOperation' <- unsafeManagedPtrCastPtr printOperation
    result <- webkit_print_operation_get_print_settings printOperation'
    checkUnexpectedReturnNULL "printOperationGetPrintSettings" result
    result' <- (newObject Gtk.PrintSettings.PrintSettings) result
    touchManagedPtr printOperation
    return result'

data PrintOperationGetPrintSettingsMethodInfo
instance (signature ~ (m Gtk.PrintSettings.PrintSettings), MonadIO m, IsPrintOperation a) => O.MethodInfo PrintOperationGetPrintSettingsMethodInfo a signature where
    overloadedMethod _ = printOperationGetPrintSettings

-- method PrintOperation::print
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "print_operation", argType = TInterface (Name {namespace = "WebKit2", name = "PrintOperation"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitPrintOperation", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "webkit_print_operation_print" webkit_print_operation_print :: 
    Ptr PrintOperation ->                   -- print_operation : TInterface (Name {namespace = "WebKit2", name = "PrintOperation"})
    IO ()

{- |
Start a print operation using current print settings and page setup
without showing the print dialog. If either print settings or page setup
are not set with 'GI.WebKit2.Objects.PrintOperation.printOperationSetPrintSettings' and
'GI.WebKit2.Objects.PrintOperation.printOperationSetPageSetup', the default options will be used
and the print job will be sent to the default printer.
The 'GI.WebKit2.Objects.PrintOperation.PrintOperation'::@/finished/@ signal is emitted when the printing
operation finishes. If an error occurs while printing the signal
'GI.WebKit2.Objects.PrintOperation.PrintOperation'::@/failed/@ is emitted before 'GI.WebKit2.Objects.PrintOperation.PrintOperation'::@/finished/@.
-}
printOperationPrint ::
    (B.CallStack.HasCallStack, MonadIO m, IsPrintOperation a) =>
    a
    {- ^ /@printOperation@/: a 'GI.WebKit2.Objects.PrintOperation.PrintOperation' -}
    -> m ()
printOperationPrint printOperation = liftIO $ do
    printOperation' <- unsafeManagedPtrCastPtr printOperation
    webkit_print_operation_print printOperation'
    touchManagedPtr printOperation
    return ()

data PrintOperationPrintMethodInfo
instance (signature ~ (m ()), MonadIO m, IsPrintOperation a) => O.MethodInfo PrintOperationPrintMethodInfo a signature where
    overloadedMethod _ = printOperationPrint

-- method PrintOperation::run_dialog
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "print_operation", argType = TInterface (Name {namespace = "WebKit2", name = "PrintOperation"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitPrintOperation", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent", argType = TInterface (Name {namespace = "Gtk", name = "Window"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "transient parent of the print dialog", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "WebKit2", name = "PrintOperationResponse"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_print_operation_run_dialog" webkit_print_operation_run_dialog :: 
    Ptr PrintOperation ->                   -- print_operation : TInterface (Name {namespace = "WebKit2", name = "PrintOperation"})
    Ptr Gtk.Window.Window ->                -- parent : TInterface (Name {namespace = "Gtk", name = "Window"})
    IO CUInt

{- |
Run the print dialog and start printing using the options selected by
the user. This method returns when the print dialog is closed.
If the print dialog is cancelled 'GI.WebKit2.Enums.PrintOperationResponseCancel'
is returned. If the user clicks on the print button, 'GI.WebKit2.Enums.PrintOperationResponsePrint'
is returned and the print operation starts. In this case, the 'GI.WebKit2.Objects.PrintOperation.PrintOperation'::@/finished/@
signal is emitted when the operation finishes. If an error occurs while printing, the signal
'GI.WebKit2.Objects.PrintOperation.PrintOperation'::@/failed/@ is emitted before 'GI.WebKit2.Objects.PrintOperation.PrintOperation'::@/finished/@.
If the print dialog is not cancelled current print settings and page setup of /@printOperation@/
are updated with options selected by the user when Print button is pressed in print dialog.
You can get the updated print settings and page setup by calling
'GI.WebKit2.Objects.PrintOperation.printOperationGetPrintSettings' and 'GI.WebKit2.Objects.PrintOperation.printOperationGetPageSetup'
after this method.
-}
printOperationRunDialog ::
    (B.CallStack.HasCallStack, MonadIO m, IsPrintOperation a, Gtk.Window.IsWindow b) =>
    a
    {- ^ /@printOperation@/: a 'GI.WebKit2.Objects.PrintOperation.PrintOperation' -}
    -> Maybe (b)
    {- ^ /@parent@/: transient parent of the print dialog -}
    -> m WebKit2.Enums.PrintOperationResponse
    {- ^ __Returns:__ the 'GI.WebKit2.Enums.PrintOperationResponse' of the print dialog -}
printOperationRunDialog printOperation parent = liftIO $ do
    printOperation' <- unsafeManagedPtrCastPtr printOperation
    maybeParent <- case parent of
        Nothing -> return nullPtr
        Just jParent -> do
            jParent' <- unsafeManagedPtrCastPtr jParent
            return jParent'
    result <- webkit_print_operation_run_dialog printOperation' maybeParent
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr printOperation
    whenJust parent touchManagedPtr
    return result'

data PrintOperationRunDialogMethodInfo
instance (signature ~ (Maybe (b) -> m WebKit2.Enums.PrintOperationResponse), MonadIO m, IsPrintOperation a, Gtk.Window.IsWindow b) => O.MethodInfo PrintOperationRunDialogMethodInfo a signature where
    overloadedMethod _ = printOperationRunDialog

-- method PrintOperation::set_page_setup
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "print_operation", argType = TInterface (Name {namespace = "WebKit2", name = "PrintOperation"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitPrintOperation", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "page_setup", argType = TInterface (Name {namespace = "Gtk", name = "PageSetup"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkPageSetup to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "webkit_print_operation_set_page_setup" webkit_print_operation_set_page_setup :: 
    Ptr PrintOperation ->                   -- print_operation : TInterface (Name {namespace = "WebKit2", name = "PrintOperation"})
    Ptr Gtk.PageSetup.PageSetup ->          -- page_setup : TInterface (Name {namespace = "Gtk", name = "PageSetup"})
    IO ()

{- |
Set the current page setup of /@printOperation@/. Current page setup is used for the
initial values of the print dialog when 'GI.WebKit2.Objects.PrintOperation.printOperationRunDialog' is called.
-}
printOperationSetPageSetup ::
    (B.CallStack.HasCallStack, MonadIO m, IsPrintOperation a, Gtk.PageSetup.IsPageSetup b) =>
    a
    {- ^ /@printOperation@/: a 'GI.WebKit2.Objects.PrintOperation.PrintOperation' -}
    -> b
    {- ^ /@pageSetup@/: a 'GI.Gtk.Objects.PageSetup.PageSetup' to set -}
    -> m ()
printOperationSetPageSetup printOperation pageSetup = liftIO $ do
    printOperation' <- unsafeManagedPtrCastPtr printOperation
    pageSetup' <- unsafeManagedPtrCastPtr pageSetup
    webkit_print_operation_set_page_setup printOperation' pageSetup'
    touchManagedPtr printOperation
    touchManagedPtr pageSetup
    return ()

data PrintOperationSetPageSetupMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsPrintOperation a, Gtk.PageSetup.IsPageSetup b) => O.MethodInfo PrintOperationSetPageSetupMethodInfo a signature where
    overloadedMethod _ = printOperationSetPageSetup

-- method PrintOperation::set_print_settings
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "print_operation", argType = TInterface (Name {namespace = "WebKit2", name = "PrintOperation"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitPrintOperation", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "print_settings", argType = TInterface (Name {namespace = "Gtk", name = "PrintSettings"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkPrintSettings to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "webkit_print_operation_set_print_settings" webkit_print_operation_set_print_settings :: 
    Ptr PrintOperation ->                   -- print_operation : TInterface (Name {namespace = "WebKit2", name = "PrintOperation"})
    Ptr Gtk.PrintSettings.PrintSettings ->  -- print_settings : TInterface (Name {namespace = "Gtk", name = "PrintSettings"})
    IO ()

{- |
Set the current print settings of /@printOperation@/. Current print settings are used for
the initial values of the print dialog when 'GI.WebKit2.Objects.PrintOperation.printOperationRunDialog' is called.
-}
printOperationSetPrintSettings ::
    (B.CallStack.HasCallStack, MonadIO m, IsPrintOperation a, Gtk.PrintSettings.IsPrintSettings b) =>
    a
    {- ^ /@printOperation@/: a 'GI.WebKit2.Objects.PrintOperation.PrintOperation' -}
    -> b
    {- ^ /@printSettings@/: a 'GI.Gtk.Objects.PrintSettings.PrintSettings' to set -}
    -> m ()
printOperationSetPrintSettings printOperation printSettings = liftIO $ do
    printOperation' <- unsafeManagedPtrCastPtr printOperation
    printSettings' <- unsafeManagedPtrCastPtr printSettings
    webkit_print_operation_set_print_settings printOperation' printSettings'
    touchManagedPtr printOperation
    touchManagedPtr printSettings
    return ()

data PrintOperationSetPrintSettingsMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsPrintOperation a, Gtk.PrintSettings.IsPrintSettings b) => O.MethodInfo PrintOperationSetPrintSettingsMethodInfo a signature where
    overloadedMethod _ = printOperationSetPrintSettings