{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- /No description available in the introspection data./

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Gtk.Interfaces.PrintOperationPreview
    ( 

-- * Exported types
    PrintOperationPreview(..)               ,
    IsPrintOperationPreview                 ,
    toPrintOperationPreview                 ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolvePrintOperationPreviewMethod      ,
#endif


-- ** endPreview #method:endPreview#

#if defined(ENABLE_OVERLOADING)
    PrintOperationPreviewEndPreviewMethodInfo,
#endif
    printOperationPreviewEndPreview         ,


-- ** isSelected #method:isSelected#

#if defined(ENABLE_OVERLOADING)
    PrintOperationPreviewIsSelectedMethodInfo,
#endif
    printOperationPreviewIsSelected         ,


-- ** renderPage #method:renderPage#

#if defined(ENABLE_OVERLOADING)
    PrintOperationPreviewRenderPageMethodInfo,
#endif
    printOperationPreviewRenderPage         ,




 -- * Signals
-- ** gotPageSize #signal:gotPageSize#

    C_PrintOperationPreviewGotPageSizeCallback,
    PrintOperationPreviewGotPageSizeCallback,
#if defined(ENABLE_OVERLOADING)
    PrintOperationPreviewGotPageSizeSignalInfo,
#endif
    afterPrintOperationPreviewGotPageSize   ,
    genClosure_PrintOperationPreviewGotPageSize,
    mk_PrintOperationPreviewGotPageSizeCallback,
    noPrintOperationPreviewGotPageSizeCallback,
    onPrintOperationPreviewGotPageSize      ,
    wrap_PrintOperationPreviewGotPageSizeCallback,


-- ** ready #signal:ready#

    C_PrintOperationPreviewReadyCallback    ,
    PrintOperationPreviewReadyCallback      ,
#if defined(ENABLE_OVERLOADING)
    PrintOperationPreviewReadySignalInfo    ,
#endif
    afterPrintOperationPreviewReady         ,
    genClosure_PrintOperationPreviewReady   ,
    mk_PrintOperationPreviewReadyCallback   ,
    noPrintOperationPreviewReadyCallback    ,
    onPrintOperationPreviewReady            ,
    wrap_PrintOperationPreviewReadyCallback ,




    ) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
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 GHC.OverloadedLabels as OL

import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gtk.Objects.PageSetup as Gtk.PageSetup
import {-# SOURCE #-} qualified GI.Gtk.Objects.PrintContext as Gtk.PrintContext

-- interface PrintOperationPreview 
-- | Memory-managed wrapper type.
newtype PrintOperationPreview = PrintOperationPreview (SP.ManagedPtr PrintOperationPreview)
    deriving (PrintOperationPreview -> PrintOperationPreview -> Bool
(PrintOperationPreview -> PrintOperationPreview -> Bool)
-> (PrintOperationPreview -> PrintOperationPreview -> Bool)
-> Eq PrintOperationPreview
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PrintOperationPreview -> PrintOperationPreview -> Bool
$c/= :: PrintOperationPreview -> PrintOperationPreview -> Bool
== :: PrintOperationPreview -> PrintOperationPreview -> Bool
$c== :: PrintOperationPreview -> PrintOperationPreview -> Bool
Eq)

instance SP.ManagedPtrNewtype PrintOperationPreview where
    toManagedPtr :: PrintOperationPreview -> ManagedPtr PrintOperationPreview
toManagedPtr (PrintOperationPreview ManagedPtr PrintOperationPreview
p) = ManagedPtr PrintOperationPreview
p

foreign import ccall "gtk_print_operation_preview_get_type"
    c_gtk_print_operation_preview_get_type :: IO B.Types.GType

instance B.Types.TypedObject PrintOperationPreview where
    glibType :: IO GType
glibType = IO GType
c_gtk_print_operation_preview_get_type

instance B.Types.GObject PrintOperationPreview

-- | Convert 'PrintOperationPreview' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue PrintOperationPreview where
    toGValue :: PrintOperationPreview -> IO GValue
toGValue PrintOperationPreview
o = do
        GType
gtype <- IO GType
c_gtk_print_operation_preview_get_type
        PrintOperationPreview
-> (Ptr PrintOperationPreview -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr PrintOperationPreview
o (GType
-> (GValue -> Ptr PrintOperationPreview -> IO ())
-> Ptr PrintOperationPreview
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr PrintOperationPreview -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
        
    fromGValue :: GValue -> IO PrintOperationPreview
fromGValue GValue
gv = do
        Ptr PrintOperationPreview
ptr <- GValue -> IO (Ptr PrintOperationPreview)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr PrintOperationPreview)
        (ManagedPtr PrintOperationPreview -> PrintOperationPreview)
-> Ptr PrintOperationPreview -> IO PrintOperationPreview
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr PrintOperationPreview -> PrintOperationPreview
PrintOperationPreview Ptr PrintOperationPreview
ptr
        
    

-- | Type class for types which can be safely cast to `PrintOperationPreview`, for instance with `toPrintOperationPreview`.
class (SP.GObject o, O.IsDescendantOf PrintOperationPreview o) => IsPrintOperationPreview o
instance (SP.GObject o, O.IsDescendantOf PrintOperationPreview o) => IsPrintOperationPreview o

instance O.HasParentTypes PrintOperationPreview
type instance O.ParentTypes PrintOperationPreview = '[GObject.Object.Object]

-- | Cast to `PrintOperationPreview`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toPrintOperationPreview :: (MonadIO m, IsPrintOperationPreview o) => o -> m PrintOperationPreview
toPrintOperationPreview :: o -> m PrintOperationPreview
toPrintOperationPreview = IO PrintOperationPreview -> m PrintOperationPreview
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO PrintOperationPreview -> m PrintOperationPreview)
-> (o -> IO PrintOperationPreview) -> o -> m PrintOperationPreview
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr PrintOperationPreview -> PrintOperationPreview)
-> o -> IO PrintOperationPreview
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr PrintOperationPreview -> PrintOperationPreview
PrintOperationPreview

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList PrintOperationPreview
type instance O.AttributeList PrintOperationPreview = PrintOperationPreviewAttributeList
type PrintOperationPreviewAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type family ResolvePrintOperationPreviewMethod (t :: Symbol) (o :: *) :: * where
    ResolvePrintOperationPreviewMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolvePrintOperationPreviewMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolvePrintOperationPreviewMethod "endPreview" o = PrintOperationPreviewEndPreviewMethodInfo
    ResolvePrintOperationPreviewMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolvePrintOperationPreviewMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolvePrintOperationPreviewMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolvePrintOperationPreviewMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolvePrintOperationPreviewMethod "isSelected" o = PrintOperationPreviewIsSelectedMethodInfo
    ResolvePrintOperationPreviewMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolvePrintOperationPreviewMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolvePrintOperationPreviewMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolvePrintOperationPreviewMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolvePrintOperationPreviewMethod "renderPage" o = PrintOperationPreviewRenderPageMethodInfo
    ResolvePrintOperationPreviewMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolvePrintOperationPreviewMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolvePrintOperationPreviewMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolvePrintOperationPreviewMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolvePrintOperationPreviewMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolvePrintOperationPreviewMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolvePrintOperationPreviewMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolvePrintOperationPreviewMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolvePrintOperationPreviewMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolvePrintOperationPreviewMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolvePrintOperationPreviewMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolvePrintOperationPreviewMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolvePrintOperationPreviewMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolvePrintOperationPreviewMethod t PrintOperationPreview, O.MethodInfo info PrintOperationPreview p) => OL.IsLabel t (PrintOperationPreview -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#endif

-- method PrintOperationPreview::end_preview
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "preview"
--           , argType =
--               TInterface
--                 Name { namespace = "Gtk" , name = "PrintOperationPreview" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkPrintOperationPreview"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_print_operation_preview_end_preview" gtk_print_operation_preview_end_preview :: 
    Ptr PrintOperationPreview ->            -- preview : TInterface (Name {namespace = "Gtk", name = "PrintOperationPreview"})
    IO ()

-- | Ends a preview.
-- 
-- This function must be called to finish a custom print preview.
-- 
-- /Since: 2.10/
printOperationPreviewEndPreview ::
    (B.CallStack.HasCallStack, MonadIO m, IsPrintOperationPreview a) =>
    a
    -- ^ /@preview@/: a t'GI.Gtk.Interfaces.PrintOperationPreview.PrintOperationPreview'
    -> m ()
printOperationPreviewEndPreview :: a -> m ()
printOperationPreviewEndPreview a
preview = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr PrintOperationPreview
preview' <- a -> IO (Ptr PrintOperationPreview)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
preview
    Ptr PrintOperationPreview -> IO ()
gtk_print_operation_preview_end_preview Ptr PrintOperationPreview
preview'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
preview
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data PrintOperationPreviewEndPreviewMethodInfo
instance (signature ~ (m ()), MonadIO m, IsPrintOperationPreview a) => O.MethodInfo PrintOperationPreviewEndPreviewMethodInfo a signature where
    overloadedMethod = printOperationPreviewEndPreview

#endif

-- method PrintOperationPreview::is_selected
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "preview"
--           , argType =
--               TInterface
--                 Name { namespace = "Gtk" , name = "PrintOperationPreview" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkPrintOperationPreview"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "page_nr"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a page number" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_print_operation_preview_is_selected" gtk_print_operation_preview_is_selected :: 
    Ptr PrintOperationPreview ->            -- preview : TInterface (Name {namespace = "Gtk", name = "PrintOperationPreview"})
    Int32 ->                                -- page_nr : TBasicType TInt
    IO CInt

-- | Returns whether the given page is included in the set of pages that
-- have been selected for printing.
-- 
-- /Since: 2.10/
printOperationPreviewIsSelected ::
    (B.CallStack.HasCallStack, MonadIO m, IsPrintOperationPreview a) =>
    a
    -- ^ /@preview@/: a t'GI.Gtk.Interfaces.PrintOperationPreview.PrintOperationPreview'
    -> Int32
    -- ^ /@pageNr@/: a page number
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the page has been selected for printing
printOperationPreviewIsSelected :: a -> Int32 -> m Bool
printOperationPreviewIsSelected a
preview Int32
pageNr = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr PrintOperationPreview
preview' <- a -> IO (Ptr PrintOperationPreview)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
preview
    CInt
result <- Ptr PrintOperationPreview -> Int32 -> IO CInt
gtk_print_operation_preview_is_selected Ptr PrintOperationPreview
preview' Int32
pageNr
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
preview
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data PrintOperationPreviewIsSelectedMethodInfo
instance (signature ~ (Int32 -> m Bool), MonadIO m, IsPrintOperationPreview a) => O.MethodInfo PrintOperationPreviewIsSelectedMethodInfo a signature where
    overloadedMethod = printOperationPreviewIsSelected

#endif

-- method PrintOperationPreview::render_page
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "preview"
--           , argType =
--               TInterface
--                 Name { namespace = "Gtk" , name = "PrintOperationPreview" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkPrintOperationPreview"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "page_nr"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the page to render" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_print_operation_preview_render_page" gtk_print_operation_preview_render_page :: 
    Ptr PrintOperationPreview ->            -- preview : TInterface (Name {namespace = "Gtk", name = "PrintOperationPreview"})
    Int32 ->                                -- page_nr : TBasicType TInt
    IO ()

-- | Renders a page to the preview, using the print context that
-- was passed to the [preview]("GI.Gtk.Objects.PrintOperation#g:signal:preview") handler together
-- with /@preview@/.
-- 
-- A custom iprint preview should use this function in its [expose](#g:signal:expose)
-- handler to render the currently selected page.
-- 
-- Note that this function requires a suitable cairo context to
-- be associated with the print context.
-- 
-- /Since: 2.10/
printOperationPreviewRenderPage ::
    (B.CallStack.HasCallStack, MonadIO m, IsPrintOperationPreview a) =>
    a
    -- ^ /@preview@/: a t'GI.Gtk.Interfaces.PrintOperationPreview.PrintOperationPreview'
    -> Int32
    -- ^ /@pageNr@/: the page to render
    -> m ()
printOperationPreviewRenderPage :: a -> Int32 -> m ()
printOperationPreviewRenderPage a
preview Int32
pageNr = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr PrintOperationPreview
preview' <- a -> IO (Ptr PrintOperationPreview)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
preview
    Ptr PrintOperationPreview -> Int32 -> IO ()
gtk_print_operation_preview_render_page Ptr PrintOperationPreview
preview' Int32
pageNr
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
preview
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data PrintOperationPreviewRenderPageMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m, IsPrintOperationPreview a) => O.MethodInfo PrintOperationPreviewRenderPageMethodInfo a signature where
    overloadedMethod = printOperationPreviewRenderPage

#endif

-- signal PrintOperationPreview::got-page-size
-- | The [gotPageSize](#g:signal: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 'GI.Gtk.Objects.PrintContext.printContextSetCairoContext'.
type PrintOperationPreviewGotPageSizeCallback =
    Gtk.PrintContext.PrintContext
    -- ^ /@context@/: the current t'GI.Gtk.Objects.PrintContext.PrintContext'
    -> Gtk.PageSetup.PageSetup
    -- ^ /@pageSetup@/: the t'GI.Gtk.Objects.PageSetup.PageSetup' for the current page
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PrintOperationPreviewGotPageSizeCallback`@.
noPrintOperationPreviewGotPageSizeCallback :: Maybe PrintOperationPreviewGotPageSizeCallback
noPrintOperationPreviewGotPageSizeCallback :: Maybe PrintOperationPreviewGotPageSizeCallback
noPrintOperationPreviewGotPageSizeCallback = Maybe PrintOperationPreviewGotPageSizeCallback
forall a. Maybe a
Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_PrintOperationPreviewGotPageSizeCallback =
    Ptr () ->                               -- object
    Ptr Gtk.PrintContext.PrintContext ->
    Ptr Gtk.PageSetup.PageSetup ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_PrintOperationPreviewGotPageSizeCallback`.
foreign import ccall "wrapper"
    mk_PrintOperationPreviewGotPageSizeCallback :: C_PrintOperationPreviewGotPageSizeCallback -> IO (FunPtr C_PrintOperationPreviewGotPageSizeCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_PrintOperationPreviewGotPageSize :: MonadIO m => PrintOperationPreviewGotPageSizeCallback -> m (GClosure C_PrintOperationPreviewGotPageSizeCallback)
genClosure_PrintOperationPreviewGotPageSize :: PrintOperationPreviewGotPageSizeCallback
-> m (GClosure C_PrintOperationPreviewGotPageSizeCallback)
genClosure_PrintOperationPreviewGotPageSize PrintOperationPreviewGotPageSizeCallback
cb = IO (GClosure C_PrintOperationPreviewGotPageSizeCallback)
-> m (GClosure C_PrintOperationPreviewGotPageSizeCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_PrintOperationPreviewGotPageSizeCallback)
 -> m (GClosure C_PrintOperationPreviewGotPageSizeCallback))
-> IO (GClosure C_PrintOperationPreviewGotPageSizeCallback)
-> m (GClosure C_PrintOperationPreviewGotPageSizeCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_PrintOperationPreviewGotPageSizeCallback
cb' = PrintOperationPreviewGotPageSizeCallback
-> C_PrintOperationPreviewGotPageSizeCallback
wrap_PrintOperationPreviewGotPageSizeCallback PrintOperationPreviewGotPageSizeCallback
cb
    C_PrintOperationPreviewGotPageSizeCallback
-> IO (FunPtr C_PrintOperationPreviewGotPageSizeCallback)
mk_PrintOperationPreviewGotPageSizeCallback C_PrintOperationPreviewGotPageSizeCallback
cb' IO (FunPtr C_PrintOperationPreviewGotPageSizeCallback)
-> (FunPtr C_PrintOperationPreviewGotPageSizeCallback
    -> IO (GClosure C_PrintOperationPreviewGotPageSizeCallback))
-> IO (GClosure C_PrintOperationPreviewGotPageSizeCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_PrintOperationPreviewGotPageSizeCallback
-> IO (GClosure C_PrintOperationPreviewGotPageSizeCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `PrintOperationPreviewGotPageSizeCallback` into a `C_PrintOperationPreviewGotPageSizeCallback`.
wrap_PrintOperationPreviewGotPageSizeCallback ::
    PrintOperationPreviewGotPageSizeCallback ->
    C_PrintOperationPreviewGotPageSizeCallback
wrap_PrintOperationPreviewGotPageSizeCallback :: PrintOperationPreviewGotPageSizeCallback
-> C_PrintOperationPreviewGotPageSizeCallback
wrap_PrintOperationPreviewGotPageSizeCallback PrintOperationPreviewGotPageSizeCallback
_cb Ptr ()
_ Ptr PrintContext
context Ptr PageSetup
pageSetup Ptr ()
_ = do
    PrintContext
context' <- ((ManagedPtr PrintContext -> PrintContext)
-> Ptr PrintContext -> IO PrintContext
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr PrintContext -> PrintContext
Gtk.PrintContext.PrintContext) Ptr PrintContext
context
    PageSetup
pageSetup' <- ((ManagedPtr PageSetup -> PageSetup)
-> Ptr PageSetup -> IO PageSetup
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr PageSetup -> PageSetup
Gtk.PageSetup.PageSetup) Ptr PageSetup
pageSetup
    PrintOperationPreviewGotPageSizeCallback
_cb  PrintContext
context' PageSetup
pageSetup'


-- | Connect a signal handler for the [gotPageSize](#signal:gotPageSize) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' printOperationPreview #gotPageSize callback
-- @
-- 
-- 
onPrintOperationPreviewGotPageSize :: (IsPrintOperationPreview a, MonadIO m) => a -> PrintOperationPreviewGotPageSizeCallback -> m SignalHandlerId
onPrintOperationPreviewGotPageSize :: a -> PrintOperationPreviewGotPageSizeCallback -> m SignalHandlerId
onPrintOperationPreviewGotPageSize a
obj PrintOperationPreviewGotPageSizeCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_PrintOperationPreviewGotPageSizeCallback
cb' = PrintOperationPreviewGotPageSizeCallback
-> C_PrintOperationPreviewGotPageSizeCallback
wrap_PrintOperationPreviewGotPageSizeCallback PrintOperationPreviewGotPageSizeCallback
cb
    FunPtr C_PrintOperationPreviewGotPageSizeCallback
cb'' <- C_PrintOperationPreviewGotPageSizeCallback
-> IO (FunPtr C_PrintOperationPreviewGotPageSizeCallback)
mk_PrintOperationPreviewGotPageSizeCallback C_PrintOperationPreviewGotPageSizeCallback
cb'
    a
-> Text
-> FunPtr C_PrintOperationPreviewGotPageSizeCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"got-page-size" FunPtr C_PrintOperationPreviewGotPageSizeCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [gotPageSize](#signal:gotPageSize) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' printOperationPreview #gotPageSize callback
-- @
-- 
-- 
afterPrintOperationPreviewGotPageSize :: (IsPrintOperationPreview a, MonadIO m) => a -> PrintOperationPreviewGotPageSizeCallback -> m SignalHandlerId
afterPrintOperationPreviewGotPageSize :: a -> PrintOperationPreviewGotPageSizeCallback -> m SignalHandlerId
afterPrintOperationPreviewGotPageSize a
obj PrintOperationPreviewGotPageSizeCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_PrintOperationPreviewGotPageSizeCallback
cb' = PrintOperationPreviewGotPageSizeCallback
-> C_PrintOperationPreviewGotPageSizeCallback
wrap_PrintOperationPreviewGotPageSizeCallback PrintOperationPreviewGotPageSizeCallback
cb
    FunPtr C_PrintOperationPreviewGotPageSizeCallback
cb'' <- C_PrintOperationPreviewGotPageSizeCallback
-> IO (FunPtr C_PrintOperationPreviewGotPageSizeCallback)
mk_PrintOperationPreviewGotPageSizeCallback C_PrintOperationPreviewGotPageSizeCallback
cb'
    a
-> Text
-> FunPtr C_PrintOperationPreviewGotPageSizeCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"got-page-size" FunPtr C_PrintOperationPreviewGotPageSizeCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data PrintOperationPreviewGotPageSizeSignalInfo
instance SignalInfo PrintOperationPreviewGotPageSizeSignalInfo where
    type HaskellCallbackType PrintOperationPreviewGotPageSizeSignalInfo = PrintOperationPreviewGotPageSizeCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_PrintOperationPreviewGotPageSizeCallback cb
        cb'' <- mk_PrintOperationPreviewGotPageSizeCallback cb'
        connectSignalFunPtr obj "got-page-size" cb'' connectMode detail

#endif

-- signal PrintOperationPreview::ready
-- | The [ready](#g:signal: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.
type PrintOperationPreviewReadyCallback =
    Gtk.PrintContext.PrintContext
    -- ^ /@context@/: the current t'GI.Gtk.Objects.PrintContext.PrintContext'
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PrintOperationPreviewReadyCallback`@.
noPrintOperationPreviewReadyCallback :: Maybe PrintOperationPreviewReadyCallback
noPrintOperationPreviewReadyCallback :: Maybe PrintOperationPreviewReadyCallback
noPrintOperationPreviewReadyCallback = Maybe PrintOperationPreviewReadyCallback
forall a. Maybe a
Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_PrintOperationPreviewReadyCallback =
    Ptr () ->                               -- object
    Ptr Gtk.PrintContext.PrintContext ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_PrintOperationPreviewReadyCallback`.
foreign import ccall "wrapper"
    mk_PrintOperationPreviewReadyCallback :: C_PrintOperationPreviewReadyCallback -> IO (FunPtr C_PrintOperationPreviewReadyCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_PrintOperationPreviewReady :: MonadIO m => PrintOperationPreviewReadyCallback -> m (GClosure C_PrintOperationPreviewReadyCallback)
genClosure_PrintOperationPreviewReady :: PrintOperationPreviewReadyCallback
-> m (GClosure C_PrintOperationPreviewReadyCallback)
genClosure_PrintOperationPreviewReady PrintOperationPreviewReadyCallback
cb = IO (GClosure C_PrintOperationPreviewReadyCallback)
-> m (GClosure C_PrintOperationPreviewReadyCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_PrintOperationPreviewReadyCallback)
 -> m (GClosure C_PrintOperationPreviewReadyCallback))
-> IO (GClosure C_PrintOperationPreviewReadyCallback)
-> m (GClosure C_PrintOperationPreviewReadyCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_PrintOperationPreviewReadyCallback
cb' = PrintOperationPreviewReadyCallback
-> C_PrintOperationPreviewReadyCallback
wrap_PrintOperationPreviewReadyCallback PrintOperationPreviewReadyCallback
cb
    C_PrintOperationPreviewReadyCallback
-> IO (FunPtr C_PrintOperationPreviewReadyCallback)
mk_PrintOperationPreviewReadyCallback C_PrintOperationPreviewReadyCallback
cb' IO (FunPtr C_PrintOperationPreviewReadyCallback)
-> (FunPtr C_PrintOperationPreviewReadyCallback
    -> IO (GClosure C_PrintOperationPreviewReadyCallback))
-> IO (GClosure C_PrintOperationPreviewReadyCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_PrintOperationPreviewReadyCallback
-> IO (GClosure C_PrintOperationPreviewReadyCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `PrintOperationPreviewReadyCallback` into a `C_PrintOperationPreviewReadyCallback`.
wrap_PrintOperationPreviewReadyCallback ::
    PrintOperationPreviewReadyCallback ->
    C_PrintOperationPreviewReadyCallback
wrap_PrintOperationPreviewReadyCallback :: PrintOperationPreviewReadyCallback
-> C_PrintOperationPreviewReadyCallback
wrap_PrintOperationPreviewReadyCallback PrintOperationPreviewReadyCallback
_cb Ptr ()
_ Ptr PrintContext
context Ptr ()
_ = do
    PrintContext
context' <- ((ManagedPtr PrintContext -> PrintContext)
-> Ptr PrintContext -> IO PrintContext
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr PrintContext -> PrintContext
Gtk.PrintContext.PrintContext) Ptr PrintContext
context
    PrintOperationPreviewReadyCallback
_cb  PrintContext
context'


-- | Connect a signal handler for the [ready](#signal:ready) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' printOperationPreview #ready callback
-- @
-- 
-- 
onPrintOperationPreviewReady :: (IsPrintOperationPreview a, MonadIO m) => a -> PrintOperationPreviewReadyCallback -> m SignalHandlerId
onPrintOperationPreviewReady :: a -> PrintOperationPreviewReadyCallback -> m SignalHandlerId
onPrintOperationPreviewReady a
obj PrintOperationPreviewReadyCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_PrintOperationPreviewReadyCallback
cb' = PrintOperationPreviewReadyCallback
-> C_PrintOperationPreviewReadyCallback
wrap_PrintOperationPreviewReadyCallback PrintOperationPreviewReadyCallback
cb
    FunPtr C_PrintOperationPreviewReadyCallback
cb'' <- C_PrintOperationPreviewReadyCallback
-> IO (FunPtr C_PrintOperationPreviewReadyCallback)
mk_PrintOperationPreviewReadyCallback C_PrintOperationPreviewReadyCallback
cb'
    a
-> Text
-> FunPtr C_PrintOperationPreviewReadyCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"ready" FunPtr C_PrintOperationPreviewReadyCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [ready](#signal:ready) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' printOperationPreview #ready callback
-- @
-- 
-- 
afterPrintOperationPreviewReady :: (IsPrintOperationPreview a, MonadIO m) => a -> PrintOperationPreviewReadyCallback -> m SignalHandlerId
afterPrintOperationPreviewReady :: a -> PrintOperationPreviewReadyCallback -> m SignalHandlerId
afterPrintOperationPreviewReady a
obj PrintOperationPreviewReadyCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_PrintOperationPreviewReadyCallback
cb' = PrintOperationPreviewReadyCallback
-> C_PrintOperationPreviewReadyCallback
wrap_PrintOperationPreviewReadyCallback PrintOperationPreviewReadyCallback
cb
    FunPtr C_PrintOperationPreviewReadyCallback
cb'' <- C_PrintOperationPreviewReadyCallback
-> IO (FunPtr C_PrintOperationPreviewReadyCallback)
mk_PrintOperationPreviewReadyCallback C_PrintOperationPreviewReadyCallback
cb'
    a
-> Text
-> FunPtr C_PrintOperationPreviewReadyCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"ready" FunPtr C_PrintOperationPreviewReadyCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data PrintOperationPreviewReadySignalInfo
instance SignalInfo PrintOperationPreviewReadySignalInfo where
    type HaskellCallbackType PrintOperationPreviewReadySignalInfo = PrintOperationPreviewReadyCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_PrintOperationPreviewReadyCallback cb
        cb'' <- mk_PrintOperationPreviewReadyCallback cb'
        connectSignalFunPtr obj "ready" cb'' connectMode detail

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList PrintOperationPreview = PrintOperationPreviewSignalList
type PrintOperationPreviewSignalList = ('[ '("gotPageSize", PrintOperationPreviewGotPageSizeSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("ready", PrintOperationPreviewReadySignalInfo)] :: [(Symbol, *)])

#endif